Skip to content

Commit 76189f7

Browse files
Improve current store query specs (#56)
Improve current store query specs
2 parents 8098a01 + cee6242 commit 76189f7

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

spec/integration/current_store_spec.rb

+16-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@
22

33
require 'spec_helper'
44

5-
RSpec.describe "Current Store" do
6-
include_examples 'query is successful', :currentStore do
7-
let(:store) { create(:store) }
8-
let(:context) { Hash[current_store: store] }
5+
RSpec.describe_query :currentStore, query: :current_store, freeze_date: true do
6+
let!(:store) do
7+
create(:store,
8+
cart_tax_country_iso: 'US',
9+
code: 'spree',
10+
default_currency: 'USD',
11+
meta_description: 'store description',
12+
meta_keywords: 'store, metaKeywords',
13+
name: 'Spree Test Store',
14+
seo_title: 'Store Title',
15+
url: 'www.example.com')
16+
end
17+
18+
let(:query_context) { Hash[current_store: store] }
919

10-
it { expect(subject.data.currentStore).to_not be_nil }
20+
field :currentStore do
21+
it { is_expected.to match_response(:current_store) }
1122
end
1223
end

spec/support/queries/currentStore.gql renamed to spec/support/queries/current_store.gql

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ query {
33
cartTaxCountryIso
44
code
55
createdAt
6-
defaultCurrency
76
default
7+
defaultCurrency
88
mailFromAddress
99
metaDescription
1010
metaKeywords
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"data": {
3+
"currentStore": {
4+
"cartTaxCountryIso": "US",
5+
"code": "spree",
6+
"createdAt": "2012-12-21T12:00:00Z",
7+
"default": true,
8+
"defaultCurrency": "USD",
9+
"mailFromAddress": "spree@example.org",
10+
"metaDescription": "store description",
11+
"metaKeywords": "store, metaKeywords",
12+
"name": "Spree Test Store",
13+
"seoTitle": "Store Title",
14+
"updatedAt": "2012-12-21T12:00:00Z",
15+
"url": "www.example.com"
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)