Commit caf96bbf by vulehuan

rspec: card - step 3: calculate price

parent 9e501b86
......@@ -351,6 +351,18 @@ describe "CardPages" do
end
describe "calculate price" do
let(:amount) { 1 }
it do
total = 0
Product.all.each do |product|
should have_xpath("//div[@id='cart-quantity-#{product.id}'][text()='#{amount}']")
should have_selector("#cart-unit-price-#{product.id}", text: ActionController::Base.helpers.number_with_delimiter(product.price))
should have_selector("#cart-total-price-#{product.id}", text: ActionController::Base.helpers.number_with_delimiter(product.price * amount))
total += product.price
end
should have_selector('#card-must-paid', text: ActionController::Base.helpers.number_with_delimiter(total))
end
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