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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Add spec for API stores controller
Przemek Kosakowski343273f1ae04
diff --git a/api/spec/requests/spree/api/v2/storefront/stores_controller_spec.rb b/api/spec/requests/spree/api/v2/storefront/stores_controller_spec.rbnew file mode 100644index 0000000000..5072ae8e33--- /dev/null+++ b/api/spec/requests/spree/api/v2/storefront/stores_controller_spec.rb@@ -0,0 +1,40 @@+require 'spec_helper'++describe 'Storefront API v2 Stores spec', type: :request do+ let!(:store) { create(:store) }++ describe 'stores#show' do+ context 'with code param' do+ before { get "/api/v2/storefront/stores/#{store.code}" }++ it 'return store with attributes' do+ expect(json_response['data']).to have_attribute(:name).with_value(store.name)+ expect(json_response['data']).to have_attribute(:url).with_value(store.url)+ expect(json_response['data']).to have_attribute(:meta_description).with_value(store.meta_description)+ expect(json_response['data']).to have_attribute(:meta_keywords).with_value(store.meta_keywords)+ expect(json_response['data']).to have_attribute(:seo_title).with_value(store.seo_title)+ expect(json_response['data']).to have_attribute(:default_currency).with_value(store.default_currency)+ expect(json_response['data']).to have_attribute(:default).with_value(store.default)+ expect(json_response['data']).to have_attribute(:supported_currencies).with_value(store.supported_currencies)+ expect(json_response['data']).to have_attribute(:facebook).with_value(store.facebook)+ expect(json_response['data']).to have_attribute(:twitter).with_value(store.twitter)+ expect(json_response['data']).to have_attribute(:instagram).with_value(store.instagram)+ expect(json_response['data']).to have_attribute(:default_locale).with_value(store.default_locale)+ expect(json_response['data']).to have_attribute(:customer_support_email).with_value(store.customer_support_email)+ expect(json_response['data']).to have_attribute(:default_country_id).with_value(store.default_country_id)+ expect(json_response['data']).to have_attribute(:description).with_value(store.description)+ expect(json_response['data']).to have_attribute(:address).with_value(store.address)+ expect(json_response['data']).to have_attribute(:contact_phone).with_value(store.contact_phone)+ expect(json_response['data']).to have_attribute(:contact_email).with_value(store.contact_email)+ end+ end++ context 'with invalid code param' do+ before { get '/api/v2/storefront/stores/XX' }++ it 'return error' do+ expect(json_response['error']).to eq('The resource you were looking for could not be found.')+ end+ end+ end+end