mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-29 21:17:17 +00:00
32 lines
844 B
Ruby
32 lines
844 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
RSpec.describe Spree::ShippingRate do
|
|
let(:shipment) { create(:shipment) }
|
|
let(:shipping_method) { build_stubbed(:shipping_method) }
|
|
let(:shipping_rate) {
|
|
Spree::ShippingRate.new(shipment:,
|
|
shipping_method:,
|
|
cost: 10.55)
|
|
}
|
|
|
|
context "#display_price" do
|
|
it "displays the shipping price" do
|
|
expect(shipping_rate.display_price.to_s).to eq "$10.55"
|
|
end
|
|
|
|
context "when the currency is JPY" do
|
|
let(:shipping_rate) {
|
|
shipping_rate = Spree::ShippingRate.new(cost: 205)
|
|
allow(shipping_rate).to receive_messages(currency: "JPY")
|
|
shipping_rate
|
|
}
|
|
|
|
it "displays the price in yen" do
|
|
expect(shipping_rate.display_price.to_s).to eq "¥205"
|
|
end
|
|
end
|
|
end
|
|
end
|