Skip to content
Browse files

fix the tests

  • Loading branch information...
1 parent ebe8040 commit 42211c3fbcf1ec8bcc6d70007212ce46ef17e7ee @gudata committed Apr 21, 2012
Showing with 11 additions and 3 deletions.
  1. +1 −1 app/models/spree/wished_product.rb
  2. +1 −1 app/models/spree/wishlist.rb
  3. +9 −1 spec/models/spree/wishlist_spec.rb
View
2 app/models/spree/wished_product.rb
@@ -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
View
2 app/models/spree/wishlist.rb
@@ -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
View
10 spec/models/spree/wishlist_spec.rb
@@ -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
@@ -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

0 comments on commit 42211c3

Please sign in to comment.
Something went wrong with that request. Please try again.