Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Trying to get Preference.new(:like => true) to work
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinmillan committed Jan 27, 2013
1 parent 051e292 commit 0af7946
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/models/preference.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
class Preference < ActiveRecord::Base
attr_accessible :like, :user_id, :restaurant_id
belongs_to :user
belongs_to :restaurant

def self.likes
#self.all.map { |pref| pref.likes }
end

def self.evaluate
# stuff
end
Expand Down
13 changes: 13 additions & 0 deletions spec/models/preference_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,17 @@
@pref.should have(:no).errors_on(:user)
end
end

describe "Like Method" do
it "Likes should default to false" do
@pref.like.should be_false
end

it "Likes should" do
Preference.likes.all? { |p| p.like == true }.should be_true
end



end
end

0 comments on commit 0af7946

Please sign in to comment.