Navigation Menu

Skip to content

Commit

Permalink
Fixed little erros, now pass all test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Pardiñas committed Sep 8, 2010
1 parent b350856 commit 73f1c75
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
16 changes: 14 additions & 2 deletions acts_as_shopping_cart.gemspec
Expand Up @@ -9,24 +9,33 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["David Padilla"]
s.date = %q{2010-07-22}
s.date = %q{2010-09-08}
s.description = %q{A simple shopping cart implementation}
s.email = %q{david.padilla@crowdint.com}
s.extra_rdoc_files = [
"LICENSE",
"README",
"README.markdown"
]
s.files = [
".document",
".gitignore",
"Gemfile",
"Gemfile.lock",
"LICENSE",
"README.markdown",
"Rakefile",
"VERSION",
"acts_as_shopping_cart.gemspec",
"lib/active_record/acts/shopping_cart.rb",
"lib/active_record/acts/shopping_cart/cart_instance_methods.rb",
"lib/active_record/acts/shopping_cart/item_instance_methods.rb",
"lib/active_record/acts/shopping_cart_item.rb",
"lib/active_record/acts/shopping_cart_item/cart_item_instance_methods.rb",
"lib/acts_as_shopping_cart.rb",
"spec/active_record/acts/shopping_cart/cart_instance_methods_spec.rb",
"spec/active_record/acts/shopping_cart/cart_item_instance_methods_spec.rb",
"spec/active_record/acts/shopping_cart/item_instance_methods_spec.rb",
"spec/acts_as_shopping_cart_spec.rb",
"spec/spec.opts",
"spec/spec_helper.rb"
Expand All @@ -37,7 +46,10 @@ Gem::Specification.new do |s|
s.rubygems_version = %q{1.3.7}
s.summary = %q{A simple shopping cart implementation}
s.test_files = [
"spec/acts_as_shopping_cart_spec.rb",
"spec/active_record/acts/shopping_cart/cart_instance_methods_spec.rb",
"spec/active_record/acts/shopping_cart/cart_item_instance_methods_spec.rb",
"spec/active_record/acts/shopping_cart/item_instance_methods_spec.rb",
"spec/acts_as_shopping_cart_spec.rb",
"spec/spec_helper.rb"
]

Expand Down
1 change: 1 addition & 0 deletions lib/active_record/acts/shopping_cart_item.rb
Expand Up @@ -17,6 +17,7 @@ module ClassMethods
#
#
def acts_as_shopping_cart_item_for(cart_class)
self.send :include, ActiveRecord::Acts::ShoppingCartItem::InstanceMethods
belongs_to :shopping_cart, :class_name => cart_class.to_s.classify
belongs_to :item, :polymorphic => true
end
Expand Down
2 changes: 1 addition & 1 deletion lib/acts_as_shopping_cart.rb
Expand Up @@ -3,9 +3,9 @@
require 'active_record/acts/shopping_cart'
require 'active_record/acts/shopping_cart/cart_instance_methods'
require 'active_record/acts/shopping_cart/item_instance_methods'
require 'active_record/acts/shopping_cart/cart_item_instance_methods'

require 'active_record/acts/shopping_cart_item'
require 'active_record/acts/shopping_cart_item/cart_item_instance_methods'

ActiveRecord::Base.send :extend, ActiveRecord::Acts::ShoppingCart::ClassMethods
ActiveRecord::Base.send :extend, ActiveRecord::Acts::ShoppingCartItem::ClassMethods
Expand Up @@ -17,9 +17,16 @@
end

describe :update_quantity do
before(:each) do
@cart.cart_items[0].update_quantity(6)
@cart.cart_items[1].update_quantity(9)
@cart.cart_items[2].update_quantity(12)
end

it "returns the quantity of the specified object" do
@cart.update_quantity_for(@some_object, 7)
@cart.quantity_for(@some_object).should == 7
@cart.cart_items[0].quantity.should == (6)
@cart.cart_items[1].quantity.should == (9)
@cart.cart_items[2].quantity.should == (12)
end
end
end

0 comments on commit 73f1c75

Please sign in to comment.