solidus_graphql_api 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (282) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +43 -67
  3. data/.github/dependabot.yml +23 -0
  4. data/.github/stale.yml +3 -3
  5. data/.github_changelog_generator +2 -0
  6. data/.rubocop.yml +10 -4
  7. data/CHANGELOG.md +4 -0
  8. data/CONTRIBUTING.md +5 -5
  9. data/Gemfile +1 -1
  10. data/Gemfile-local +1 -0
  11. data/LICENSE +1 -1
  12. data/OLD_CHANGELOG.md +170 -0
  13. data/README.md +26 -10
  14. data/Rakefile +22 -7
  15. data/app/assets/javascripts/spree/backend/solidus_graphql_api.js +2 -0
  16. data/app/assets/javascripts/spree/frontend/solidus_graphql_api.js +2 -0
  17. data/app/assets/stylesheets/spree/backend/solidus_graphql_api.css +4 -0
  18. data/app/assets/stylesheets/spree/frontend/solidus_graphql_api.css +4 -0
  19. data/app/controllers/spree/graphql_controller.rb +2 -0
  20. data/bin/console +2 -2
  21. data/bin/rails +0 -2
  22. data/bin/rails-engine +0 -3
  23. data/bin/rails-sandbox +1 -3
  24. data/bin/rake +0 -1
  25. data/bin/sandbox +5 -7
  26. data/docs/assets/images/graphiql-headers.png +0 -0
  27. data/docs/assets/images/graphiql-variables.png +0 -0
  28. data/docs/assets/images/graphiql.png +0 -0
  29. data/docs/assets/images/menu.png +0 -0
  30. data/docs/assets/images/navbar.png +0 -0
  31. data/docs/assets/style.css +1115 -0
  32. data/docs/assets/webfonts/2C4B9D_B_0.eot +0 -0
  33. data/docs/assets/webfonts/2C4B9D_B_0.ttf +0 -0
  34. data/docs/assets/webfonts/2C4B9D_B_0.woff +0 -0
  35. data/docs/assets/webfonts/2C4B9D_B_0.woff2 +0 -0
  36. data/docs/assets/webfonts/2C4B9D_C_0.eot +0 -0
  37. data/docs/assets/webfonts/2C4B9D_C_0.ttf +0 -0
  38. data/docs/assets/webfonts/2C4B9D_C_0.woff +0 -0
  39. data/docs/assets/webfonts/2C4B9D_C_0.woff2 +0 -0
  40. data/docs/assets/webfonts/2C4B9D_D_0.eot +0 -0
  41. data/docs/assets/webfonts/2C4B9D_D_0.ttf +0 -0
  42. data/docs/assets/webfonts/2C4B9D_D_0.woff +0 -0
  43. data/docs/assets/webfonts/2C4B9D_D_0.woff2 +0 -0
  44. data/docs/assets/webfonts/2C4B9D_E_0.eot +0 -0
  45. data/docs/assets/webfonts/2C4B9D_E_0.ttf +0 -0
  46. data/docs/assets/webfonts/2C4B9D_E_0.woff +0 -0
  47. data/docs/assets/webfonts/2C4B9D_E_0.woff2 +0 -0
  48. data/docs/directive/deprecated/index.html +1142 -0
  49. data/docs/directive/include/index.html +1141 -0
  50. data/docs/directive/index.html +1113 -0
  51. data/docs/directive/skip/index.html +1141 -0
  52. data/docs/enum/__directivelocation/index.html +1204 -0
  53. data/docs/enum/__typekind/index.html +1154 -0
  54. data/docs/enum/addresstypeinput/index.html +1121 -0
  55. data/docs/enum/index.html +1113 -0
  56. data/docs/index.html +1122 -0
  57. data/docs/input_object/addaddressestocheckoutinput/index.html +1135 -0
  58. data/docs/input_object/addpaymenttocheckoutinput/index.html +1135 -0
  59. data/docs/input_object/addressinput/index.html +1169 -0
  60. data/docs/input_object/addtocartinput/index.html +1130 -0
  61. data/docs/input_object/advancecheckoutinput/index.html +1120 -0
  62. data/docs/input_object/applycouponcodeinput/index.html +1125 -0
  63. data/docs/input_object/completecheckoutinput/index.html +1120 -0
  64. data/docs/input_object/createorderinput/index.html +1120 -0
  65. data/docs/input_object/emptycartinput/index.html +1120 -0
  66. data/docs/input_object/index.html +1113 -0
  67. data/docs/input_object/markdefaultshipaddressinput/index.html +1125 -0
  68. data/docs/input_object/nextcheckoutstateinput/index.html +1120 -0
  69. data/docs/input_object/productsqueryinput/index.html +1132 -0
  70. data/docs/input_object/removefromaddressbookinput/index.html +1125 -0
  71. data/docs/input_object/removefromcartinput/index.html +1125 -0
  72. data/docs/input_object/saveinaddressbookinput/index.html +1135 -0
  73. data/docs/input_object/selectshippingrateinput/index.html +1125 -0
  74. data/docs/input_object/setorderemailinput/index.html +1125 -0
  75. data/docs/input_object/updatecartquantityinput/index.html +1130 -0
  76. data/docs/interface/adjustment/index.html +1145 -0
  77. data/docs/interface/index.html +1113 -0
  78. data/docs/interface/node/index.html +1151 -0
  79. data/docs/interface/paymentsource/index.html +1134 -0
  80. data/docs/mutation/addaddressestocheckout/index.html +1137 -0
  81. data/docs/mutation/addpaymenttocheckout/index.html +1137 -0
  82. data/docs/mutation/addtocart/index.html +1137 -0
  83. data/docs/mutation/advancecheckout/index.html +1137 -0
  84. data/docs/mutation/applycouponcode/index.html +1137 -0
  85. data/docs/mutation/completecheckout/index.html +1137 -0
  86. data/docs/mutation/createorder/index.html +1137 -0
  87. data/docs/mutation/emptycart/index.html +1137 -0
  88. data/docs/mutation/markdefaultshipaddress/index.html +1132 -0
  89. data/docs/mutation/nextcheckoutstate/index.html +1137 -0
  90. data/docs/mutation/removefromaddressbook/index.html +1132 -0
  91. data/docs/mutation/removefromcart/index.html +1137 -0
  92. data/docs/mutation/saveinaddressbook/index.html +1137 -0
  93. data/docs/mutation/selectshippingrate/index.html +1137 -0
  94. data/docs/mutation/setorderemail/index.html +1137 -0
  95. data/docs/mutation/updatecartquantity/index.html +1137 -0
  96. data/docs/object/__directive/index.html +1182 -0
  97. data/docs/object/__enumvalue/index.html +1134 -0
  98. data/docs/object/__field/index.html +1164 -0
  99. data/docs/object/__inputvalue/index.html +1145 -0
  100. data/docs/object/__schema/index.html +1144 -0
  101. data/docs/object/__type/index.html +1220 -0
  102. data/docs/object/addaddressestocheckoutpayload/index.html +1130 -0
  103. data/docs/object/addpaymenttocheckoutpayload/index.html +1130 -0
  104. data/docs/object/address/index.html +1189 -0
  105. data/docs/object/addressconnection/index.html +1132 -0
  106. data/docs/object/addressedge/index.html +1126 -0
  107. data/docs/object/addtocartpayload/index.html +1130 -0
  108. data/docs/object/adjustmentconnection/index.html +1132 -0
  109. data/docs/object/adjustmentedge/index.html +1126 -0
  110. data/docs/object/advancecheckoutpayload/index.html +1130 -0
  111. data/docs/object/applycouponcodepayload/index.html +1130 -0
  112. data/docs/object/completecheckoutpayload/index.html +1130 -0
  113. data/docs/object/country/index.html +1218 -0
  114. data/docs/object/countryconnection/index.html +1132 -0
  115. data/docs/object/countryedge/index.html +1126 -0
  116. data/docs/object/createorderpayload/index.html +1130 -0
  117. data/docs/object/creditcard/index.html +1170 -0
  118. data/docs/object/currency/index.html +1144 -0
  119. data/docs/object/currencyconnection/index.html +1132 -0
  120. data/docs/object/currencyedge/index.html +1126 -0
  121. data/docs/object/emptycartpayload/index.html +1130 -0
  122. data/docs/object/image/index.html +1169 -0
  123. data/docs/object/imageconnection/index.html +1132 -0
  124. data/docs/object/imageedge/index.html +1126 -0
  125. data/docs/object/index.html +1113 -0
  126. data/docs/object/lineitem/index.html +1184 -0
  127. data/docs/object/lineitemconnection/index.html +1132 -0
  128. data/docs/object/lineitemedge/index.html +1126 -0
  129. data/docs/object/manifestitem/index.html +1124 -0
  130. data/docs/object/markdefaultshipaddresspayload/index.html +1125 -0
  131. data/docs/object/nextcheckoutstatepayload/index.html +1130 -0
  132. data/docs/object/optiontype/index.html +1203 -0
  133. data/docs/object/optiontypeconnection/index.html +1132 -0
  134. data/docs/object/optiontypeedge/index.html +1126 -0
  135. data/docs/object/optionvalue/index.html +1154 -0
  136. data/docs/object/optionvalueconnection/index.html +1132 -0
  137. data/docs/object/optionvalueedge/index.html +1126 -0
  138. data/docs/object/order/index.html +1412 -0
  139. data/docs/object/orderconnection/index.html +1132 -0
  140. data/docs/object/orderedge/index.html +1126 -0
  141. data/docs/object/pageinfo/index.html +1138 -0
  142. data/docs/object/payment/index.html +1149 -0
  143. data/docs/object/paymentmethod/index.html +1149 -0
  144. data/docs/object/price/index.html +1159 -0
  145. data/docs/object/priceconnection/index.html +1132 -0
  146. data/docs/object/priceedge/index.html +1126 -0
  147. data/docs/object/product/index.html +1327 -0
  148. data/docs/object/productconnection/index.html +1132 -0
  149. data/docs/object/productedge/index.html +1126 -0
  150. data/docs/object/productproperty/index.html +1149 -0
  151. data/docs/object/productpropertyconnection/index.html +1132 -0
  152. data/docs/object/productpropertyedge/index.html +1126 -0
  153. data/docs/object/promotionadjustment/index.html +1155 -0
  154. data/docs/object/property/index.html +1144 -0
  155. data/docs/object/removefromaddressbookpayload/index.html +1125 -0
  156. data/docs/object/removefromcartpayload/index.html +1130 -0
  157. data/docs/object/saveinaddressbookpayload/index.html +1130 -0
  158. data/docs/object/selectshippingratepayload/index.html +1130 -0
  159. data/docs/object/setorderemailpayload/index.html +1130 -0
  160. data/docs/object/shipment/index.html +1218 -0
  161. data/docs/object/shipmentconnection/index.html +1132 -0
  162. data/docs/object/shipmentedge/index.html +1126 -0
  163. data/docs/object/shippingmethod/index.html +1174 -0
  164. data/docs/object/shippingrate/index.html +1154 -0
  165. data/docs/object/shippingrateconnection/index.html +1132 -0
  166. data/docs/object/shippingrateedge/index.html +1126 -0
  167. data/docs/object/state/index.html +1144 -0
  168. data/docs/object/stateconnection/index.html +1132 -0
  169. data/docs/object/stateedge/index.html +1126 -0
  170. data/docs/object/store/index.html +1238 -0
  171. data/docs/object/taxadjustment/index.html +1150 -0
  172. data/docs/object/taxon/index.html +1228 -0
  173. data/docs/object/taxonconnection/index.html +1132 -0
  174. data/docs/object/taxonedge/index.html +1126 -0
  175. data/docs/object/taxonomy/index.html +1198 -0
  176. data/docs/object/taxonomyconnection/index.html +1132 -0
  177. data/docs/object/taxonomyedge/index.html +1126 -0
  178. data/docs/object/updatecartquantitypayload/index.html +1130 -0
  179. data/docs/object/user/index.html +1280 -0
  180. data/docs/object/usererror/index.html +1126 -0
  181. data/docs/object/variant/index.html +1332 -0
  182. data/docs/object/variantconnection/index.html +1132 -0
  183. data/docs/object/variantedge/index.html +1126 -0
  184. data/docs/object/walletpaymentsource/index.html +1144 -0
  185. data/docs/object/walletpaymentsourceconnection/index.html +1132 -0
  186. data/docs/object/walletpaymentsourceedge/index.html +1126 -0
  187. data/docs/operation/mutation/index.html +1114 -0
  188. data/docs/operation/query/index.html +1431 -0
  189. data/docs/scalar/boolean/index.html +1112 -0
  190. data/docs/scalar/float/index.html +1112 -0
  191. data/docs/scalar/id/index.html +1112 -0
  192. data/docs/scalar/index.html +1113 -0
  193. data/docs/scalar/int/index.html +1112 -0
  194. data/docs/scalar/iso8601datetime/index.html +1112 -0
  195. data/docs/scalar/json/index.html +1112 -0
  196. data/docs/scalar/string/index.html +1112 -0
  197. data/docs/union/index.html +1113 -0
  198. data/lib/generators/solidus_graphql_api/install/install_generator.rb +19 -0
  199. data/lib/generators/solidus_graphql_api/install/templates/initializer.rb +6 -0
  200. data/lib/graphql_docs/landing_pages/index.md +16 -0
  201. data/lib/solidus_graphql_api/batch_loader/has_many_through.rb +1 -0
  202. data/lib/solidus_graphql_api/batch_loader.rb +1 -1
  203. data/lib/solidus_graphql_api/configuration.rb +12 -8
  204. data/lib/solidus_graphql_api/context.rb +8 -2
  205. data/lib/solidus_graphql_api/engine.rb +2 -2
  206. data/lib/solidus_graphql_api/mutations/base_mutation.rb +3 -3
  207. data/lib/solidus_graphql_api/mutations/checkout/add_payment_to_checkout.rb +1 -1
  208. data/lib/solidus_graphql_api/mutations/user/{mark_default_address.rb → mark_default_ship_address.rb} +2 -2
  209. data/lib/solidus_graphql_api/mutations/user/save_in_address_book.rb +8 -2
  210. data/lib/solidus_graphql_api/queries/option_value/option_type_query.rb +19 -0
  211. data/lib/solidus_graphql_api/queries/shipping_rate/shipping_method_query.rb +19 -0
  212. data/lib/solidus_graphql_api/queries/taxon/children_query.rb +1 -1
  213. data/lib/solidus_graphql_api/queries/taxonomy/taxons_query.rb +1 -1
  214. data/lib/solidus_graphql_api/queries/variant/default_price_query.rb +1 -1
  215. data/lib/solidus_graphql_api/{factories → testing_support/factories}/address_factory.rb +1 -2
  216. data/lib/solidus_graphql_api/{factories → testing_support/factories}/taxonomy_factory.rb +10 -0
  217. data/lib/solidus_graphql_api/testing_support/factories.rb +9 -0
  218. data/lib/solidus_graphql_api/types/address.rb +1 -2
  219. data/lib/solidus_graphql_api/types/base/relay_node.rb +1 -1
  220. data/lib/solidus_graphql_api/types/input_objects/address_input.rb +1 -2
  221. data/lib/solidus_graphql_api/types/json.rb +6 -3
  222. data/lib/solidus_graphql_api/types/mutation.rb +1 -1
  223. data/lib/solidus_graphql_api/types/option_value.rb +5 -0
  224. data/lib/solidus_graphql_api/types/query.rb +2 -2
  225. data/lib/solidus_graphql_api/types/shipping_method.rb +20 -0
  226. data/lib/solidus_graphql_api/types/shipping_rate.rb +5 -0
  227. data/lib/solidus_graphql_api/types/user.rb +1 -1
  228. data/lib/solidus_graphql_api/version.rb +1 -1
  229. data/lib/solidus_graphql_api.rb +0 -3
  230. data/schema.graphql +128 -26
  231. data/solidus_graphql_api.gemspec +12 -12
  232. data/spec/integration/mutations/checkout/add_addresses_to_checkout_spec.rb +13 -19
  233. data/spec/integration/mutations/checkout/apply_coupon_code_spec.rb +3 -1
  234. data/spec/integration/mutations/{mark_default_address_spec.rb → mark_default_ship_address_spec.rb} +5 -5
  235. data/spec/integration/mutations/remove_from_address_book_spec.rb +4 -4
  236. data/spec/integration/mutations/save_in_address_book_spec.rb +25 -12
  237. data/spec/integration/queries/completed_orders_spec.rb +19 -15
  238. data/spec/integration/queries/countries_spec.rb +2 -2
  239. data/spec/integration/queries/current_order_spec.rb +4 -1
  240. data/spec/integration/queries/current_store_spec.rb +1 -1
  241. data/spec/integration/queries/current_user_spec.rb +7 -2
  242. data/spec/integration/queries/products_spec.rb +4 -1
  243. data/spec/integration/queries/taxonomies_spec.rb +12 -4
  244. data/spec/integration/types/json_spec.rb +17 -0
  245. data/spec/lib/solidus_graphql_api/batch_loader/belongs_to_spec.rb +24 -25
  246. data/spec/lib/solidus_graphql_api/batch_loader/has_many_spec.rb +17 -15
  247. data/spec/lib/solidus_graphql_api/batch_loader/has_many_through_spec.rb +42 -25
  248. data/spec/lib/solidus_graphql_api/batch_loader/has_one_spec.rb +17 -15
  249. data/spec/lib/solidus_graphql_api/context_spec.rb +119 -6
  250. data/spec/lib/solidus_graphql_api/queries/option_value/option_type_query_spec.rb +10 -0
  251. data/spec/lib/solidus_graphql_api/queries/shipping_rate/shipping_method_query_spec.rb +11 -0
  252. data/spec/lib/solidus_graphql_api/queries/taxon/children_query_spec.rb +9 -5
  253. data/spec/lib/solidus_graphql_api/queries/taxonomy/taxons_query_spec.rb +8 -5
  254. data/spec/lib/solidus_graphql_api/queries/variant/default_price_query_spec.rb +1 -1
  255. data/spec/lib/solidus_graphql_api/types/base/object_spec.rb +5 -1
  256. data/spec/lib/solidus_graphql_api/types/json_spec.rb +2 -1
  257. data/spec/lib/solidus_graphql_api/types/option_value_spec.rb +22 -0
  258. data/spec/lib/solidus_graphql_api/types/product_spec.rb +3 -1
  259. data/spec/lib/solidus_graphql_api/types/query_spec.rb +3 -1
  260. data/spec/lib/solidus_graphql_api/types/shipping_rate_spec.rb +22 -0
  261. data/spec/requests/spree/graphql_controller_spec.rb +15 -2
  262. data/spec/spec_helper.rb +20 -12
  263. data/spec/support/expected_schema.graphql +128 -26
  264. data/spec/support/graphql/mutations/add_addresses_to_checkout.gql +2 -2
  265. data/spec/support/graphql/mutations/mark_default_ship_address.gql +9 -0
  266. data/spec/support/graphql/mutations/remove_from_address_book.gql +1 -1
  267. data/spec/support/graphql/mutations/save_in_address_book.gql +6 -5
  268. data/spec/support/graphql/queries/completed_orders/billing_address.gql +1 -2
  269. data/spec/support/graphql/queries/completed_orders/shipping_address.gql +1 -2
  270. data/spec/support/graphql/queries/current_user.gql +6 -11
  271. data/spec/support/graphql/responses/completed_orders/billing_address.json.erb +2 -4
  272. data/spec/support/graphql/responses/completed_orders/shipping_address.json.erb +2 -4
  273. data/spec/support/graphql/responses/current_store.json.erb +1 -1
  274. data/spec/support/graphql/responses/current_user.json.erb +7 -13
  275. data/spec/support/graphql/responses/taxonomies.json.erb +7 -7
  276. data/spec/support/helpers/active_record.rb +18 -0
  277. data/spec/support/helpers/graphql.rb +4 -4
  278. metadata +245 -54
  279. data/lib/solidus_graphql_api/factories.rb +0 -11
  280. data/spec/support/graphql/mutations/mark_default_address.gql +0 -9
  281. /data/lib/solidus_graphql_api/{factories → testing_support/factories}/country_factory.rb +0 -0
  282. /data/lib/solidus_graphql_api/{factories → testing_support/factories}/store_factory.rb +0 -0
data/schema.graphql CHANGED
@@ -85,9 +85,8 @@ type Address implements Node {
85
85
  company: String
86
86
  country: Country!
87
87
  createdAt: ISO8601DateTime
88
- firstname: String!
89
88
  id: ID!
90
- lastname: String
89
+ name: String!
91
90
  phone: String!
92
91
  state: State
93
92
  stateName: String
@@ -140,14 +139,18 @@ input AddressInput {
140
139
  city: String!
141
140
  company: String
142
141
  countryId: ID!
143
- firstname: String!
144
- lastname: String
142
+ name: String!
145
143
  phone: String!
146
144
  stateId: ID
147
145
  stateName: String
148
146
  zipcode: String!
149
147
  }
150
148
 
149
+ enum AddressTypeInput {
150
+ billing
151
+ shipping
152
+ }
153
+
151
154
  """
152
155
  Adjustment.
153
156
  """
@@ -562,9 +565,9 @@ type ManifestItem {
562
565
  }
563
566
 
564
567
  """
565
- Autogenerated input type of MarkDefaultAddress
568
+ Autogenerated input type of MarkDefaultShipAddress
566
569
  """
567
- input MarkDefaultAddressInput {
570
+ input MarkDefaultShipAddressInput {
568
571
  addressId: ID!
569
572
 
570
573
  """
@@ -574,9 +577,9 @@ input MarkDefaultAddressInput {
574
577
  }
575
578
 
576
579
  """
577
- Autogenerated return type of MarkDefaultAddress
580
+ Autogenerated return type of MarkDefaultShipAddress
578
581
  """
579
- type MarkDefaultAddressPayload {
582
+ type MarkDefaultShipAddressPayload {
580
583
  """
581
584
  A unique identifier for the client performing the mutation.
582
585
  """
@@ -585,22 +588,102 @@ type MarkDefaultAddressPayload {
585
588
  }
586
589
 
587
590
  type Mutation {
588
- addAddressesToCheckout(input: AddAddressesToCheckoutInput!): AddAddressesToCheckoutPayload
589
- addPaymentToCheckout(input: AddPaymentToCheckoutInput!): AddPaymentToCheckoutPayload
590
- addToCart(input: AddToCartInput!): AddToCartPayload
591
- advanceCheckout(input: AdvanceCheckoutInput!): AdvanceCheckoutPayload
592
- applyCouponCode(input: ApplyCouponCodeInput!): ApplyCouponCodePayload
593
- completeCheckout(input: CompleteCheckoutInput!): CompleteCheckoutPayload
594
- createOrder(input: CreateOrderInput!): CreateOrderPayload
595
- emptyCart(input: EmptyCartInput!): EmptyCartPayload
596
- markDefaultAddress(input: MarkDefaultAddressInput!): MarkDefaultAddressPayload
597
- nextCheckoutState(input: NextCheckoutStateInput!): NextCheckoutStatePayload
598
- removeFromAddressBook(input: RemoveFromAddressBookInput!): RemoveFromAddressBookPayload
599
- removeFromCart(input: RemoveFromCartInput!): RemoveFromCartPayload
600
- saveInAddressBook(input: SaveInAddressBookInput!): SaveInAddressBookPayload
601
- selectShippingRate(input: SelectShippingRateInput!): SelectShippingRatePayload
602
- setOrderEmail(input: SetOrderEmailInput!): SetOrderEmailPayload
603
- updateCartQuantity(input: UpdateCartQuantityInput!): UpdateCartQuantityPayload
591
+ addAddressesToCheckout(
592
+ """
593
+ Parameters for AddAddressesToCheckout
594
+ """
595
+ input: AddAddressesToCheckoutInput!
596
+ ): AddAddressesToCheckoutPayload
597
+ addPaymentToCheckout(
598
+ """
599
+ Parameters for AddPaymentToCheckout
600
+ """
601
+ input: AddPaymentToCheckoutInput!
602
+ ): AddPaymentToCheckoutPayload
603
+ addToCart(
604
+ """
605
+ Parameters for AddToCart
606
+ """
607
+ input: AddToCartInput!
608
+ ): AddToCartPayload
609
+ advanceCheckout(
610
+ """
611
+ Parameters for AdvanceCheckout
612
+ """
613
+ input: AdvanceCheckoutInput!
614
+ ): AdvanceCheckoutPayload
615
+ applyCouponCode(
616
+ """
617
+ Parameters for ApplyCouponCode
618
+ """
619
+ input: ApplyCouponCodeInput!
620
+ ): ApplyCouponCodePayload
621
+ completeCheckout(
622
+ """
623
+ Parameters for CompleteCheckout
624
+ """
625
+ input: CompleteCheckoutInput!
626
+ ): CompleteCheckoutPayload
627
+ createOrder(
628
+ """
629
+ Parameters for CreateOrder
630
+ """
631
+ input: CreateOrderInput!
632
+ ): CreateOrderPayload
633
+ emptyCart(
634
+ """
635
+ Parameters for EmptyCart
636
+ """
637
+ input: EmptyCartInput!
638
+ ): EmptyCartPayload
639
+ markDefaultShipAddress(
640
+ """
641
+ Parameters for MarkDefaultShipAddress
642
+ """
643
+ input: MarkDefaultShipAddressInput!
644
+ ): MarkDefaultShipAddressPayload
645
+ nextCheckoutState(
646
+ """
647
+ Parameters for NextCheckoutState
648
+ """
649
+ input: NextCheckoutStateInput!
650
+ ): NextCheckoutStatePayload
651
+ removeFromAddressBook(
652
+ """
653
+ Parameters for RemoveFromAddressBook
654
+ """
655
+ input: RemoveFromAddressBookInput!
656
+ ): RemoveFromAddressBookPayload
657
+ removeFromCart(
658
+ """
659
+ Parameters for RemoveFromCart
660
+ """
661
+ input: RemoveFromCartInput!
662
+ ): RemoveFromCartPayload
663
+ saveInAddressBook(
664
+ """
665
+ Parameters for SaveInAddressBook
666
+ """
667
+ input: SaveInAddressBookInput!
668
+ ): SaveInAddressBookPayload
669
+ selectShippingRate(
670
+ """
671
+ Parameters for SelectShippingRate
672
+ """
673
+ input: SelectShippingRateInput!
674
+ ): SelectShippingRatePayload
675
+ setOrderEmail(
676
+ """
677
+ Parameters for SetOrderEmail
678
+ """
679
+ input: SetOrderEmailInput!
680
+ ): SetOrderEmailPayload
681
+ updateCartQuantity(
682
+ """
683
+ Parameters for UpdateCartQuantity
684
+ """
685
+ input: UpdateCartQuantityInput!
686
+ ): UpdateCartQuantityPayload
604
687
  }
605
688
 
606
689
  """
@@ -710,6 +793,7 @@ type OptionValue implements Node {
710
793
  createdAt: ISO8601DateTime
711
794
  id: ID!
712
795
  name: String!
796
+ optionType: OptionType!
713
797
  position: String!
714
798
  presentation: String!
715
799
  updatedAt: ISO8601DateTime
@@ -1387,6 +1471,7 @@ Autogenerated input type of SaveInAddressBook
1387
1471
  """
1388
1472
  input SaveInAddressBookInput {
1389
1473
  address: AddressInput!
1474
+ addressType: AddressTypeInput = shipping
1390
1475
 
1391
1476
  """
1392
1477
  A unique identifier for the client performing the mutation.
@@ -1524,6 +1609,23 @@ type ShipmentEdge {
1524
1609
  node: Shipment
1525
1610
  }
1526
1611
 
1612
+ """
1613
+ Shipping Method.
1614
+ """
1615
+ type ShippingMethod implements Node {
1616
+ adminName: String
1617
+ availableToAll: Boolean!
1618
+ availableToUsers: Boolean!
1619
+ carrier: String
1620
+ code: String
1621
+ createdAt: ISO8601DateTime
1622
+ id: ID!
1623
+ name: String!
1624
+ serviceLevel: String
1625
+ trackingUrl: String
1626
+ updatedAt: ISO8601DateTime
1627
+ }
1628
+
1527
1629
  """
1528
1630
  Shipping Rate.
1529
1631
  """
@@ -1533,6 +1635,7 @@ type ShippingRate implements Node {
1533
1635
  currency: String!
1534
1636
  id: ID!
1535
1637
  selected: Boolean!
1638
+ shippingMethod: ShippingMethod!
1536
1639
  updatedAt: ISO8601DateTime
1537
1640
  }
1538
1641
 
@@ -1861,7 +1964,6 @@ type User implements Node {
1861
1964
  billAddress: Address
1862
1965
  createdAt: ISO8601DateTime
1863
1966
  currentSignInAt: ISO8601DateTime
1864
- defaultAddress: Address
1865
1967
  email: String!
1866
1968
  id: ID!
1867
1969
  lastSignInAt: ISO8601DateTime
@@ -2067,4 +2169,4 @@ type WalletPaymentSourceEdge {
2067
2169
  The item at the end of the edge.
2068
2170
  """
2069
2171
  node: WalletPaymentSource
2070
- }
2172
+ }
@@ -10,14 +10,14 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = 'Solidus GraphQL API'
12
12
  spec.description = 'GraphQL comes to Solidus'
13
- spec.homepage = 'https://github.com/solidusio-contrib/solidus_graphql_api'
13
+ spec.homepage = 'https://github.com/solidusio/solidus_graphql_api'
14
14
  spec.license = 'BSD-3-Clause'
15
15
 
16
16
  spec.metadata['homepage_uri'] = spec.homepage
17
- spec.metadata['source_code_uri'] = 'https://github.com/solidusio-contrib/solidus_graphql_api'
18
- spec.metadata['changelog_uri'] = 'https://github.com/solidusio-contrib/solidus_graphql_api/blob/master/CHANGELOG.md'
17
+ spec.metadata['source_code_uri'] = 'https://github.com/solidusio/solidus_graphql_api'
18
+ spec.metadata['changelog_uri'] = 'https://github.com/solidusio/solidus_graphql_api/releases'
19
19
 
20
- spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
20
+ spec.required_ruby_version = Gem::Requirement.new('~> 3.0')
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -29,15 +29,15 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_dependency 'batch-loader', '>= 1.4.1', '< 1.6.0'
33
- spec.add_dependency 'graphql', '>= 1.10', '< 1.12'
34
- spec.add_dependency 'solidus_core', ['>= 2.5', '< 3']
35
- spec.add_dependency 'solidus_support', '~> 0.5'
32
+ spec.add_dependency 'batch-loader', '~> 2.0'
33
+ spec.add_dependency 'graphql', '>= 1.10', '< 1.13'
34
+ spec.add_dependency 'solidus_core', ['>= 3.2', '< 5']
35
+ spec.add_dependency 'solidus_support', '~> 0.6'
36
36
 
37
+ spec.add_development_dependency 'graphql-docs', '~> 2.0.1'
37
38
  spec.add_development_dependency 'graphql-schema_comparator', '~> 1.0.0'
38
- spec.add_development_dependency 'pry', '~> 0.13.1'
39
- spec.add_development_dependency 'simplecov', '~> 0.16.1'
40
- spec.add_development_dependency 'solidus_dev_support', '~> 1.5.0'
39
+ spec.add_development_dependency 'pry', '~> 0.14'
40
+ spec.add_development_dependency 'simplecov', '~> 0.21'
41
+ spec.add_development_dependency 'solidus_dev_support', '~> 2.4'
41
42
  spec.add_development_dependency 'timecop', '~> 0.9.1'
42
- spec.add_development_dependency 'with_model', '~> 2.1.2'
43
43
  end
@@ -13,19 +13,19 @@ RSpec.describe_mutation :add_addresses_to_checkout, mutation: :add_addresses_to_
13
13
  ]
14
14
  }
15
15
 
16
- let(:country_id) { SolidusGraphqlApi::Schema.id_from_object(create(:country), nil, nil) }
16
+ let(:country_id) { SolidusGraphqlApi::Schema.id_from_object(create(:country, states_required: false), nil, nil) }
17
17
  let(:address) {
18
18
  address = build_stubbed(:address).slice(:address1, :city, :phone, :zipcode)
19
19
  address[:countryId] = country_id
20
20
  address.transform_keys! { |key| key.camelize(:lower) }
21
21
  }
22
- let(:billing_address_firstname) { 'John' }
23
- let(:shipping_address_firstname) { 'Jane' }
22
+ let(:billing_address_name) { 'John Von Doe' }
23
+ let(:shipping_address_name) { 'Jane Von Doe' }
24
24
  let(:mutation_variables) {
25
25
  Hash[
26
26
  input: {
27
- billingAddress: address.merge(firstname: billing_address_firstname),
28
- shippingAddress: address.merge(firstname: shipping_address_firstname)
27
+ billingAddress: address.merge(name: billing_address_name),
28
+ shippingAddress: address.merge(name: shipping_address_name)
29
29
  }
30
30
  ].tap do |variables|
31
31
  variables[:input][:shipToBillingAddress] = ship_to_billing_address if defined?(ship_to_billing_address)
@@ -62,16 +62,10 @@ RSpec.describe_mutation :add_addresses_to_checkout, mutation: :add_addresses_to_
62
62
  let(:response_order) { subject[:data][:addAddressesToCheckout][:order] }
63
63
 
64
64
  context 'with wrong arguments' do
65
- let(:billing_address_firstname) { '' }
65
+ let(:billing_address_name) { '' }
66
66
 
67
67
  it { expect(response_order[:number]).to eq(current_order.number) }
68
-
69
- if Gem::Requirement.new('>= 2.11.0.alpha').satisfied_by?(Spree.solidus_gem_version)
70
- it { expect(user_errors.first[:path]).to eq(["input", "order", "billAddress", "name"]) }
71
- else
72
- it { expect(user_errors.first[:path]).to eq(["input", "order", "billAddress", "firstname"]) }
73
- end
74
-
68
+ it { expect(user_errors.first[:path]).to eq(["input", "order", "billAddress", "name"]) }
75
69
  it { expect(user_errors.first[:message]).to eq("can't be blank") }
76
70
  it { is_expected.to_not have_key(:errors) }
77
71
  end
@@ -83,8 +77,8 @@ RSpec.describe_mutation :add_addresses_to_checkout, mutation: :add_addresses_to_
83
77
 
84
78
  it { expect(response_order[:number]).to eq(current_order.number) }
85
79
  it { expect(response_order[:state]).to eq('address') }
86
- it { expect(response_order[:billingAddress][:firstname]).to eq(billing_address_firstname) }
87
- it { expect(response_order[:shippingAddress][:firstname]).to eq(billing_address_firstname) }
80
+ it { expect(response_order[:billingAddress][:name]).to eq(billing_address_name) }
81
+ it { expect(response_order[:shippingAddress][:name]).to eq(billing_address_name) }
88
82
  it { expect(user_errors).to be_empty }
89
83
  it { is_expected.to_not have_key(:errors) }
90
84
  end
@@ -94,8 +88,8 @@ RSpec.describe_mutation :add_addresses_to_checkout, mutation: :add_addresses_to_
94
88
 
95
89
  it { expect(response_order[:number]).to eq(current_order.number) }
96
90
  it { expect(response_order[:state]).to eq('address') }
97
- it { expect(response_order[:billingAddress][:firstname]).to eq(billing_address_firstname) }
98
- it { expect(response_order[:shippingAddress][:firstname]).to eq(shipping_address_firstname) }
91
+ it { expect(response_order[:billingAddress][:name]).to eq(billing_address_name) }
92
+ it { expect(response_order[:shippingAddress][:name]).to eq(shipping_address_name) }
99
93
  it { expect(user_errors).to be_empty }
100
94
  it { is_expected.to_not have_key(:errors) }
101
95
  end
@@ -103,8 +97,8 @@ RSpec.describe_mutation :add_addresses_to_checkout, mutation: :add_addresses_to_
103
97
  describe 'is not present' do
104
98
  it { expect(response_order[:number]).to eq(current_order.number) }
105
99
  it { expect(response_order[:state]).to eq('address') }
106
- it { expect(response_order[:billingAddress][:firstname]).to eq(billing_address_firstname) }
107
- it { expect(response_order[:shippingAddress][:firstname]).to eq(shipping_address_firstname) }
100
+ it { expect(response_order[:billingAddress][:name]).to eq(billing_address_name) }
101
+ it { expect(response_order[:shippingAddress][:name]).to eq(shipping_address_name) }
108
102
  it { expect(user_errors).to be_empty }
109
103
  it { is_expected.to_not have_key(:errors) }
110
104
  end
@@ -54,7 +54,9 @@ RSpec.describe_mutation :apply_coupon_code, mutation: :apply_coupon_code do
54
54
  context "and the given coupon code is applicable" do
55
55
  let(:flat_rate_discount) { 10.0 }
56
56
 
57
- before { create(:promotion, :with_line_item_adjustment, adjustment_rate: flat_rate_discount, code: coupon_code) }
57
+ before {
58
+ create(:promotion, :with_line_item_adjustment, adjustment_rate: flat_rate_discount, code: coupon_code)
59
+ }
58
60
 
59
61
  it { expect(response_order[:adjustmentTotal]).to eq((-flat_rate_discount).to_s) }
60
62
  it { expect(response_order[:number]).to eq(current_order.number) }
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe_mutation :mark_default_address, mutation: :mark_default_address do
5
+ RSpec.describe_mutation :mark_default_ship_address, mutation: :mark_default_ship_address do
6
6
  let(:mutation_context) { Hash[current_ability: Spree::Ability.new(current_user), current_user: current_user] }
7
7
  let(:mutation_variables) { Hash[input: { addressId: SolidusGraphqlApi::Schema.id_from_object(address, nil, nil) }] }
8
8
 
@@ -12,22 +12,22 @@ RSpec.describe_mutation :mark_default_address, mutation: :mark_default_address d
12
12
  context "when current user isn't present" do
13
13
  let(:current_user) { nil }
14
14
 
15
- it { expect(subject[:data][:markDefaultAddress]).to be_nil }
15
+ it { expect(subject[:data][:markDefaultShipAddress]).to be_nil }
16
16
  it { expect(subject[:errors].first[:message]).to eq I18n.t(:"unauthorized.default") }
17
17
  end
18
18
 
19
19
  context "when current user is present" do
20
20
  context "and the given address id is wrong" do
21
- it { expect(subject[:data][:markDefaultAddress]).to be_nil }
21
+ it { expect(subject[:data][:markDefaultShipAddress]).to be_nil }
22
22
  it { expect(subject[:errors].first[:message]).to eq I18n.t(:'activerecord.exceptions.not_found') }
23
23
  end
24
24
 
25
25
  context "and the given address id is correct" do
26
26
  before { current_user.addresses << address }
27
27
 
28
- let(:default_address) { subject[:data][:markDefaultAddress][:user][:defaultAddress] }
28
+ let(:ship_address) { subject[:data][:markDefaultShipAddress][:user][:shipAddress] }
29
29
 
30
- it { expect(default_address[:id]).to eq address.id }
30
+ it { expect(ship_address[:id]).to eq address.id }
31
31
  end
32
32
  end
33
33
  end
@@ -31,16 +31,16 @@ RSpec.describe_mutation :remove_from_address_book, mutation: :remove_from_addres
31
31
  it { expect(user_addresses.map{ |address| address[:id] }).to_not include(address.id) }
32
32
 
33
33
  describe 'default address' do
34
- let(:default_address) { subject[:data][:removeFromAddressBook][:user][:defaultAddress] }
34
+ let(:ship_address) { subject[:data][:removeFromAddressBook][:user][:shipAddress] }
35
35
 
36
36
  context "when address is the default" do
37
- before { current_user.mark_default_address(address.id) }
37
+ before { current_user.mark_default_ship_address(address.id) }
38
38
 
39
- it { expect(default_address).to be_nil }
39
+ it { expect(ship_address).to be_nil }
40
40
  end
41
41
 
42
42
  context "when address isn't the default" do
43
- it { expect(default_address[:id]).to_not eq address.id }
43
+ it { expect(ship_address[:id]).to_not eq address.id }
44
44
  end
45
45
  end
46
46
  end
@@ -4,11 +4,14 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe_mutation :save_in_address_book, mutation: :save_in_address_book do
6
6
  let(:default) { false }
7
+ let(:address_type) { "shipping" }
7
8
  let(:country_states_required) { false }
8
- let(:address) { create(:address, firstname: "Jane", country: create(:country, states_required: country_states_required)) }
9
+ let(:address) {
10
+ create(:address, name: "Jane Von Doe", country: create(:country, states_required: country_states_required))
11
+ }
9
12
  let(:address_attributes) {
10
13
  {
11
- firstname: address.firstname,
14
+ name: address.name,
12
15
  address1: address.address1,
13
16
  city: address.city,
14
17
  countryId: SolidusGraphqlApi::Schema.id_from_object(address.country, nil, nil),
@@ -21,7 +24,8 @@ RSpec.describe_mutation :save_in_address_book, mutation: :save_in_address_book d
21
24
  {
22
25
  input: {
23
26
  address: address_attributes,
24
- default: default
27
+ default: default,
28
+ addressType: address_type
25
29
  }
26
30
  }
27
31
  }
@@ -35,22 +39,31 @@ RSpec.describe_mutation :save_in_address_book, mutation: :save_in_address_book d
35
39
 
36
40
  context "when current user is present" do
37
41
  let(:current_user) { create(:user) }
38
- let(:default_address) { subject[:data][:saveInAddressBook][:user][:defaultAddress] }
42
+ let(:ship_address) { subject[:data][:saveInAddressBook][:user][:shipAddress] }
43
+ let(:bill_address) { subject[:data][:saveInAddressBook][:user][:billAddress] }
39
44
  let(:user_addresses) { subject[:data][:saveInAddressBook][:user][:addresses][:nodes] }
40
45
  let(:user_errors) { subject[:data][:saveInAddressBook][:errors] }
41
46
 
42
47
  context "when user doesn't have addresses" do
43
48
  context "and given attributes are correct" do
44
- it { expect(default_address[:firstname]).to eq(address[:firstname]) }
49
+ it { expect(ship_address[:name]).to eq(address[:name]) }
50
+ it { expect(bill_address).to be(nil) }
45
51
  it { expect(user_addresses.count).to eq 1 }
46
- it { expect(user_addresses.first[:firstname]).to eq(address[:firstname]) }
52
+ it { expect(user_addresses.first[:name]).to eq(address[:name]) }
47
53
  it { expect(user_errors).to be_empty }
54
+
55
+ context "when address_type is billing" do
56
+ let(:address_type) { "billing" }
57
+
58
+ it { expect(bill_address[:name]).to eq(address[:name]) }
59
+ it { expect(ship_address).to be(nil) }
60
+ end
48
61
  end
49
62
 
50
63
  context "and given attributes are incorrect" do
51
64
  let(:country_states_required) { true }
52
65
 
53
- it { expect(default_address).to be_nil }
66
+ it { expect(ship_address).to be_nil }
54
67
  it { expect(user_addresses.count).to eq 0 }
55
68
  it { expect(user_errors.first[:path]).to eq ["input", "address", "state"] }
56
69
  it { expect(user_errors.first[:message]).to eq "can't be blank" }
@@ -61,26 +74,26 @@ RSpec.describe_mutation :save_in_address_book, mutation: :save_in_address_book d
61
74
  let(:current_user) { create(:user_with_addresses) }
62
75
 
63
76
  context "and given attributes are correct" do
64
- it { expect(default_address).to_not be_nil }
77
+ it { expect(ship_address).to_not be_nil }
65
78
  it { expect(user_addresses.count).to eq 3 }
66
- it { expect(user_addresses.map{ |address| address[:firstname] }).to include(address[:firstname]) }
79
+ it { expect(user_addresses.map{ |address| address[:name] }).to include(address[:name]) }
67
80
  it { expect(user_errors).to be_empty }
68
81
 
69
82
  context 'when default false' do
70
- it { expect(default_address[:firstname]).to_not eq(address[:firstname]) }
83
+ it { expect(ship_address[:name]).to_not eq(address[:name]) }
71
84
  end
72
85
 
73
86
  context 'when default true' do
74
87
  let(:default) { true }
75
88
 
76
- it { expect(default_address[:firstname]).to eq(address[:firstname]) }
89
+ it { expect(ship_address[:name]).to eq(address[:name]) }
77
90
  end
78
91
  end
79
92
 
80
93
  context "and given attributes are incorrect" do
81
94
  let(:country_states_required) { true }
82
95
 
83
- it { expect(default_address).to_not be_nil }
96
+ it { expect(ship_address).to_not be_nil }
84
97
  it { expect(user_addresses.count).to eq 2 }
85
98
  it { expect(user_errors.first[:path]).to eq ["input", "address", "state"] }
86
99
  it { expect(user_errors.first[:message]).to eq "can't be blank" }
@@ -12,7 +12,7 @@ RSpec.describe_query :completed_orders do
12
12
  end
13
13
 
14
14
  context 'when there are some completed orders' do
15
- let(:order_1) do
15
+ let(:order1) do
16
16
  create(
17
17
  :completed_order_with_pending_payment,
18
18
  id: 1,
@@ -21,7 +21,7 @@ RSpec.describe_query :completed_orders do
21
21
  number: 'fake order number 1'
22
22
  )
23
23
  end
24
- let(:order_2) do
24
+ let(:order2) do
25
25
  create(
26
26
  :completed_order_with_pending_payment,
27
27
  id: 2,
@@ -30,7 +30,7 @@ RSpec.describe_query :completed_orders do
30
30
  number: 'fake order number 2'
31
31
  )
32
32
  end
33
- let!(:completed_orders) { [order_1, order_2] }
33
+ let!(:completed_orders) { [order1, order2] }
34
34
 
35
35
  it { is_expected.to match_response('completed_orders') }
36
36
  end
@@ -44,7 +44,7 @@ RSpec.describe_query :completed_orders do
44
44
  let(:ship_address_2_state) { create :state, id: 3, country: ship_address_2_country }
45
45
  let(:bill_address_2_country) { create :country, id: 4 }
46
46
  let(:bill_address_2_state) { create :state, id: 4, country: bill_address_2_country }
47
- let(:ship_address_1) do
47
+ let(:ship_address1) do
48
48
  create(
49
49
  :address,
50
50
  id: 1,
@@ -54,7 +54,7 @@ RSpec.describe_query :completed_orders do
54
54
  state: ship_address_1_state
55
55
  )
56
56
  end
57
- let(:bill_address_1) do
57
+ let(:bill_address1) do
58
58
  create(
59
59
  :address,
60
60
  id: 2,
@@ -64,7 +64,7 @@ RSpec.describe_query :completed_orders do
64
64
  state: bill_address_1_state
65
65
  )
66
66
  end
67
- let(:ship_address_2) do
67
+ let(:ship_address2) do
68
68
  create(
69
69
  :address,
70
70
  id: 3,
@@ -74,7 +74,7 @@ RSpec.describe_query :completed_orders do
74
74
  state: ship_address_2_state
75
75
  )
76
76
  end
77
- let(:bill_address_2) do
77
+ let(:bill_address2) do
78
78
  create(
79
79
  :address,
80
80
  id: 4,
@@ -84,25 +84,25 @@ RSpec.describe_query :completed_orders do
84
84
  state: bill_address_2_state
85
85
  )
86
86
  end
87
- let(:order_1) do
87
+ let(:order1) do
88
88
  create(
89
89
  :completed_order_with_pending_payment,
90
90
  id: 1,
91
91
  user: current_user,
92
- ship_address: ship_address_1,
93
- bill_address: bill_address_1
92
+ ship_address: ship_address1,
93
+ bill_address: bill_address1
94
94
  )
95
95
  end
96
- let(:order_2) do
96
+ let(:order2) do
97
97
  create(
98
98
  :completed_order_with_pending_payment,
99
99
  id: 2,
100
100
  user: current_user,
101
- ship_address: ship_address_2,
102
- bill_address: bill_address_2
101
+ ship_address: ship_address2,
102
+ bill_address: bill_address2
103
103
  )
104
104
  end
105
- let!(:completed_orders) { [order_1, order_2] }
105
+ let!(:completed_orders) { [order1, order2] }
106
106
 
107
107
  connection_field :shipping_address, query: 'completed_orders/shipping_address' do
108
108
  it { is_expected.to match_response('completed_orders/shipping_address') }
@@ -126,7 +126,11 @@ RSpec.describe_query :completed_orders do
126
126
  create :completed_order_with_pending_payment, id: 1, user: current_user
127
127
  end
128
128
 
129
- it { is_expected.to match_response('completed_orders/available_payment_methods').with_args(available_payment_methods: order.available_payment_methods) }
129
+ it {
130
+ expect(subject).
131
+ to match_response('completed_orders/available_payment_methods').
132
+ with_args(available_payment_methods: order.available_payment_methods)
133
+ }
130
134
  end
131
135
 
132
136
  connection_field :payments, query: 'completed_orders/payments' do
@@ -9,8 +9,8 @@ RSpec.describe_query :countries, query: :countries, freeze_date: true do
9
9
  end
10
10
 
11
11
  context 'when countries exists' do
12
- let!(:us_country) { create(:country, :with_states, id: 1) }
13
- let!(:it_country) { create(:country, id: 2, iso: 'IT') }
12
+ let!(:us_country) { create(:country, :with_states, id: 1, states_required: false) }
13
+ let!(:it_country) { create(:country, id: 2, iso: 'IT', states_required: false) }
14
14
 
15
15
  it { is_expected.to match_response(:countries) }
16
16
  end
@@ -10,6 +10,9 @@ RSpec.describe_query :currentOrder, query: :current_order, freeze_date: true do
10
10
  let(:variant_sku) { order.line_items.first.variant.sku }
11
11
 
12
12
  field :currentOrder do
13
- it { is_expected.to match_response(:current_order).with_args(shipment_number: shipment_number, variant_sku: variant_sku) }
13
+ it {
14
+ expect(subject).to match_response(:current_order).with_args(shipment_number: shipment_number,
15
+ variant_sku: variant_sku)
16
+ }
14
17
  end
15
18
  end
@@ -3,7 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  RSpec.describe_query :currentStore, query: :current_store, freeze_date: true do
6
- let!(:store) { create(:store, :with_defaults) }
6
+ let!(:store) { create(:store, :with_defaults, mail_from_address: 'solidus_graphql_api@example.org') }
7
7
 
8
8
  before { Spree::Config.available_currencies = ::Money::Currency.first(2) }
9
9