Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove custom empty? method in ShoppingCart Collection #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions lib/active_record/acts/shopping_cart/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ def clear
shopping_cart_items.clear
end

#
# Returns true when the cart is empty
#
def empty?
shopping_cart_items.empty?
end

#
# Remove an item from the cart
#
Expand Down
20 changes: 1 addition & 19 deletions spec/active_record/acts/shopping_cart/collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,7 @@

it "clears all the items in the cart" do
subject.clear
subject.empty?.should be_true
end
end

describe "empty?" do
context "cart has items" do
before do
subject.shopping_cart_items << mock
end

it "returns false" do
subject.empty?.should be_false
end
end

context "cart is empty" do
it "returns true" do
subject.empty?.should be_true
end
subject.shopping_cart_items.empty?.should be_true
end
end

Expand Down