Navigation Menu

Skip to content

Commit

Permalink
fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gudata committed Apr 21, 2012
1 parent ebe8040 commit 42211c3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/spree/wished_product.rb
Expand Up @@ -2,5 +2,5 @@ class Spree::WishedProduct < ActiveRecord::Base
belongs_to :variant
belongs_to :wishlist

attr_accessible :wishlist_id, :variant_id
attr_accessible :wishlist_id, :variant
end
2 changes: 1 addition & 1 deletion app/models/spree/wishlist.rb
Expand Up @@ -3,7 +3,7 @@ class Spree::Wishlist < ActiveRecord::Base
has_many :wished_products
before_create :set_access_hash

attr_accessible :name, :is_default, :is_private
attr_accessible :name, :is_default, :is_private, :user

validates :name, :presence => true

Expand Down
10 changes: 9 additions & 1 deletion spec/models/spree/wishlist_spec.rb
Expand Up @@ -6,6 +6,14 @@
@wishlist = Spree::Wishlist.new(:user => @user, :name => "My Wishlist")
end

context "can't mass assign ids" do
it "should not be able to assign variant_id" do
lambda {
Spree::Wishlist.new(:user_id => @user.id, :name => "My Wishlist")
}.should raise_error
end
end

context "creating a new wishlist" do
it "is valid with valid attributes" do
@wishlist.should be_valid
Expand All @@ -29,7 +37,7 @@
@wishlist.include?(@variant.id).should be_true
end
end

context "#to_param" do
it "should return the wishlist's access_hash" do
@wishlist.to_param.should == @wishlist.access_hash
Expand Down

0 comments on commit 42211c3

Please sign in to comment.