Compare commits

...
2 changed files with 9 additions and 10 deletions
@@ -94,10 +94,8 @@ RSpec.describe Shopify::CallbacksController, type: :request do
context 'when state parameter is invalid' do
before do
controller = described_class.new
allow(controller).to receive(:verify_shopify_token).with(state).and_return(nil)
allow(controller).to receive(:account).and_return(nil)
allow(described_class).to receive(:new).and_return(controller)
allow_any_instance_of(Shopify::CallbacksController).to receive(:verify_shopify_token).and_return(nil)
allow_any_instance_of(Shopify::CallbacksController).to receive(:account).and_return(nil)
end
it 'redirects to the frontend URL with error' do
+7 -6
View File
@@ -81,14 +81,15 @@ RSpec.describe 'SwitchLocale Concern', type: :controller do
end
describe '#switch_locale_using_account_locale' do
before do
routes.draw { get 'account_locale' => 'anonymous#account_locale' }
end
it 'sets locale from account' do
controller.instance_variable_set(:@current_account, account)
get :account_locale
expect(response.body).to eq('es')
result = nil
controller.send(:switch_locale_using_account_locale) do
result = I18n.locale.to_s
end
expect(result).to eq('es')
end
end
end