Use currency symbol from config in tests

This commit is contained in:
Julius Pabrinkis
2017-04-04 14:01:57 +01:00
parent 41e91765ca
commit dc69c6e825
7 changed files with 91 additions and 88 deletions

View File

@@ -32,10 +32,10 @@ feature "full-page cart", js: true do
it "rounds fee calculations correctly" do
# $0.86 + 20% = $1.032
# Fractional cents should be immediately rounded down and not carried through
expect(page).to have_selector '.cart-item-price', text: '$1.03'
expect(page).to have_selector '.cart-item-total', text: '$8.24'
expect(page).to have_selector '.order-total.item-total', text: '$8.24'
expect(page).to have_selector '.order-total.grand-total', text: '$8.24'
expect(page).to have_selector '.cart-item-price', text: "#{@currency_symbol}1.03"
expect(page).to have_selector '.cart-item-total', text: "#{@currency_symbol}8.24"
expect(page).to have_selector '.order-total.item-total', text: "#{@currency_symbol}8.24"
expect(page).to have_selector '.order-total.grand-total', text: "#{@currency_symbol}8.24"
end
end

View File

@@ -135,9 +135,9 @@ feature "As a consumer I want to check out my cart", js: true, retry: 3 do
toggle_shipping
choose sm2.name
page.should have_selector 'orderdetails .cart-total', text: "$11.23"
page.should have_selector 'orderdetails .shipping', text: "$4.56"
page.should have_selector 'orderdetails .total', text: "$15.79"
page.should have_selector 'orderdetails .cart-total', text: "#{@currency_symbol}11.23"
page.should have_selector 'orderdetails .shipping', text: "#{@currency_symbol}4.56"
page.should have_selector 'orderdetails .total', text: "#{@currency_symbol}15.79"
# Tax should not be displayed in checkout, as the customer's choice of shipping method
# affects the tax and we haven't written code to live-update the tax amount when they
@@ -269,7 +269,7 @@ feature "As a consumer I want to check out my cart", js: true, retry: 3 do
# + shipping tax ($ 4.56 @ 25% = $0.91)
# = $1.93
page.should have_content "(includes tax)"
page.should have_content "$1.93"
page.should have_content "#{@currency_symbol}1.93"
end
context "with basic details filled" do
@@ -331,14 +331,14 @@ feature "As a consumer I want to check out my cart", js: true, retry: 3 do
context "when we are charged a payment method fee (transaction fee)" do
it "creates a payment including the transaction fee" do
# Selecting the transaction fee, it is displayed
expect(page).to have_selector ".transaction-fee td", text: "$0.00"
expect(page).to have_selector ".total", text: "$11.23"
expect(page).to have_selector ".transaction-fee td", text: "#{@currency_symbol}0.00"
expect(page).to have_selector ".total", text: "#{@currency_symbol}11.23"
toggle_payment
choose "#{pm2.name} ($5.67)"
choose "#{pm2.name} (#{@currency_symbol}5.67)"
expect(page).to have_selector ".transaction-fee td", text: "$5.67"
expect(page).to have_selector ".total", text: "$16.90"
expect(page).to have_selector ".transaction-fee td", text: "#{@currency_symbol}5.67"
expect(page).to have_selector ".total", text: "#{@currency_symbol}16.90"
place_order
expect(page).to have_content "Your order has been processed successfully"

View File

@@ -95,23 +95,23 @@ feature "As a consumer I want to shop with a distributor", js: true do
# -- Selecting an order cycle
visit shop_path
select "turtles", from: "order_cycle_id"
page.should have_content "$1020.99"
page.should have_content "#{@currency_symbol}1020.99"
# -- Cart shows correct price
fill_in "variants[#{variant.id}]", with: 1
show_cart
within("li.cart") { page.should have_content "$1020.99" }
within("li.cart") { page.should have_content "#{@currency_symbol}1020.99" }
# -- Changing order cycle
select "frogs", from: "order_cycle_id"
page.should have_content "$19.99"
page.should have_content "#{@currency_symbol}19.99"
# -- Cart should be cleared
# ng-animate means that the old product row is likely to be present, so we explicitly
# fill in the quantity in the incoming row
page.should_not have_selector "tr.product-cart"
within('product.ng-enter') { fill_in "variants[#{variant.id}]", with: 1 }
within("li.cart") { page.should have_content "$19.99" }
within("li.cart") { page.should have_content "#{@currency_symbol}19.99" }
end
describe "declining to clear the cart" do
@@ -164,15 +164,15 @@ feature "As a consumer I want to shop with a distributor", js: true do
visit shop_path
# Page should not have product.price (with or without fee)
page.should_not have_price "$10.00"
page.should_not have_price "$33.00"
page.should_not have_price "#{@currency_symbol}10.00"
page.should_not have_price "#{@currency_symbol}33.00"
# Page should have variant prices (with fee)
page.should have_price "$43.00"
page.should have_price "$53.00"
page.should have_price "#{@currency_symbol}43.00"
page.should have_price "#{@currency_symbol}53.00"
# Product price should be listed as the lesser of these
page.should have_price "$43.00"
page.should have_price "#{@currency_symbol}43.00"
end
it "filters search results properly" do

View File

@@ -40,8 +40,8 @@ feature "shopping with variant overrides defined", js: true, retry: 3 do
describe "viewing products" do
it "shows the overridden price" do
page.should_not have_price "$12.22" # $11.11 + 10% fee
page.should have_price "$61.11"
page.should_not have_price "#{@currency_symbol}12.22" # $11.11 + 10% fee
page.should have_price "#{@currency_symbol}61.11"
end
it "looks up stock from the override" do
@@ -59,9 +59,9 @@ feature "shopping with variant overrides defined", js: true, retry: 3 do
it "calculates fees correctly" do
page.find("#variant-#{v1.id} .graph-button").click
page.find(".price_breakdown a").click
page.should have_selector 'li.cost div', text: '$55.55'
page.should have_selector 'li.packing-fee div', text: '$5.56'
page.should have_selector 'li.total div', text: '= $61.11'
page.should have_selector 'li.cost div', text: "#{@currency_symbol}55.55"
page.should have_selector 'li.packing-fee div', text: "#{@currency_symbol}5.56"
page.should have_selector 'li.total div', text: "= #{@currency_symbol}61.11"
end
it "shows the correct prices when products are in the cart" do
@@ -69,7 +69,7 @@ feature "shopping with variant overrides defined", js: true, retry: 3 do
show_cart
wait_until_enabled 'li.cart a.button'
visit shop_path
page.should_not have_price '$12.22'
page.should_not have_price "#{@currency_symbol}12.22"
end
# The two specs below reveal an unrelated issue with fee calculation. See:
@@ -79,29 +79,29 @@ feature "shopping with variant overrides defined", js: true, retry: 3 do
fill_in "variants[#{v1.id}]", with: "2"
show_cart
page.should have_selector "#cart-variant-#{v1.id} .quantity", text: '2'
page.should have_selector "#cart-variant-#{v1.id} .price", text: '$61.11'
page.should have_selector "#cart-variant-#{v1.id} .total-price", text: '$122.22'
page.should have_selector "#cart-variant-#{v1.id} .price", text: "#{@currency_symbol}61.11"
page.should have_selector "#cart-variant-#{v1.id} .total-price", text: "#{@currency_symbol}122.22"
end
it "shows the correct prices in the shopping cart" do
fill_in "variants[#{v1.id}]", with: "2"
add_to_cart
page.should have_selector "tr.line-item.variant-#{v1.id} .cart-item-price", text: '$61.11'
page.should have_selector "tr.line-item.variant-#{v1.id} .cart-item-price", text: "#{@currency_symbol}61.11"
page.should have_field "order[line_items_attributes][0][quantity]", with: '2'
page.should have_selector "tr.line-item.variant-#{v1.id} .cart-item-total", text: '$122.22'
page.should have_selector "tr.line-item.variant-#{v1.id} .cart-item-total", text: "#{@currency_symbol}122.22"
page.should have_selector "#edit-cart .item-total", text: '$122.22'
page.should have_selector "#edit-cart .grand-total", text: '$122.22'
page.should have_selector "#edit-cart .item-total", text: "#{@currency_symbol}122.22"
page.should have_selector "#edit-cart .grand-total", text: "#{@currency_symbol}122.22"
end
it "shows the correct prices in the checkout" do
fill_in "variants[#{v1.id}]", with: "2"
click_checkout
page.should have_selector 'form.edit_order .cart-total', text: '$122.22'
page.should have_selector 'form.edit_order .shipping', text: '$0.00'
page.should have_selector 'form.edit_order .total', text: '$122.22'
page.should have_selector 'form.edit_order .cart-total', text: "#{@currency_symbol}122.22"
page.should have_selector 'form.edit_order .shipping', text: "#{@currency_symbol}0.00"
page.should have_selector 'form.edit_order .total', text: "#{@currency_symbol}122.22"
end
end

View File

@@ -20,12 +20,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "$10 + 5.0% OF SALES, CAPPED AT $20 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 + 5.0% OF SALES, CAPPED AT #{@currency_symbol}20 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "$10 + 5.0% OF SALES PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 + 5.0% OF SALES PER MONTH, PLUS GST" }
end
end
@@ -34,12 +34,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "$10 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "$10 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 PER MONTH, PLUS GST" }
end
end
end
@@ -52,7 +52,7 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES, CAPPED AT $20 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES, CAPPED AT #{@currency_symbol}20 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
@@ -77,7 +77,7 @@ describe Admin::BusinessModelConfigurationHelper do
end
end
context "when minimum billable turnover is $100" do
context "when minimum billable turnover is #{@currency_symbol}100" do
before { Spree::Config.set(:minimum_billable_turnover, 100) }
context "when a fixed cost is included" do
@@ -88,12 +88,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "$10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS $100, CAPPED AT $20 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100, CAPPED AT #{@currency_symbol}20 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "$10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS $100 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100 PER MONTH, PLUS GST" }
end
end
@@ -102,12 +102,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "$10 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "$10 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 PER MONTH, PLUS GST" }
end
end
end
@@ -120,12 +120,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES ONCE TURNOVER EXCEEDS $100, CAPPED AT $20 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100, CAPPED AT #{@currency_symbol}20 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES ONCE TURNOVER EXCEEDS $100 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100 PER MONTH, PLUS GST" }
end
end
@@ -160,12 +160,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "$10 + 5.0% OF SALES, CAPPED AT $20 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 + 5.0% OF SALES, CAPPED AT #{@currency_symbol}20 PER MONTH" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "$10 + 5.0% OF SALES PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 + 5.0% OF SALES PER MONTH" }
end
end
@@ -174,12 +174,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "$10 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 PER MONTH" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "$10 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 PER MONTH" }
end
end
end
@@ -192,7 +192,7 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES, CAPPED AT $20 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES, CAPPED AT #{@currency_symbol}20 PER MONTH" }
end
context "when the bill is not capped" do
@@ -217,7 +217,7 @@ describe Admin::BusinessModelConfigurationHelper do
end
end
context "when minimum billable turnover is $100" do
context "when minimum billable turnover is #{@currency_symbol}100" do
before { Spree::Config.set(:minimum_billable_turnover, 100) }
context "when a fixed cost is included" do
@@ -228,12 +228,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "$10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS $100, CAPPED AT $20 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100, CAPPED AT #{@currency_symbol}20 PER MONTH" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "$10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS $100 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100 PER MONTH" }
end
end
@@ -242,12 +242,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "$10 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 PER MONTH" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "$10 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "#{@currency_symbol}10 PER MONTH" }
end
end
end
@@ -260,12 +260,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES ONCE TURNOVER EXCEEDS $100, CAPPED AT $20 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100, CAPPED AT #{@currency_symbol}20 PER MONTH" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES ONCE TURNOVER EXCEEDS $100 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100 PER MONTH" }
end
end
@@ -304,12 +304,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 + 5.0% OF SALES, CAPPED AT $20 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 + 5.0% OF SALES, CAPPED AT #{@currency_symbol}20 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 + 5.0% OF SALES PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 + 5.0% OF SALES PER MONTH, PLUS GST" }
end
end
@@ -318,12 +318,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 PER MONTH, PLUS GST" }
end
end
end
@@ -336,7 +336,7 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES, CAPPED AT $20 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES, CAPPED AT #{@currency_symbol}20 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
@@ -361,7 +361,7 @@ describe Admin::BusinessModelConfigurationHelper do
end
end
context "when minimum billable turnover is $100" do
context "when minimum billable turnover is #{@currency_symbol}100" do
before { Spree::Config.set(:minimum_billable_turnover, 100) }
context "when a fixed cost is included" do
@@ -372,12 +372,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS $100, CAPPED AT $20 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100, CAPPED AT #{@currency_symbol}20 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS $100 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100 PER MONTH, PLUS GST" }
end
end
@@ -386,12 +386,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 PER MONTH, PLUS GST" }
end
end
end
@@ -404,12 +404,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES ONCE TURNOVER EXCEEDS $100, CAPPED AT $20 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100, CAPPED AT #{@currency_symbol}20 PER MONTH, PLUS GST" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES ONCE TURNOVER EXCEEDS $100 PER MONTH, PLUS GST" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100 PER MONTH, PLUS GST" }
end
end
@@ -444,12 +444,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 + 5.0% OF SALES, CAPPED AT $20 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 + 5.0% OF SALES, CAPPED AT #{@currency_symbol}20 PER MONTH" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 + 5.0% OF SALES PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 + 5.0% OF SALES PER MONTH" }
end
end
@@ -458,12 +458,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 PER MONTH" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 PER MONTH" }
end
end
end
@@ -476,7 +476,7 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES, CAPPED AT $20 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES, CAPPED AT #{@currency_symbol}20 PER MONTH" }
end
context "when the bill is not capped" do
@@ -501,7 +501,7 @@ describe Admin::BusinessModelConfigurationHelper do
end
end
context "when minimum billable turnover is $100" do
context "when minimum billable turnover is #{@currency_symbol}100" do
before { Spree::Config.set(:minimum_billable_turnover, 100) }
context "when a fixed cost is included" do
@@ -512,12 +512,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS $100, CAPPED AT $20 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100, CAPPED AT #{@currency_symbol}20 PER MONTH" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS $100 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 + 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100 PER MONTH" }
end
end
@@ -526,12 +526,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 PER MONTH" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN $10 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN #{@currency_symbol}10 PER MONTH" }
end
end
end
@@ -544,12 +544,12 @@ describe Admin::BusinessModelConfigurationHelper do
context "when the bill is capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 20) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES ONCE TURNOVER EXCEEDS $100, CAPPED AT $20 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100, CAPPED AT #{@currency_symbol}20 PER MONTH" }
end
context "when the bill is not capped" do
before { Spree::Config.set(:account_invoices_monthly_cap, 0) }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES ONCE TURNOVER EXCEEDS $100 PER MONTH" }
it { expect(helper.monthly_bill_description).to eq "FREE TRIAL THEN 5.0% OF SALES ONCE TURNOVER EXCEEDS #{@currency_symbol}100 PER MONTH" }
end
end

View File

@@ -4,13 +4,13 @@ module Spree
describe ProductsHelper do
it "displays variant price differences as absolute, not relative values" do
variant = make_variant_stub(10.00, 10.00)
helper.variant_price_diff(variant).should == "($10.00)"
helper.variant_price_diff(variant).should == "(#{@currency_symbol}10.00)"
variant = make_variant_stub(10.00, 15.55)
helper.variant_price_diff(variant).should == "($15.55)"
helper.variant_price_diff(variant).should == "(#{@currency_symbol}15.55)"
variant = make_variant_stub(10.00, 5.55)
helper.variant_price_diff(variant).should == "($5.55)"
helper.variant_price_diff(variant).should == "(#{@currency_symbol}5.55)"
end
private

View File

@@ -93,6 +93,9 @@ RSpec.configure do |config|
# Ensure we start with consistent config settings
config.before(:each) { Spree::Config.products_require_tax_category = false }
# Set currency symbol from config for tests
config.before(:all) { @currency_symbol = ::Money::Currency.new(Spree::Config[:currency]).symbol }
# Helpers
config.include Rails.application.routes.url_helpers
config.include Spree::UrlHelpers