Commit 476f0511 by vulehuan

rspec: card - remove a product in card - recalculted total cost

parent 973f4051
......@@ -114,21 +114,21 @@ describe "CardPages" do
describe "when product exist in card" do
# it "calculate price" do
# product = Product.first
# total = 0
# # Add to cart all
# Product.all.each do |obj|
# visit cards_path(product_id: product.id)
# total += obj.price
# end
# visit cards_path(card_action: 'remove', product_id: product.id)
describe "total price must be recalculated" do
let(:product) { Product.first }
total = 0
# total -= product.price
before do
visit cards_path(card_action: 'remove', product_id: product.id)
total = 0
Product.all.each do |obj|
total += obj.price
end
total -= product.price
end
# page.should have_selector('#card-must-paid', text: ActionController::Base.helpers.number_with_delimiter(total + 1))
# end
it { should have_selector('#card-must-paid', text: ActionController::Base.helpers.number_with_delimiter(total)) }
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment