Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Adds specs for currency settings

Robert Nowakowski347b0179e76c
diff --git a/backend/spec/features/admin/general_settings/prices_settings_updating_spec.rb b/backend/spec/features/admin/general_settings/prices_settings_updating_spec.rb
index 4ce756d381..da30eaef2f 100644
--- a/backend/spec/features/admin/general_settings/prices_settings_updating_spec.rb
+++ b/backend/spec/features/admin/general_settings/prices_settings_updating_spec.rb
@@ -4,28 +4,54 @@ describe 'Updating currencies settings', type: :feature, js: true do
let!(:store) { create(:store, default: true) }
stub_authorization!
- before do
- reset_spree_preferences do |config|
- config.allow_currency_change = false
- config.show_currency_selector = false
+ describe 'enabling currency settings' do
+ before do
+ reset_spree_preferences do |config|
+ config.allow_currency_change = false
+ config.show_currency_selector = false
+ end
+ end
+
+ it 'allows to enable currency settings' do
+ visit spree.edit_admin_general_settings_path
+
+ # Test initial state
+ expect(page).to have_unchecked_field('allow_currency_change')
+ expect(page).to have_unchecked_field('show_currency_selector')
+
+ # Interact with the form
+ check('allow_currency_change')
+ check('show_currency_selector')
+ click_button 'Update'
+
+ # Test final state
+ expect(page).to have_content 'General Settings has been successfully updated!'
+ expect(page).to have_checked_field('allow_currency_change')
+ expect(page).to have_checked_field('show_currency_selector')
end
end
- it 'allows to update supported currencies' do
- visit spree.edit_admin_general_settings_path
+ describe 'disabling currency settings' do
+ before do
+ reset_spree_preferences do |config|
+ config.allow_currency_change = true
+ config.show_currency_selector = true
+ end
+ end
+
+ it 'allows to disable currency settings' do
+ visit spree.edit_admin_general_settings_path
- # Test initial state
- expect(page).to have_unchecked_field('allow_currency_change')
- expect(page).to have_unchecked_field('show_currency_selector')
+ expect(page).to have_checked_field('allow_currency_change')
+ expect(page).to have_checked_field('show_currency_selector')
- # Interact with the form
- check('allow_currency_change')
- check('show_currency_selector')
- click_button 'Update'
+ uncheck('allow_currency_change')
+ uncheck('show_currency_selector')
+ click_button 'Update'
- # Test final state
- expect(page).to have_content 'General Settings has been successfully updated!'
- expect(page).to have_checked_field('allow_currency_change')
- expect(page).to have_checked_field('show_currency_selector')
+ expect(page).to have_content 'General Settings has been successfully updated!'
+ expect(page).to have_unchecked_field('allow_currency_change')
+ expect(page).to have_unchecked_field('show_currency_selector')
+ end
end
end