Sha256: 1eff47f6a616f1913eb16861703968a320028b7a2dc32b31b3ff30a08847964d

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

# This spec is useful for when we just want to make sure a view is rendering correctly
# Walking through the entire checkout process is rather tedious, don't you think?
describe Spree::CheckoutController, type: :controller do
  render_views
  let(:token) { 'some_token' }
  let(:user) { stub_model(Spree::LegacyUser) }

  before do
    allow(controller).to receive_messages try_spree_current_user: user
  end

  # Regression test for https://github.com/spree/spree/issues/3246
  context "when using GBP" do
    before do
      stub_spree_preferences(currency: "GBP")
    end

    context "when order is in delivery" do
      before do
        # Using a let block won't acknowledge the currency setting
        # Therefore we just do it like this...
        order = Spree::TestingSupport::OrderWalkthrough.up_to(:address)
        allow(controller).to receive_messages current_order: order
      end

      it "displays rate cost in correct currency" do
        get :edit
        html = Nokogiri::HTML(response.body)
        expect(html.css('.shipping-methods__rate').text.strip).to have_content("£10.00")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_starter_frontend-0.1.0 spec/controllers/spree/checkout_controller_with_views_spec.rb