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.

Tests for Store Helper

Damian Legawiecf188158dbe02
diff --git a/frontend/spec/helpers/store_helper_spec.rb b/frontend/spec/helpers/store_helper_spec.rb
index 71c3aa5b11..7e62b7b91c 100644
--- a/frontend/spec/helpers/store_helper_spec.rb
+++ b/frontend/spec/helpers/store_helper_spec.rb
@@ -2,20 +2,40 @@ require 'spec_helper'
module Spree
describe StoreHelper, type: :helper do
+ let(:germany) { create(:country, name: 'Germany', iso: 'GR') }
+ let(:eu_store) { create(:store, default_currency: 'EUR', default_locale: 'de', default_country: germany) }
+
+ before do
+ I18n.backend.store_translations(:de,
+ spree: {
+ i18n: {
+ this_file_language: 'Deutsch (DE)'
+ }
+ })
+ end
+
describe '#stores' do
+ before { create_list(:store, 3) }
+ it { expect(stores.count).to eq(Spree::Store.count) }
+ it { expect(stores).to eq(Spree::Store.order(:id)) }
end
describe '#store_country_iso' do
+ let(:store_with_default_country) { build(:store, default_country: germany) }
+ it { expect(store_country_iso(eu_store)).to eq('gr') }
+ it { expect(store_country_iso(Spree::Store.default)).to be_nil }
end
describe '#store_currency_symbol' do
-
+ it { expect(store_currency_symbol(Spree::Store.default)).to eq('$') }
+ it { expect(store_currency_symbol(eu_store)).to eq('€') }
end
describe '#store_locale_name' do
-
+ it { expect(store_locale_name(Spree::Store.default)).to eq('English (US)') }
+ it { expect(store_locale_name(eu_store)).to eq('Deutsch (DE)') }
end
end
end