mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-29 04:02:17 -04:00
@@ -13,6 +13,8 @@ class Planting < ActiveRecord::Base
|
||||
:to => :crop,
|
||||
:prefix => true
|
||||
|
||||
default_scope order("created_at desc")
|
||||
|
||||
SUNNINESS_VALUES = %w(sun semi-shade shade)
|
||||
validates :sunniness, :inclusion => { :in => SUNNINESS_VALUES,
|
||||
:message => "%{value} is not a valid sunniness value" },
|
||||
|
||||
@@ -112,15 +112,6 @@ ActiveRecord::Schema.define(:version => 20130329045744) do
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "payments", :force => true do |t|
|
||||
t.integer "payer_id"
|
||||
t.decimal "amount"
|
||||
t.date "paid_period_begins"
|
||||
t.date "paid_period_ends"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "plantings", :force => true do |t|
|
||||
t.integer "garden_id", :null => false
|
||||
t.integer "crop_id", :null => false
|
||||
|
||||
@@ -19,6 +19,12 @@ describe Planting do
|
||||
@planting.location.should match /^member\d+'s Springfield Community Garden$/
|
||||
end
|
||||
|
||||
it "sorts plantings in descending order of creation" do
|
||||
@planting1 = FactoryGirl.create(:planting)
|
||||
@planting2 = FactoryGirl.create(:planting)
|
||||
Planting.first.should eq @planting2
|
||||
end
|
||||
|
||||
it "should have a slug" do
|
||||
@planting.slug.should match /^member\d+-springfield-community-garden-tomato$/
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user