Browse Source

Merge pull request #791 from Shopify/fix_rubocop_conflicts_pre2

Autofix rubocop conflicts
Kevin O'Sullivan 4 years ago
parent
commit
6e5eb7f5c8
79 changed files with 646 additions and 670 deletions
  1. 3 27
      .rubocop_todo.yml
  2. 3 3
      Rakefile
  3. 6 6
      lib/active_resource/detailed_log_subscriber.rb
  4. 1 1
      lib/shopify_api.rb
  5. 2 2
      lib/shopify_api/disable_prefix_check.rb
  6. 1 1
      lib/shopify_api/events.rb
  7. 4 4
      lib/shopify_api/metafields.rb
  8. 1 1
      lib/shopify_api/resources/article.rb
  9. 1 1
      lib/shopify_api/resources/asset.rb
  10. 3 3
      lib/shopify_api/resources/base.rb
  11. 1 1
      lib/shopify_api/resources/blog.rb
  12. 3 3
      lib/shopify_api/resources/custom_collection.rb
  13. 1 1
      lib/shopify_api/resources/customer_saved_search.rb
  14. 1 1
      lib/shopify_api/resources/discount_code_batch.rb
  15. 1 1
      lib/shopify_api/resources/order.rb
  16. 2 2
      lib/shopify_api/resources/product.rb
  17. 1 1
      lib/shopify_api/resources/refund.rb
  18. 1 1
      lib/shopify_api/resources/shop.rb
  19. 1 1
      shopify_api.gemspec
  20. 4 4
      test/access_token_test.rb
  21. 3 3
      test/active_resource/json_errors_test.rb
  22. 22 22
      test/application_charge_test.rb
  23. 9 9
      test/application_credit_test.rb
  24. 33 33
      test/article_test.rb
  25. 5 5
      test/asset_test.rb
  26. 10 10
      test/base_test.rb
  27. 2 2
      test/blog_test.rb
  28. 3 3
      test/carrier_service_test.rb
  29. 2 2
      test/collect_test.rb
  30. 15 15
      test/collection_listing_test.rb
  31. 8 8
      test/collection_publication_test.rb
  32. 2 2
      test/countable_test.rb
  33. 1 1
      test/currency_test.rb
  34. 2 2
      test/custom_collection_test.rb
  35. 8 8
      test/customer_saved_search_test.rb
  36. 3 3
      test/customer_test.rb
  37. 5 5
      test/detailed_log_subscriber_test.rb
  38. 10 10
      test/discount_code_batch_test.rb
  39. 14 14
      test/discount_code_test.rb
  40. 48 48
      test/draft_order_test.rb
  41. 18 18
      test/fulfillment_event_test.rb
  42. 33 33
      test/fulfillment_order_test.rb
  43. 1 1
      test/fulfillment_request_test.rb
  44. 3 3
      test/fulfillment_service_test.rb
  45. 12 12
      test/fulfillment_test.rb
  46. 2 2
      test/fulfillment_v2_test.rb
  47. 4 4
      test/gift_card_test.rb
  48. 1 1
      test/graphql_test.rb
  49. 16 16
      test/image_test.rb
  50. 1 1
      test/inventory_level_test.rb
  51. 18 18
      test/marketing_event_test.rb
  52. 5 5
      test/message_enricher_test.rb
  53. 17 17
      test/metafield_test.rb
  54. 16 16
      test/order_risk_test.rb
  55. 12 12
      test/order_test.rb
  56. 17 17
      test/pagination_test.rb
  57. 5 5
      test/policy_test.rb
  58. 14 14
      test/price_rule_test.rb
  59. 19 19
      test/product_listing_test.rb
  60. 8 8
      test/product_publication_test.rb
  61. 22 22
      test/product_test.rb
  62. 3 3
      test/publication_test.rb
  63. 41 41
      test/recurring_application_charge_test.rb
  64. 2 2
      test/redirect_test.rb
  65. 12 12
      test/refund_test.rb
  66. 11 11
      test/resource_feedback_test.rb
  67. 5 5
      test/script_tag_test.rb
  68. 6 6
      test/session_test.rb
  69. 1 1
      test/shipping_zone_test.rb
  70. 31 31
      test/shop_test.rb
  71. 3 3
      test/smart_collection_test.rb
  72. 12 12
      test/storefront_access_token_test.rb
  73. 2 2
      test/tax_service_test.rb
  74. 1 1
      test/tender_transaction_test.rb
  75. 4 4
      test/test_helper.rb
  76. 2 2
      test/transaction_test.rb
  77. 4 4
      test/usage_charge_test.rb
  78. 13 13
      test/variant_test.rb
  79. 3 3
      test/webhook_test.rb

+ 3 - 27
.rubocop_todo.yml

@@ -1,6 +1,6 @@
 # This configuration was generated by
 # `rubocop --auto-gen-config`
-# on 2020-10-15 13:52:14 UTC using RuboCop version 0.93.1.
+# on 2020-10-15 14:08:35 UTC using RuboCop version 0.93.1.
 # The point is for the user to remove these configuration records
 # one by one as the offenses are removed from the code base.
 # Note that changes in the inspected code, or installation of new
@@ -138,16 +138,14 @@ Layout/SpaceAfterComma:
     - 'test/recurring_application_charge_test.rb'
     - 'test/session_test.rb'
 
-# Offense count: 9
+# Offense count: 6
 # Cop supports --auto-correct.
 # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
 # SupportedStylesForExponentOperator: space, no_space
 Layout/SpaceAroundOperators:
   Exclude:
     - 'lib/shopify_api/resources/product.rb'
-    - 'test/asset_test.rb'
     - 'test/pagination_test.rb'
-    - 'test/shop_test.rb'
     - 'test/test_helper.rb'
 
 # Offense count: 4
@@ -166,14 +164,6 @@ Layout/SpaceInsideArrayLiteralBrackets:
   Exclude:
     - 'test/resource_feedback_test.rb'
 
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
-# SupportedStyles: space, no_space
-# SupportedStylesForEmptyBraces: space, no_space
-Layout/SpaceInsideBlockBraces:
-  EnforcedStyle: space
-
 # Offense count: 1
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
@@ -234,26 +224,12 @@ Style/CommandLiteral:
 Style/FrozenStringLiteralComment:
   Enabled: false
 
-# Offense count: 497
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
-# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
-Style/HashSyntax:
-  Enabled: false
-
 # Offense count: 1
 # Configuration parameters: AllowIfModifier.
 Style/IfInsideElse:
   Exclude:
     - 'lib/shopify_api/graphql.rb'
 
-# Offense count: 479
-# Cop supports --auto-correct.
-# Configuration parameters: IgnoreMacros, IgnoredMethods, IgnoredPatterns, IncludedMacros, AllowParenthesesInMultilineCall, AllowParenthesesInChaining, AllowParenthesesInCamelCaseMethod, EnforcedStyle.
-# SupportedStyles: require_parentheses, omit_parentheses
-Style/MethodCallWithArgsParentheses:
-  Enabled: false
-
 # Offense count: 1
 Style/MissingRespondToMissing:
   Exclude:
@@ -364,7 +340,7 @@ Style/TrivialAccessors:
   Exclude:
     - 'lib/shopify_api/graphql.rb'
 
-# Offense count: 83
+# Offense count: 86
 # Cop supports --auto-correct.
 # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
 # URISchemes: http, https

+ 3 - 3
Rakefile

@@ -19,12 +19,12 @@ begin
     test.verbose = true
   end
 rescue LoadError
-  task :rcov do
-    abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
+  task(:rcov) do
+    abort("RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov")
   end
 end
 
-task :default => [:test, :rubocop, :verify_docs]
+task default: [:test, :rubocop, :verify_docs]
 
 require 'verify_docs'
 task :verify_docs do

+ 6 - 6
lib/active_resource/detailed_log_subscriber.rb

@@ -18,9 +18,9 @@ module ActiveResource
       headers = data.extract_options!
       request_body = data.first
 
-      info "Request:\n#{request_body}" if request_body
-      info "Headers: #{headers.inspect}"
-      info "Response:\n#{event.payload[:response].body}"
+      info("Request:\n#{request_body}") if request_body
+      info("Headers: #{headers.inspect}")
+      info("Response:\n#{event.payload[:response].body}")
     end
 
     def warn_on_deprecated_header_or_version_eol_header(event)
@@ -34,7 +34,7 @@ module ActiveResource
           use of a deprecated endpoint, behaviour, or parameter. See #{header_value} for more details.
           MSG
 
-          warn warning_message
+          warn(warning_message)
 
         when VERSION_EOL_WARNING_HEADER
           warning_message = <<-MSG
@@ -42,11 +42,11 @@ module ActiveResource
           an API version that is unsupported or will become unsupported within 30 days. See #{header_value} for more details.
           MSG
 
-          warn warning_message
+          warn(warning_message)
         end
       end
     end
   end
 end
 
-ActiveResource::DetailedLogSubscriber.attach_to :active_resource_detailed
+ActiveResource::DetailedLogSubscriber.attach_to(:active_resource_detailed)

+ 1 - 1
lib/shopify_api.rb

@@ -1,4 +1,4 @@
-$:.unshift File.dirname(__FILE__)
+$:.unshift(File.dirname(__FILE__))
 require 'active_resource'
 require 'active_support/core_ext/class/attribute_accessors'
 require 'digest/md5'

+ 2 - 2
lib/shopify_api/disable_prefix_check.rb

@@ -14,13 +14,13 @@ module ShopifyAPI
 
         init_prefix_explicit(resource_type, resource_id)
 
-        define_singleton_method :resource_prefix do |options = {}|
+        define_singleton_method(:resource_prefix) do |options = {}|
           resource_type = options[resource] if flexible
 
           options[resource_id].nil? ? '' : "#{resource_type}/#{options[resource_id]}/"
         end
 
-        define_singleton_method :instantiate_record do |record, prefix_options = {}|
+        define_singleton_method(:instantiate_record) do |record, prefix_options = {}|
           new(record, true).tap do |resource_instance|
             resource_instance.prefix_options = prefix_options unless prefix_options.blank?
           end

+ 1 - 1
lib/shopify_api/events.rb

@@ -1,7 +1,7 @@
 module ShopifyAPI
   module Events
     def events
-      Event.find(:all, :params => { :resource => self.class.collection_name, :resource_id => id })
+      Event.find(:all, params: { resource: self.class.collection_name, resource_id: id })
     end
   end
 end

+ 4 - 4
lib/shopify_api/metafields.rb

@@ -1,17 +1,17 @@
 module ShopifyAPI
   module Metafields
     def metafields(**options)
-      options.merge! resource: self.class.collection_name, resource_id: id
+      options.merge!(resource: self.class.collection_name, resource_id: id)
 
-      Metafield.find :all, params: options
+      Metafield.find(:all, params: options)
     end
 
     def add_metafield(metafield)
       raise ArgumentError, "You can only add metafields to resource that has been saved" if new?
 
       metafield.prefix_options = {
-        :resource => self.class.collection_name,
-        :resource_id => id
+        resource: self.class.collection_name,
+        resource_id: id
       }
       metafield.save
       metafield

+ 1 - 1
lib/shopify_api/resources/article.rb

@@ -7,7 +7,7 @@ module ShopifyAPI
     conditional_prefix :blog
 
     def comments
-      Comment.find(:all, :params => { :article_id => id })
+      Comment.find(:all, params: { article_id: id })
     end
 
     def self.authors(options = {})

+ 1 - 1
lib/shopify_api/resources/asset.rb

@@ -75,7 +75,7 @@ module ShopifyAPI
     end
 
     def destroy
-      connection.delete(element_path(prefix_options.merge(:asset => { :key => key })), self.class.headers)
+      connection.delete(element_path(prefix_options.merge(asset: { key: key })), self.class.headers)
     end
 
     def new?

+ 3 - 3
lib/shopify_api/resources/base.rb

@@ -91,7 +91,7 @@ module ShopifyAPI
 
         silence_warnings do
           # Redefine the new methods.
-          instance_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
+          instance_eval(<<-RUBY_EVAL, __FILE__, __LINE__ + 1)
             def prefix_source() "#{value}" end
             def resource_prefix(options={}) "#{resource_prefix_call}" end
           RUBY_EVAL
@@ -122,7 +122,7 @@ module ShopifyAPI
       def init_prefix_explicit(resource_type, resource_id)
         self.resource_prefix = "#{resource_type}/:#{resource_id}/"
 
-        define_method resource_id.to_sym do
+        define_method(resource_id.to_sym) do
           @prefix_options[resource_id]
         end
       end
@@ -155,7 +155,7 @@ module ShopifyAPI
     private
 
     def only_id
-      encode(:only => :id, :include => [], :methods => [])
+      encode(only: :id, include: [], methods: [])
     end
   end
 end

+ 1 - 1
lib/shopify_api/resources/blog.rb

@@ -4,7 +4,7 @@ module ShopifyAPI
     include Metafields
 
     def articles
-      Article.find(:all, :params => { :blog_id => id })
+      Article.find(:all, params: { blog_id: id })
     end
   end
 end

+ 3 - 3
lib/shopify_api/resources/custom_collection.rb

@@ -4,15 +4,15 @@ module ShopifyAPI
     include Metafields
 
     def products
-      Product.find(:all, :params => { :collection_id => self.id })
+      Product.find(:all, params: { collection_id: self.id })
     end
 
     def add_product(product)
-      Collect.create(:collection_id => self.id, :product_id => product.id)
+      Collect.create(collection_id: self.id, product_id: product.id)
     end
 
     def remove_product(product)
-      collect = Collect.find(:first, :params => { :collection_id => self.id, :product_id => product.id })
+      collect = Collect.find(:first, params: { collection_id: self.id, product_id: product.id })
       collect.destroy if collect
     end
   end

+ 1 - 1
lib/shopify_api/resources/customer_saved_search.rb

@@ -5,7 +5,7 @@ module ShopifyAPI
     early_july_pagination_release!
 
     def customers(params = {})
-      Customer.search(params.merge({ :customer_saved_search_id => self.id }))
+      Customer.search(params.merge({ customer_saved_search_id: self.id }))
     end
   end
 end

+ 1 - 1
lib/shopify_api/resources/discount_code_batch.rb

@@ -13,7 +13,7 @@ module ShopifyAPI
       @discount_codes ||= begin
         if id
           path = self.class.api_version.construct_api_path("price_rules/#{price_rule_id}/batch/#{id}/discount_codes.json")
-          discount_codes = ShopifyAPI::DiscountCode.find :all, from: path
+          discount_codes = ShopifyAPI::DiscountCode.find(:all, from: path)
           discount_codes.each do |code|
             errors = code.attributes['errors']
             errors.attributes.each do |key, values|

+ 1 - 1
lib/shopify_api/resources/order.rb

@@ -16,7 +16,7 @@ module ShopifyAPI
     end
 
     def transactions
-      Transaction.find(:all, :params => { :order_id => id })
+      Transaction.find(:all, params: { order_id: id })
     end
 
     def capture(amount = "", currency: nil)

+ 2 - 2
lib/shopify_api/resources/product.rb

@@ -27,11 +27,11 @@ module ShopifyAPI
     end
 
     def collections
-      CustomCollection.find(:all, :params => { :product_id => self.id })
+      CustomCollection.find(:all, params: { product_id: self.id })
     end
 
     def smart_collections
-      SmartCollection.find(:all, :params => { :product_id => self.id })
+      SmartCollection.find(:all, params: { product_id: self.id })
     end
 
     def add_to_collection(collection)

+ 1 - 1
lib/shopify_api/resources/refund.rb

@@ -3,7 +3,7 @@ module ShopifyAPI
     init_prefix :order
 
     def self.calculate(*args)
-      options = { :refund => args[0] }
+      options = { refund: args[0] }
       params = {}
       params = args[1][:params] if args[1] && args[1][:params]
 

+ 1 - 1
lib/shopify_api/resources/shop.rb

@@ -9,7 +9,7 @@ module ShopifyAPI
     end
 
     def metafields(**options)
-      Metafield.find :all, params: options
+      Metafield.find(:all, params: options)
     end
 
     def add_metafield(metafield)

+ 1 - 1
shopify_api.gemspec

@@ -1,4 +1,4 @@
-$:.push File.expand_path("../lib", __FILE__)
+$:.push(File.expand_path("../lib", __FILE__))
 require "shopify_api/version"
 
 Gem::Specification.new do |s|

+ 4 - 4
test/access_token_test.rb

@@ -3,17 +3,17 @@ require 'test_helper'
 class AccessTokenTest < Test::Unit::TestCase
 
   def test_delegate_access_token
-    fake "access_tokens/delegate.json?delegate_access_scope%5B%5D=write_orders&" \
+    fake("access_tokens/delegate.json?delegate_access_scope%5B%5D=write_orders&" \
       "delegate_access_scope%5B%5D=read_products&expires_in=",
       method: :post,
       status: 201,
       body: load_fixture('access_token_delegate'),
-      extension: false
+      extension: false)
 
     delegate_scope = ['write_orders', 'read_products']
     token = ShopifyAPI::AccessToken.delegate(delegate_scope)
 
-    assert_equal 'abracadabra', token.access_token
-    assert_equal 'write_orders,read_products', token.scope
+    assert_equal('abracadabra', token.access_token)
+    assert_equal('write_orders,read_products', token.scope)
   end
 end

+ 3 - 3
test/active_resource/json_errors_test.rb

@@ -6,14 +6,14 @@ module ActiveResource
     def test_parsing_of_error_json_hash
       @model = ShopifyAPI::Order.new
       @model.errors.from_json({ errors: { name: ['missing'] } }.to_json)
-      assert_equal ['missing'], @model.errors[:name]
+      assert_equal(['missing'], @model.errors[:name])
     end
 
     def test_parsing_of_error_json_plain_string
       @model = ShopifyAPI::Order.new
       @model.errors.from_json({ errors: 'some generic error' }.to_json)
-      assert_equal ['some generic error'], @model.errors[:base]
-      assert_equal 'some generic error', @model.errors.full_messages.to_sentence
+      assert_equal(['some generic error'], @model.errors[:base])
+      assert_equal('some generic error', @model.errors.full_messages.to_sentence)
     end
   end
 end

+ 22 - 22
test/application_charge_test.rb

@@ -3,7 +3,7 @@ require 'test_helper'
 class ApplicationChargeTest < Test::Unit::TestCase
 
   def test_application_charge_create
-    fake "application_charges", :method => :post, :status => 201, :body => load_fixture('application_charge')
+    fake("application_charges", method: :post, status: 201, body: load_fixture('application_charge'))
 
     charge = ShopifyAPI::ApplicationCharge.create(
         name: "iPod Cleaning",
@@ -11,69 +11,69 @@ class ApplicationChargeTest < Test::Unit::TestCase
         return_url: "http://google.com"
     )
 
-    assert_equal 'https://this-is-my-test-shop.myshopify.com/admin/charges/803742/confirm_application_charge?signature=BAhpA55DDA%3D%3D--55b44e274e438c619be4631c804abcbcb6ee915a', charge.confirmation_url
+    assert_equal('https://this-is-my-test-shop.myshopify.com/admin/charges/803742/confirm_application_charge?signature=BAhpA55DDA%3D%3D--55b44e274e438c619be4631c804abcbcb6ee915a', charge.confirmation_url)
   end
 
   def test_get_application_charge
-    fake "application_charges/803742", :method => :get, :status => 201, :body => load_fixture('application_charge')
+    fake("application_charges/803742", method: :get, status: 201, body: load_fixture('application_charge'))
 
     charge = ShopifyAPI::ApplicationCharge.find(803742)
 
-    assert_equal "iPod Cleaning", charge.name
+    assert_equal("iPod Cleaning", charge.name)
   end
 
   def test_list_application_charges
-    fake "application_charges", :method => :get, :status => 201, :body => load_fixture('application_charges')
+    fake("application_charges", method: :get, status: 201, body: load_fixture('application_charges'))
 
     charges = ShopifyAPI::ApplicationCharge.find(:all)
 
-    assert_equal 4, charges.size
-    assert_equal "iPhone Case", charges.last.name
+    assert_equal(4, charges.size)
+    assert_equal("iPhone Case", charges.last.name)
   end
 
   def test_list_pending_application_charges
-    fake "application_charges", :method => :get, :status => 201, :body => load_fixture('application_charges')
+    fake("application_charges", method: :get, status: 201, body: load_fixture('application_charges'))
 
     pending_charges = ShopifyAPI::ApplicationCharge.pending
 
-    assert_equal 1, pending_charges.size
-    assert_equal "Screen Replacement", pending_charges.first.name
+    assert_equal(1, pending_charges.size)
+    assert_equal("Screen Replacement", pending_charges.first.name)
   end
 
   def test_list_expired_application_charges
-    fake "application_charges", :method => :get, :status => 201, :body => load_fixture('application_charges')
+    fake("application_charges", method: :get, status: 201, body: load_fixture('application_charges'))
 
     expired_charges = ShopifyAPI::ApplicationCharge.expired
 
-    assert_equal 1, expired_charges.size
-    assert_equal "iPod Cleaning", expired_charges.first.name
+    assert_equal(1, expired_charges.size)
+    assert_equal("iPod Cleaning", expired_charges.first.name)
   end
 
   def test_list_accepted_application_charges
-    fake "application_charges", :method => :get, :status => 201, :body => load_fixture('application_charges')
+    fake("application_charges", method: :get, status: 201, body: load_fixture('application_charges'))
 
     accepted_charges = ShopifyAPI::ApplicationCharge.accepted
 
-    assert_equal 1, accepted_charges.size
-    assert_equal "iPhone Case", accepted_charges.first.name
+    assert_equal(1, accepted_charges.size)
+    assert_equal("iPhone Case", accepted_charges.first.name)
   end
 
   def test_list_declined_application_charges
-    fake "application_charges", :method => :get, :status => 201, :body => load_fixture('application_charges')
+    fake("application_charges", method: :get, status: 201, body: load_fixture('application_charges'))
 
     declined_charges = ShopifyAPI::ApplicationCharge.declined
 
-    assert_equal 1, declined_charges.size
-    assert_equal "Magic Mouse", declined_charges.first.name
+    assert_equal(1, declined_charges.size)
+    assert_equal("Magic Mouse", declined_charges.first.name)
   end
 
   def test_activate_application_charge
-    fake "application_charges", :method => :get, :status => 201, :body => load_fixture('application_charges')
-    fake "application_charges/803740/activate", :method => :post, :status => 200, :body => "{}"
+    fake("application_charges", method: :get, status: 201, body: load_fixture('application_charges'))
+    fake("application_charges/803740/activate", method: :post, status: 200, body: "{}")
 
     charge = ShopifyAPI::ApplicationCharge.accepted
 
-    assert charge.last.activate
+    assert(charge.last.activate)
   end
 
 end

+ 9 - 9
test/application_credit_test.rb

@@ -2,7 +2,7 @@ require 'test_helper'
 
 class ApplicationCreditTest < Test::Unit::TestCase
   def test_application_credit_create
-    fake "application_credits", method: :post, status: 201, body: load_fixture('application_credit')
+    fake("application_credits", method: :post, status: 201, body: load_fixture('application_credit'))
 
     credit = ShopifyAPI::ApplicationCredit.create(
       description: "refund for application charge",
@@ -11,25 +11,25 @@ class ApplicationCreditTest < Test::Unit::TestCase
       shop_id: 487168
     )
 
-    assert_equal 'refund for application charge', credit.description
-    assert_equal '5.00', credit.amount
+    assert_equal('refund for application charge', credit.description)
+    assert_equal('5.00', credit.amount)
   end
 
   def test_get_application_credit
-    fake "application_credits/803742", method: :get, status: 201, body: load_fixture('application_credit')
+    fake("application_credits/803742", method: :get, status: 201, body: load_fixture('application_credit'))
 
     credit = ShopifyAPI::ApplicationCredit.find(803742)
 
-    assert_equal 'refund for application charge', credit.description
-    assert_equal '5.00', credit.amount
+    assert_equal('refund for application charge', credit.description)
+    assert_equal('5.00', credit.amount)
   end
 
   def test_list_application_credits
-    fake "application_credits", method: :get, status: 201, body: load_fixture('application_credits')
+    fake("application_credits", method: :get, status: 201, body: load_fixture('application_credits'))
 
     credit = ShopifyAPI::ApplicationCredit.find(:all)
 
-    assert_equal 2, credit.size
-    assert_equal '10.00', credit.last.amount
+    assert_equal(2, credit.size)
+    assert_equal('10.00', credit.last.amount)
   end
 end

+ 33 - 33
test/article_test.rb

@@ -3,71 +3,71 @@ require 'test_helper'
 class ArticleTest < Test::Unit::TestCase
 
   def test_create_article
-    fake "blogs/1008414260/articles", :method => :post, :body => load_fixture('article')
-    article = ShopifyAPI::Article.new(:blog_id => 1008414260)
+    fake("blogs/1008414260/articles", method: :post, body: load_fixture('article'))
+    article = ShopifyAPI::Article.new(blog_id: 1008414260)
     article.save
-    assert_equal "First Post", article.title
+    assert_equal("First Post", article.title)
   end
 
   def test_get_article
-    fake "articles/6242736", :method => :get, :body => load_fixture('article')
+    fake("articles/6242736", method: :get, body: load_fixture('article'))
     article = ShopifyAPI::Article.find(6242736)
-    assert_equal "First Post", article.title
-    assert_equal 1008414260, article.blog_id
+    assert_equal("First Post", article.title)
+    assert_equal(1008414260, article.blog_id)
   end
 
   def test_get_articles
-    fake "articles", :method => :get, :body => load_fixture('articles')
+    fake("articles", method: :get, body: load_fixture('articles'))
     articles = ShopifyAPI::Article.all
-    assert_equal 3, articles.length
-    assert_equal 1008414260, articles.first.blog_id
+    assert_equal(3, articles.length)
+    assert_equal(1008414260, articles.first.blog_id)
   end
 
   def test_get_articles_namespaced
-    fake "blogs/1008414260/articles", :method => :get, :body => load_fixture('articles')
-    articles = ShopifyAPI::Article.find(:all, :params => { :blog_id => 1008414260 })
-    assert_equal 3, articles.length
-    assert_equal 1008414260, articles.first.blog_id
+    fake("blogs/1008414260/articles", method: :get, body: load_fixture('articles'))
+    articles = ShopifyAPI::Article.find(:all, params: { blog_id: 1008414260 })
+    assert_equal(3, articles.length)
+    assert_equal(1008414260, articles.first.blog_id)
   end
 
   def test_get_article_namespaced
-    fake "blogs/1008414260/articles/6242736", :method => :get, :body => load_fixture('article')
-    article = ShopifyAPI::Article.find(6242736, :params => { :blog_id => 1008414260 })
-    assert_equal "First Post", article.title
-    assert_equal 1008414260, article.blog_id
+    fake("blogs/1008414260/articles/6242736", method: :get, body: load_fixture('article'))
+    article = ShopifyAPI::Article.find(6242736, params: { blog_id: 1008414260 })
+    assert_equal("First Post", article.title)
+    assert_equal(1008414260, article.blog_id)
   end
 
   def test_get_authors
-    fake "articles/authors", :method => :get, :body => load_fixture('authors')
+    fake("articles/authors", method: :get, body: load_fixture('authors'))
     authors = ShopifyAPI::Article.authors
-    assert_equal "Shopify", authors.first
-    assert_equal "development shop", authors.last
+    assert_equal("Shopify", authors.first)
+    assert_equal("development shop", authors.last)
   end
 
   def test_get_authors_for_blog_id
-    fake "blogs/1008414260/articles/authors", :method => :get, :body => load_fixture('authors')
-    authors = ShopifyAPI::Article.authors(:blog_id => 1008414260)
-    assert_equal 3, authors.length
+    fake("blogs/1008414260/articles/authors", method: :get, body: load_fixture('authors'))
+    authors = ShopifyAPI::Article.authors(blog_id: 1008414260)
+    assert_equal(3, authors.length)
   end
 
   def test_get_tags
-    fake "articles/tags", :method => :get, :body => load_fixture('tags')
+    fake("articles/tags", method: :get, body: load_fixture('tags'))
     tags = ShopifyAPI::Article.tags
-    assert_equal "consequuntur", tags.first
-    assert_equal "repellendus", tags.last
+    assert_equal("consequuntur", tags.first)
+    assert_equal("repellendus", tags.last)
   end
 
   def test_get_tags_for_blog_id
-    fake "blogs/1008414260/articles/tags", :method => :get, :body => load_fixture('tags')
-    tags = ShopifyAPI::Article.tags(:blog_id => 1008414260)
-    assert_equal "consequuntur", tags.first
-    assert_equal "repellendus", tags.last
+    fake("blogs/1008414260/articles/tags", method: :get, body: load_fixture('tags'))
+    tags = ShopifyAPI::Article.tags(blog_id: 1008414260)
+    assert_equal("consequuntur", tags.first)
+    assert_equal("repellendus", tags.last)
   end
 
   def test_get_popular_tags
-    fake "articles/tags.json?limit=1&popular=1", :extension => false, :method => :get, :body => load_fixture('tags')
-    tags = ShopifyAPI::Article.tags(:popular => 1, :limit => 1)
-    assert_equal 3, tags.length
+    fake("articles/tags.json?limit=1&popular=1", extension: false, method: :get, body: load_fixture('tags'))
+    tags = ShopifyAPI::Article.tags(popular: 1, limit: 1)
+    assert_equal(3, tags.length)
   end
 
 end

+ 5 - 5
test/asset_test.rb

@@ -2,17 +2,17 @@ require 'test_helper'
 
 class AssetTest < Test::Unit::TestCase
   def test_get_assetss
-    fake "themes/1/assets", :method => :get, :body => load_fixture('assets')
-    ShopifyAPI::Asset.find(:all, :params => { :theme_id => 1 })
+    fake("themes/1/assets", method: :get, body: load_fixture('assets'))
+    ShopifyAPI::Asset.find(:all, params: { theme_id: 1 })
   end
 
   def test_get_asset_namespaced
-    fake "themes/1/assets.json?asset%5Bkey%5D=templates%2Findex.liquid&theme_id=1", :extension=> false, :method => :get, :body => load_fixture('asset')
-    ShopifyAPI::Asset.find('templates/index.liquid', :params => { :theme_id => 1 })
+    fake("themes/1/assets.json?asset%5Bkey%5D=templates%2Findex.liquid&theme_id=1", extension: false, method: :get, body: load_fixture('asset'))
+    ShopifyAPI::Asset.find('templates/index.liquid', params: { theme_id: 1 })
   end
 
   def test_get_asset
-    fake "assets.json?asset%5Bkey%5D=templates%2Findex.liquid", :extension=> false, :method => :get, :body => load_fixture('asset')
+    fake("assets.json?asset%5Bkey%5D=templates%2Findex.liquid", extension: false, method: :get, body: load_fixture('asset'))
     ShopifyAPI::Asset.find('templates/index.liquid')
   end
 end

+ 10 - 10
test/base_test.rb

@@ -14,7 +14,7 @@ class BaseTest < Test::Unit::TestCase
   end
 
   test '#activate_session should set site and headers for given session' do
-    ShopifyAPI::Base.activate_session @session1
+    ShopifyAPI::Base.activate_session(@session1)
 
     assert_nil ActiveResource::Base.site
     assert_equal 'https://shop1.myshopify.com', ShopifyAPI::Base.site.to_s
@@ -55,7 +55,7 @@ class BaseTest < Test::Unit::TestCase
   end
 
   test '#clear_session should clear site and headers from Base' do
-    ShopifyAPI::Base.activate_session @session1
+    ShopifyAPI::Base.activate_session(@session1)
     ShopifyAPI::Base.clear_session
 
     assert_nil ActiveResource::Base.site
@@ -68,9 +68,9 @@ class BaseTest < Test::Unit::TestCase
   end
 
   test '#activate_session with one session, then clearing and activating with another session should send request to correct shop' do
-    ShopifyAPI::Base.activate_session @session1
+    ShopifyAPI::Base.activate_session(@session1)
     ShopifyAPI::Base.clear_session
-    ShopifyAPI::Base.activate_session @session2
+    ShopifyAPI::Base.activate_session(@session2)
 
     assert_nil ActiveResource::Base.site
     assert_equal 'https://shop2.myshopify.com', ShopifyAPI::Base.site.to_s
@@ -83,24 +83,24 @@ class BaseTest < Test::Unit::TestCase
 
   test '#activate_session with nil raises an InvalidSessionError' do
     assert_raises ShopifyAPI::Base::InvalidSessionError do
-      ShopifyAPI::Base.activate_session nil
+      ShopifyAPI::Base.activate_session(nil)
     end
   end
 
   test "#delete should send custom headers with request" do
-    ShopifyAPI::Base.activate_session @session1
+    ShopifyAPI::Base.activate_session(@session1)
     ShopifyAPI::Base.headers['X-Custom'] = 'abc'
     ShopifyAPI::Base.connection
       .expects(:delete)
       .with('/admin/api/2019-01/bases/1.json', has_entry('X-Custom', 'abc'))
-    ShopifyAPI::Base.delete "1"
+    ShopifyAPI::Base.delete("1")
   end
 
   test "#headers includes the User-Agent" do
     assert_not_includes ActiveResource::Base.headers.keys, 'User-Agent'
     assert_includes ShopifyAPI::Base.headers.keys, 'User-Agent'
     thread = Thread.new do
-      assert_includes ShopifyAPI::Base.headers.keys, 'User-Agent'
+      assert_includes(ShopifyAPI::Base.headers.keys, 'User-Agent')
     end
     thread.join
   end
@@ -137,7 +137,7 @@ class BaseTest < Test::Unit::TestCase
   test "#headers set in the main thread affect spawned threads" do
     ShopifyAPI::Base.headers['X-Custom'] = "the value"
     Thread.new do
-      assert_equal "the value", ShopifyAPI::Base.headers['X-Custom']
+      assert_equal("the value", ShopifyAPI::Base.headers['X-Custom'])
     end.join
   end
 
@@ -196,7 +196,7 @@ class BaseTest < Test::Unit::TestCase
 
   test "#version_validation! raises NotImplemetedError if api_version is older than minimum supported version" do
     ShopifyAPI::Base.api_version = '2019-10'
-    exception = assert_raises NotImplementedError do
+    exception = assert_raises(NotImplementedError) do
       ShopifyAPI::Base::version_validation!('2020-01')
     end
     assert_equal 'The minimum supported version is 2020-01.', exception.message

+ 2 - 2
test/blog_test.rb

@@ -1,8 +1,8 @@
 require 'test_helper'
 class BlogTest < Test::Unit::TestCase
   test "blog creation" do
-    fake "blogs", :method => :post, :status => 202, :body => load_fixture('blog')
-    ShopifyAPI::Blog.create(:title => "Test Blog")
+    fake "blogs", method: :post, status: 202, body: load_fixture('blog')
+    ShopifyAPI::Blog.create(title: "Test Blog")
     assert_equal '{"blog":{"title":"Test Blog"}}', WebMock.last_request.body
   end
 end

+ 3 - 3
test/carrier_service_test.rb

@@ -2,14 +2,14 @@ require 'test_helper'
 
 class CarrierServiceTest < Test::Unit::TestCase
   test 'new should create carrier service' do
-    fake "carrier_services", :method => :post, :body => load_fixture('carrier_service')
-    carrier_service = ShopifyAPI::CarrierService.new(:name => "Some Postal Service")
+    fake "carrier_services", method: :post, body: load_fixture('carrier_service')
+    carrier_service = ShopifyAPI::CarrierService.new(name: "Some Postal Service")
     carrier_service.save
     assert_equal "Some Postal Service" , carrier_service.name
   end
 
   test 'find should return the carrier service' do
-    fake "carrier_services/123456", :method => :get, :body => load_fixture('carrier_service')
+    fake "carrier_services/123456", method: :get, body: load_fixture('carrier_service')
     carrier_service = ShopifyAPI::CarrierService.find(123456)
     assert_equal 123456 , carrier_service.id
     assert_equal "Some Postal Service", carrier_service.name

+ 2 - 2
test/collect_test.rb

@@ -2,8 +2,8 @@ require 'test_helper'
 
 class CollectTest < Test::Unit::TestCase
   test "#create should create a collect" do
-    fake "collects", :method => :post, :status => 201, :body => load_fixture('collect')
-    link = ShopifyAPI::Collect.create(:product_id => 921728736, :collection_id => 841564295)
+    fake "collects", method: :post, status: 201, body: load_fixture('collect')
+    link = ShopifyAPI::Collect.create(product_id: 921728736, collection_id: 841564295)
     assert_equal 841564295, link.id
   end
 end

+ 15 - 15
test/collection_listing_test.rb

@@ -3,40 +3,40 @@ require 'test_helper'
 class CollectionListingTest < Test::Unit::TestCase
 
   def test_get_collection_listings
-    fake "collection_listings", method: :get, status: 201, body: load_fixture('collection_listings')
+    fake("collection_listings", method: :get, status: 201, body: load_fixture('collection_listings'))
 
     collection_listings = ShopifyAPI::CollectionListing.find(:all)
 
-    assert_equal 1, collection_listings.count
-    assert_equal 1, collection_listings.first.collection_id
-    assert_equal 'Home page', collection_listings.first.title
+    assert_equal(1, collection_listings.count)
+    assert_equal(1, collection_listings.first.collection_id)
+    assert_equal('Home page', collection_listings.first.title)
   end
 
   def test_get_collection_listing
-    fake "collection_listings/1", method: :get, status: 201, body: load_fixture('collection_listing')
+    fake("collection_listings/1", method: :get, status: 201, body: load_fixture('collection_listing'))
 
     collection_listing = ShopifyAPI::CollectionListing.find(1)
 
-    assert_equal 1, collection_listing.collection_id
-    assert_equal 'Home page', collection_listing.title
+    assert_equal(1, collection_listing.collection_id)
+    assert_equal('Home page', collection_listing.title)
   end
 
   def test_get_collection_listing_reload
-    fake "collection_listings/1", method: :get, status: 201, body: load_fixture('collection_listing')
+    fake("collection_listings/1", method: :get, status: 201, body: load_fixture('collection_listing'))
 
     collection_listing = ShopifyAPI::CollectionListing.new(collection_id: 1)
     collection_listing.reload
 
-    assert_equal 1, collection_listing.collection_id
-    assert_equal 'Home page', collection_listing.title
+    assert_equal(1, collection_listing.collection_id)
+    assert_equal('Home page', collection_listing.title)
   end
 
   def test_get_collection_listing_product_ids
-    fake "collection_listings/1/product_ids", method: :get, status: 201, body: load_fixture('collection_listing_product_ids')
+    fake("collection_listings/1/product_ids", method: :get, status: 201, body: load_fixture('collection_listing_product_ids'))
 
     collection_listing = ShopifyAPI::CollectionListing.new(collection_id: 1)
 
-    assert_equal [1, 2], collection_listing.product_ids
+    assert_equal([1, 2], collection_listing.product_ids)
   end
 
   def test_get_collection_listing_product_ids_multi_page_with_cursor
@@ -61,8 +61,8 @@ class CollectionListingTest < Test::Unit::TestCase
     )
 
     product_ids = collection_listing.product_ids
-    assert_equal [1, 2], product_ids
-    assert product_ids.next_page?
+    assert_equal([1, 2], product_ids)
+    assert(product_ids.next_page?)
 
     fake(
       "collection_listings/1/product_ids",
@@ -74,6 +74,6 @@ class CollectionListingTest < Test::Unit::TestCase
     )
 
     next_page = product_ids.fetch_next_page
-    assert_equal [3, 4], next_page
+    assert_equal([3, 4], next_page)
   end
 end

+ 8 - 8
test/collection_publication_test.rb

@@ -3,23 +3,23 @@ require 'test_helper'
 
 class CollectionPublicationTest < Test::Unit::TestCase
   def test_get_all_collection_publications
-    fake 'publications/55650051/collection_publications', body: load_fixture('collection_publications')
+    fake('publications/55650051/collection_publications', body: load_fixture('collection_publications'))
     collection_publications = ShopifyAPI::CollectionPublication.find(:all, params: { publication_id: 55650051 })
 
-    assert_equal 96062799894, collection_publications.first.id
-    assert_equal 55650051, collection_publications.first.publication_id
+    assert_equal(96062799894, collection_publications.first.id)
+    assert_equal(55650051, collection_publications.first.publication_id)
   end
 
   def test_get_collection_publication
-    fake 'publications/55650051/collection_publications/647162527768', body: load_fixture('collection_publication')
+    fake('publications/55650051/collection_publications/647162527768', body: load_fixture('collection_publication'))
     collection_publication = ShopifyAPI::CollectionPublication.find(647162527768, params: { publication_id: 55650051 })
 
-    assert_equal 96062799894, collection_publication.id
-    assert_equal 55650051, collection_publication.publication_id
+    assert_equal(96062799894, collection_publication.id)
+    assert_equal(55650051, collection_publication.publication_id)
   end
 
   def test_create_collection_publication
-    fake 'publications/55650051/collection_publications', method: :post, body: load_fixture('collection_publication')
+    fake('publications/55650051/collection_publications', method: :post, body: load_fixture('collection_publication'))
     ShopifyAPI::CollectionPublication.create(
       publication_id: 55650051,
       published_at: "2018-01-29T14:06:08-05:00",
@@ -35,6 +35,6 @@ class CollectionPublicationTest < Test::Unit::TestCase
       },
     }.to_json
 
-    assert_equal expected_body, WebMock.last_request.body
+    assert_equal(expected_body, WebMock.last_request.body)
   end
 end

+ 2 - 2
test/countable_test.rb

@@ -3,11 +3,11 @@ require 'test_helper'
 class CountableTest < Test::Unit::TestCase
   def setup
     super
-    fake "products/count", :body => '{"count": 16}'
+    fake("products/count", body: '{"count": 16}')
   end
 
   def test_count_products
     count = ShopifyAPI::Product.count
-    assert_equal 16, count
+    assert_equal(16, count)
   end
 end

+ 1 - 1
test/currency_test.rb

@@ -4,7 +4,7 @@ require 'test_helper'
 class CurrencyTest < Test::Unit::TestCase
   def setup
     super
-    fake "currencies", method: :get, body: load_fixture('currencies')
+    fake("currencies", method: :get, body: load_fixture('currencies'))
   end
 
   context "Currency" do

+ 2 - 2
test/custom_collection_test.rb

@@ -2,8 +2,8 @@ require 'test_helper'
 
 class CustomCollectionTest < Test::Unit::TestCase
   test "#create should create a custom collection" do
-    fake "custom_collections", :method => :post, :status => 201, :body => load_fixture('custom_collection')
-    link = ShopifyAPI::CustomCollection.create(:title => "Macbooks", :image => { :src => "http://example.com/rails_logo.gif" })
+    fake "custom_collections", method: :post, status: 201, body: load_fixture('custom_collection')
+    link = ShopifyAPI::CustomCollection.create(title: "Macbooks", image: { src: "http://example.com/rails_logo.gif" })
     assert_equal 1063001463, link.id
   end
 end

+ 8 - 8
test/customer_saved_search_test.rb

@@ -7,21 +7,21 @@ class CustomerSavedSearchTest < Test::Unit::TestCase
   end
 
   def test_get_customers_from_customer_saved_search
-    fake 'customers/search.json?customer_saved_search_id=8899730', :body => load_fixture('customer_saved_search_customers'), :extension => false
-    assert_equal 1, @customer_saved_search.customers.length
-    assert_equal 112223902, @customer_saved_search.customers.first.id
+    fake('customers/search.json?customer_saved_search_id=8899730', body: load_fixture('customer_saved_search_customers'), extension: false)
+    assert_equal(1, @customer_saved_search.customers.length)
+    assert_equal(112223902, @customer_saved_search.customers.first.id)
   end
 
   def test_get_customers_from_customer_saved_search_with_params
-    fake 'customers/search.json?customer_saved_search_id=8899730&limit=1', :body => load_fixture('customer_saved_search_customers'), :extension => false
-    customers = @customer_saved_search.customers(:limit => 1)
-    assert_equal 1, customers.length
-    assert_equal 112223902, customers.first.id
+    fake('customers/search.json?customer_saved_search_id=8899730&limit=1', body: load_fixture('customer_saved_search_customers'), extension: false)
+    customers = @customer_saved_search.customers(limit: 1)
+    assert_equal(1, customers.length)
+    assert_equal(112223902, customers.first.id)
   end
 
   private
   def load_customer_saved_search
-    fake 'customer_saved_searches/8899730', :body => load_fixture('customer_saved_search')
+    fake('customer_saved_searches/8899730', body: load_fixture('customer_saved_search'))
     @customer_saved_search = ShopifyAPI::CustomerSavedSearch.find(8899730)
   end
 end

+ 3 - 3
test/customer_test.rb

@@ -4,20 +4,20 @@ class CustomerTest < Test::Unit::TestCase
   def setup
     super
 
-    fake 'customers/207119551', body: load_fixture('customers')
+    fake('customers/207119551', body: load_fixture('customers'))
 
     @customer = ShopifyAPI::Customer.find(207119551)
   end
 
   test "search should get a customers collection" do
-    fake "customers/search.json?query=Bob+country%3AUnited+States", :extension => false, :body => load_fixture('customers_search')
+    fake "customers/search.json?query=Bob+country%3AUnited+States", extension: false, body: load_fixture('customers_search')
 
     results = ShopifyAPI::Customer.search(query: 'Bob country:United States')
     assert_equal 'Bob', results.first.first_name
   end
 
   test "account_activation_url should create an account activation url" do
-    fake "customers/207119551/account_activation_url", :method => :post, :body => load_fixture('customers_account_activation_url')
+    fake "customers/207119551/account_activation_url", method: :post, body: load_fixture('customers_account_activation_url')
 
     activation_url = "http://apple.myshopify.com/account/activate/207119551/86688abf23572680740b1c062fa37111-1458248616"
     assert_equal activation_url, @customer.account_activation_url

+ 5 - 5
test/detailed_log_subscriber_test.rb

@@ -9,7 +9,7 @@ class LogSubscriberTest < Test::Unit::TestCase
 
   def setup
     super
-    @page = { :page => { :id => 1, :title => 'Shopify API' } }.to_json
+    @page = { page: { id: 1, title: 'Shopify API' } }.to_json
     @ua_header = "\"User-Agent\"=>\"ShopifyAPI/#{ShopifyAPI::VERSION} ActiveResource/#{ActiveResource::VERSION::STRING} Ruby/#{RUBY_VERSION}\""
     @request_headers = "Headers: {\"Accept\"=>\"application/json\", " \
       "#{@ua_header}, \"X-Shopify-Access-Token\"=>\"access_token\"}"
@@ -30,8 +30,8 @@ class LogSubscriberTest < Test::Unit::TestCase
 
     ShopifyAPI::Base.activate_session(session)
 
-    ActiveResource::LogSubscriber.attach_to :active_resource
-    ActiveResource::DetailedLogSubscriber.attach_to :active_resource_detailed
+    ActiveResource::LogSubscriber.attach_to(:active_resource)
+    ActiveResource::DetailedLogSubscriber.attach_to(:active_resource_detailed)
   end
 
   def teardown
@@ -45,7 +45,7 @@ class LogSubscriberTest < Test::Unit::TestCase
   end
 
   test "logging on #find" do
-    fake "pages/1", :method => :get, :body => @page
+    fake "pages/1", method: :get, body: @page
 
     ShopifyAPI::Page.find(1)
 
@@ -64,7 +64,7 @@ class LogSubscriberTest < Test::Unit::TestCase
   end
 
   test "logging on #find with an error" do
-    fake "pages/2", :method => :get, :body => nil, :status => 404
+    fake "pages/2", method: :get, body: nil, status: 404
 
     assert_raises ActiveResource::ResourceNotFound do
       ShopifyAPI::Page.find(2)

+ 10 - 10
test/discount_code_batch_test.rb

@@ -4,30 +4,30 @@ require 'test_helper'
 class DiscountCodeBatchTest < Test::Unit::TestCase
   def setup
     super
-    fake 'price_rules/102586120/batch/989355119', body: load_fixture('discount_code_batch')
+    fake('price_rules/102586120/batch/989355119', body: load_fixture('discount_code_batch'))
   end
 
   def test_get_batch
-    batch = ShopifyAPI::DiscountCodeBatch.find 989355119, params: { price_rule_id: 102586120 }
+    batch = ShopifyAPI::DiscountCodeBatch.find(989355119, params: { price_rule_id: 102586120 })
 
-    assert_equal 989355119, batch.id
+    assert_equal(989355119, batch.id)
   end
 
   def test_get_batch_discount_codes
-    fake 'price_rules/102586120/batch/989355119/discount_codes',
+    fake('price_rules/102586120/batch/989355119/discount_codes',
       method: :get,
       status: 200,
-      body: load_fixture('discount_code_batch_discount_codes')
+      body: load_fixture('discount_code_batch_discount_codes'))
 
-    batch = ShopifyAPI::DiscountCodeBatch.find 989355119, params: { price_rule_id: 102586120 }
+    batch = ShopifyAPI::DiscountCodeBatch.find(989355119, params: { price_rule_id: 102586120 })
     discount_code_job = batch.discount_code_job
 
-    assert_equal 3, discount_code_job.count
-    assert discount_code_job[2].errors.present?
+    assert_equal(3, discount_code_job.count)
+    assert(discount_code_job[2].errors.present?)
   end
 
   def test_create_batch
-    fake 'price_rules/102586120/batch', method: :post, status: 201, body: load_fixture('discount_code_batch')
+    fake('price_rules/102586120/batch', method: :post, status: 201, body: load_fixture('discount_code_batch'))
     batch = ShopifyAPI::DiscountCodeBatch.new
     batch.prefix_options[:price_rule_id] = 102586120
     discount_codes = [{ "code": "SUMMER1" }, { "code": "SUMMER2" }, { "code": "SUMMER3" }]
@@ -35,6 +35,6 @@ class DiscountCodeBatchTest < Test::Unit::TestCase
     batch.save
 
     expected_body = { discount_codes: discount_codes }.to_json
-    assert_equal expected_body, WebMock.last_request.body
+    assert_equal(expected_body, WebMock.last_request.body)
   end
 end

+ 14 - 14
test/discount_code_test.rb

@@ -3,34 +3,34 @@ require 'test_helper'
 class DiscountCodeTest < Test::Unit::TestCase
   def setup
     super
-    fake 'price_rules/102586120/discount_codes/1002091923', body: load_fixture('discount_code')
+    fake('price_rules/102586120/discount_codes/1002091923', body: load_fixture('discount_code'))
 
     @discount_code = ShopifyAPI::DiscountCode.find(1002091923, params: { price_rule_id: 102586120 })
   end
 
   def test_get_discount_code
-    fake 'price_rules/102586120/discount_codes', method: :get, status: 200, body: load_fixture('discount_code')
-    discount_code = ShopifyAPI::DiscountCode.find 1002091923, params: { price_rule_id: 102586120 }
+    fake('price_rules/102586120/discount_codes', method: :get, status: 200, body: load_fixture('discount_code'))
+    discount_code = ShopifyAPI::DiscountCode.find(1002091923, params: { price_rule_id: 102586120 })
 
-    assert_equal 1002091923, discount_code.id
+    assert_equal(1002091923, discount_code.id)
   end
 
   def test_get_all_discount_codes
-    fake 'price_rules/102586120/discount_codes', method: :get, status: 200, body: load_fixture('discount_codes')
-    discount_codes = ShopifyAPI::DiscountCode.all params: { price_rule_id: 102586120 }
+    fake('price_rules/102586120/discount_codes', method: :get, status: 200, body: load_fixture('discount_codes'))
+    discount_codes = ShopifyAPI::DiscountCode.all(params: { price_rule_id: 102586120 })
 
-    assert_equal 1, discount_codes.length
-    assert_equal 1002091923, discount_codes.first.id
+    assert_equal(1, discount_codes.length)
+    assert_equal(1002091923, discount_codes.first.id)
   end
 
   def test_create_discount_code
-    fake 'price_rules/102586120/discount_codes', method: :post, status: 201, body: load_fixture('discount_code')
+    fake('price_rules/102586120/discount_codes', method: :post, status: 201, body: load_fixture('discount_code'))
     discount_code = ShopifyAPI::DiscountCode.new
     discount_code.prefix_options[:price_rule_id] = 102586120
     discount_code.code = "SUMMERSALE10"
     discount_code.save
 
-    assert_equal '{"discount_code":{"code":"SUMMERSALE10"}}', WebMock.last_request.body
+    assert_equal('{"discount_code":{"code":"SUMMERSALE10"}}', WebMock.last_request.body)
   end
 
   def test_update_discount_code
@@ -38,16 +38,16 @@ class DiscountCodeTest < Test::Unit::TestCase
     discount_code_response['discount_code']['code'] = "WINTERSALE50"
     @discount_code.code = "WINTERSALE50"
 
-    fake 'price_rules/102586120/discount_codes/1002091923', method: :put, status: 200, body: ActiveSupport::JSON.encode(discount_code_response)
+    fake('price_rules/102586120/discount_codes/1002091923', method: :put, status: 200, body: ActiveSupport::JSON.encode(discount_code_response))
 
     @discount_code.save
 
-    assert_equal discount_code_response['discount_code']['code'], @discount_code.code
+    assert_equal(discount_code_response['discount_code']['code'], @discount_code.code)
   end
 
   def test_delete_discount_code
-    fake 'price_rules/102586120/discount_codes/1002091923', method: :delete, body: 'destroyed'
+    fake('price_rules/102586120/discount_codes/1002091923', method: :delete, body: 'destroyed')
 
-    assert @discount_code.destroy
+    assert(@discount_code.destroy)
   end
 end

+ 48 - 48
test/draft_order_test.rb

@@ -4,148 +4,148 @@ class DraftOrderTest < Test::Unit::TestCase
   def setup
     super
 
-    fake 'draft_orders/517119332', body: load_fixture('draft_order')
+    fake('draft_orders/517119332', body: load_fixture('draft_order'))
 
     @draft_order = ShopifyAPI::DraftOrder.find(517119332)
   end
 
   def test_get_draft_order
-    fake 'draft_orders/517119332', method: :get, status: 200, body: load_fixture('draft_order')
+    fake('draft_orders/517119332', method: :get, status: 200, body: load_fixture('draft_order'))
 
     draft_order = ShopifyAPI::DraftOrder.find(517119332)
 
-    assert_equal 517119332, draft_order.id
+    assert_equal(517119332, draft_order.id)
   end
 
   def test_get_all_draft_orders
-    fake 'draft_orders', method: :get, status: 200, body: load_fixture('draft_orders')
+    fake('draft_orders', method: :get, status: 200, body: load_fixture('draft_orders'))
 
     draft_orders = ShopifyAPI::DraftOrder.all
 
-    assert_equal 1, draft_orders.length
-    assert_equal 517119332, draft_orders.first.id
+    assert_equal(1, draft_orders.length)
+    assert_equal(517119332, draft_orders.first.id)
   end
 
   def test_get_count_draft_orders
-    fake 'draft_orders/count', method: :get, status: 200, body: '{"count": 16}'
+    fake('draft_orders/count', method: :get, status: 200, body: '{"count": 16}')
 
     draft_orders_count = ShopifyAPI::DraftOrder.count
 
-    assert_equal 16, draft_orders_count
+    assert_equal(16, draft_orders_count)
   end
 
   def test_create_draft_order
-    fake 'draft_orders', method: :post, status: 201, body: load_fixture('draft_order')
+    fake('draft_orders', method: :post, status: 201, body: load_fixture('draft_order'))
 
     draft_order = ShopifyAPI::DraftOrder.create(line_items: [{ quantity: 1, variant_id: 39072856 }])
 
-    assert_equal '{"draft_order":{"line_items":[{"quantity":1,"variant_id":39072856}]}}', WebMock.last_request.body
-    assert_equal 39072856, draft_order.line_items.first.variant_id
+    assert_equal('{"draft_order":{"line_items":[{"quantity":1,"variant_id":39072856}]}}', WebMock.last_request.body)
+    assert_equal(39072856, draft_order.line_items.first.variant_id)
   end
 
   def test_create_draft_order_202
-    fake 'draft_orders', method: :post, status: 202, body: load_fixture('draft_order')
+    fake('draft_orders', method: :post, status: 202, body: load_fixture('draft_order'))
 
     draft_order = ShopifyAPI::DraftOrder.create(line_items: [{ quantity: 1, variant_id: 39072856 }])
 
-    assert_equal 39072856, draft_order.line_items.first.variant_id
+    assert_equal(39072856, draft_order.line_items.first.variant_id)
   end
 
   def test_update_draft_order
     draft_order_response = ActiveSupport::JSON.decode(load_fixture('draft_order'))
     draft_order_response['draft_order']['note'] = 'Test new note'
     @draft_order.note = 'Test new note'
-    fake 'draft_orders/517119332', method: :put, status: 200, body: ActiveSupport::JSON.encode(draft_order_response)
+    fake('draft_orders/517119332', method: :put, status: 200, body: ActiveSupport::JSON.encode(draft_order_response))
 
     @draft_order.save
 
-    assert_equal draft_order_response['draft_order']['note'], @draft_order.note
+    assert_equal(draft_order_response['draft_order']['note'], @draft_order.note)
   end
 
   def test_send_invoice_with_no_params
     draft_order_invoice_fixture = load_fixture('draft_order_invoice')
     draft_order_invoice = ActiveSupport::JSON.decode(draft_order_invoice_fixture)
-    fake 'draft_orders/517119332/send_invoice', method: :post, body: draft_order_invoice_fixture
+    fake('draft_orders/517119332/send_invoice', method: :post, body: draft_order_invoice_fixture)
 
     draft_order_invoice_response = @draft_order.send_invoice
 
-    assert_equal '{"draft_order_invoice":{}}', WebMock.last_request.body
-    assert_kind_of ShopifyAPI::DraftOrderInvoice, draft_order_invoice_response
-    assert_equal draft_order_invoice['draft_order_invoice']['to'], draft_order_invoice_response.to
+    assert_equal('{"draft_order_invoice":{}}', WebMock.last_request.body)
+    assert_kind_of(ShopifyAPI::DraftOrderInvoice, draft_order_invoice_response)
+    assert_equal(draft_order_invoice['draft_order_invoice']['to'], draft_order_invoice_response.to)
   end
 
   def test_send_invoice_with_params
     draft_order_invoice_fixture = load_fixture('draft_order_invoice')
     draft_order_invoice = ActiveSupport::JSON.decode(draft_order_invoice_fixture)
-    fake 'draft_orders/517119332/send_invoice', method: :post, body: draft_order_invoice_fixture
+    fake('draft_orders/517119332/send_invoice', method: :post, body: draft_order_invoice_fixture)
 
     draft_order_invoice_response = @draft_order.send_invoice(ShopifyAPI::DraftOrderInvoice.new(draft_order_invoice['draft_order_invoice']))
 
-    assert_equal draft_order_invoice, ActiveSupport::JSON.decode(WebMock.last_request.body)
-    assert_kind_of ShopifyAPI::DraftOrderInvoice, draft_order_invoice_response
-    assert_equal draft_order_invoice['draft_order_invoice']['to'], draft_order_invoice_response.to
+    assert_equal(draft_order_invoice, ActiveSupport::JSON.decode(WebMock.last_request.body))
+    assert_kind_of(ShopifyAPI::DraftOrderInvoice, draft_order_invoice_response)
+    assert_equal(draft_order_invoice['draft_order_invoice']['to'], draft_order_invoice_response.to)
   end
 
   def test_delete_draft_order
-    fake 'draft_orders/517119332', method: :delete, body: 'destroyed'
-    assert @draft_order.destroy
+    fake('draft_orders/517119332', method: :delete, body: 'destroyed')
+    assert(@draft_order.destroy)
   end
 
   def test_add_metafields_to_draft_order
-    fake 'draft_orders/517119332/metafields', method: :post, status: 201, body: load_fixture('metafield')
+    fake('draft_orders/517119332/metafields', method: :post, status: 201, body: load_fixture('metafield'))
 
     field = @draft_order.add_metafield(ShopifyAPI::Metafield.new(namespace: 'contact', key: 'email', value: '123@example.com', value_type: 'string'))
 
-    assert_equal ActiveSupport::JSON.decode('{"metafield":{"namespace":"contact","key":"email","value":"123@example.com","value_type":"string"}}'), ActiveSupport::JSON.decode(WebMock.last_request.body)
-    assert !field.new_record?
-    assert_equal 'contact', field.namespace
-    assert_equal 'email', field.key
-    assert_equal '123@example.com', field.value
+    assert_equal(ActiveSupport::JSON.decode('{"metafield":{"namespace":"contact","key":"email","value":"123@example.com","value_type":"string"}}'), ActiveSupport::JSON.decode(WebMock.last_request.body))
+    assert(!field.new_record?)
+    assert_equal('contact', field.namespace)
+    assert_equal('email', field.key)
+    assert_equal('123@example.com', field.value)
   end
 
   def test_get_all_metafields_for_draft_order
-    fake 'draft_orders/517119332/metafields', body: load_fixture('metafields')
+    fake('draft_orders/517119332/metafields', body: load_fixture('metafields'))
 
     metafields = @draft_order.metafields
 
-    assert_equal 3, metafields.length
-    assert metafields.all? { |m| m.is_a?(ShopifyAPI::Metafield) }
+    assert_equal(3, metafields.length)
+    assert(metafields.all? { |m| m.is_a?(ShopifyAPI::Metafield) })
   end
 
   def test_get_2_metafields_for_draft_order
-    body = ActiveSupport::JSON.decode load_fixture 'metafields'
-    body['metafields'].slice! 2, 1
+    body = ActiveSupport::JSON.decode(load_fixture('metafields'))
+    body['metafields'].slice!(2, 1)
 
-    fake 'draft_orders/517119332/metafields.json?limit=2', body: body.to_json, extension: false
+    fake('draft_orders/517119332/metafields.json?limit=2', body: body.to_json, extension: false)
 
-    metafields = @draft_order.metafields limit: 2
+    metafields = @draft_order.metafields(limit: 2)
 
-    assert_equal 2, metafields.length
-    assert metafields.all? { |m| m.is_a? ShopifyAPI::Metafield }
+    assert_equal(2, metafields.length)
+    assert(metafields.all? { |m| m.is_a?(ShopifyAPI::Metafield) })
   end
 
   def test_complete_draft_order_with_no_params
     completed_fixture = load_fixture('draft_order_completed')
     completed_draft = ActiveSupport::JSON.decode(completed_fixture)['draft_order']
-    fake 'draft_orders/517119332/complete', method: :put, status: 200, body: completed_fixture
+    fake('draft_orders/517119332/complete', method: :put, status: 200, body: completed_fixture)
 
     @draft_order.complete
 
-    assert_equal completed_draft['status'], @draft_order.status
-    assert_equal completed_draft['order_id'], @draft_order.order_id
-    refute_nil @draft_order.completed_at
+    assert_equal(completed_draft['status'], @draft_order.status)
+    assert_equal(completed_draft['order_id'], @draft_order.order_id)
+    refute_nil(@draft_order.completed_at)
   end
 
   def test_complete_draft_order_with_params
     completed_fixture = load_fixture('draft_order_completed')
     completed_draft = ActiveSupport::JSON.decode(completed_fixture)['draft_order']
     complete_params = { payment_pending: true }
-    fake 'draft_orders/517119332/complete.json?payment_pending=true', extension: false, method: :put, status: 200, body: completed_fixture
+    fake('draft_orders/517119332/complete.json?payment_pending=true', extension: false, method: :put, status: 200, body: completed_fixture)
 
     @draft_order.complete(complete_params)
 
-    assert_equal completed_draft['status'], @draft_order.status
-    assert_equal completed_draft['order_id'], @draft_order.order_id
-    refute_nil @draft_order.completed_at
+    assert_equal(completed_draft['status'], @draft_order.status)
+    assert_equal(completed_draft['order_id'], @draft_order.order_id)
+    refute_nil(@draft_order.completed_at)
   end
 end

+ 18 - 18
test/fulfillment_event_test.rb

@@ -2,33 +2,33 @@ require 'test_helper'
 
 class FulFillmentEventTest < Test::Unit::TestCase
   def test_find_all_resources
-    fake 'orders/450789469/fulfillments/255858046/events',
+    fake('orders/450789469/fulfillments/255858046/events',
          method: :get,
-         body: "[#{load_fixture('fulfillment_event')}]"
+         body: "[#{load_fixture('fulfillment_event')}]")
 
     events = ShopifyAPI::FulfillmentEvent.all(
       params: { fulfillment_id: 255858046, order_id: 450789469 }
     )
 
-    assert_equal 1, events.count
+    assert_equal(1, events.count)
   end
 
   def test_find_a_resource
-    fake 'orders/450789469/fulfillments/255858046/events/334455',
+    fake('orders/450789469/fulfillments/255858046/events/334455',
          method: :get,
-         body: load_fixture('fulfillment_event')
+         body: load_fixture('fulfillment_event'))
 
     event = ShopifyAPI::FulfillmentEvent.find(
       334455, params: { fulfillment_id: 255858046, order_id: 450789469 }
     )
 
-    assert_equal 'in_transit', event.status
-    assert_equal 255858046, event.fulfillment_id
-    assert_equal 450789469, event.order_id
+    assert_equal('in_transit', event.status)
+    assert_equal(255858046, event.fulfillment_id)
+    assert_equal(450789469, event.order_id)
   end
 
   def test_create_a_resource
-    fake 'orders/450789469/fulfillments/255858046/events', method: :post, body: ''
+    fake('orders/450789469/fulfillments/255858046/events', method: :post, body: '')
 
     event = ShopifyAPI::FulfillmentEvent.new(
       fulfillment_id: 255858046,
@@ -36,34 +36,34 @@ class FulFillmentEventTest < Test::Unit::TestCase
       status: 'in_transit'
     )
 
-    assert event.save
+    assert(event.save)
   end
 
   def test_update_a_resource
-    fake 'orders/450789469/fulfillments/255858046/events/334455',
+    fake('orders/450789469/fulfillments/255858046/events/334455',
          method: :get,
-         body: load_fixture('fulfillment_event')
+         body: load_fixture('fulfillment_event'))
 
     event = ShopifyAPI::FulfillmentEvent.find(
       334455, params: { fulfillment_id: 255858046, order_id: 450789469 }
     )
 
-    fake 'orders/450789469/fulfillments/255858046/events/334455', method: :put, body: ''
+    fake('orders/450789469/fulfillments/255858046/events/334455', method: :put, body: '')
 
-    assert event.save
+    assert(event.save)
   end
 
   def test_destroy_a_resource
-    fake 'orders/450789469/fulfillments/255858046/events/334455',
+    fake('orders/450789469/fulfillments/255858046/events/334455',
          method: :get,
-         body: load_fixture('fulfillment_event')
+         body: load_fixture('fulfillment_event'))
 
     event = ShopifyAPI::FulfillmentEvent.find(
       334455, params: { fulfillment_id: 255858046, order_id: 450789469 }
     )
 
-    fake 'orders/450789469/fulfillments/255858046/events/334455', method: :delete, body: ''
+    fake('orders/450789469/fulfillments/255858046/events/334455', method: :delete, body: '')
 
-    assert event.destroy
+    assert(event.destroy)
   end
 end

+ 33 - 33
test/fulfillment_order_test.rb

@@ -8,10 +8,10 @@ class FulFillmentOrderTest < Test::Unit::TestCase
     super
     @url_prefix = url_prefix_for_activated_session_for('2020-01')
 
-    fake 'fulfillment_orders',
+    fake('fulfillment_orders',
       url: "#{@url_prefix}/fulfillment_orders/519788021.json",
       method: :get,
-      body: load_fixture('fulfillment_order')
+      body: load_fixture('fulfillment_order'))
   end
 
   context "FulfillmentOrder" do
@@ -20,7 +20,7 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         url_prefix_for_activated_session_for('2019-10')
         fulfillment_order = load_fixture('fulfillment_order')
 
-        exception = assert_raises NotImplementedError do
+        exception = assert_raises(NotImplementedError) do
           ShopifyAPI::FulfillmentOrder.new(ActiveSupport::JSON.decode(fulfillment_order))
         end
         assert_equal(
@@ -39,7 +39,7 @@ class FulFillmentOrderTest < Test::Unit::TestCase
           method: :get,
           body: load_fixture('fulfillment_order')
 
-        exception = assert_raises NotImplementedError do
+        exception = assert_raises(NotImplementedError) do
           ShopifyAPI::FulfillmentOrder.find(519788021)
         end
         assert_equal(
@@ -142,9 +142,9 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         }
         fake 'fulfillment_orders',
           url: "#{@url_prefix}/fulfillment_orders/519788021/move.json",
-          :method => :post,
-          :request_body => ActiveSupport::JSON.encode(request_body),
-          :body => ActiveSupport::JSON.encode(body)
+          method: :post,
+          request_body: ActiveSupport::JSON.encode(request_body),
+          body: ActiveSupport::JSON.encode(body)
 
         response_fulfillment_orders = fulfillment_order.move(new_location_id: new_location_id)
 
@@ -180,8 +180,8 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         }
         fake 'fulfillment_orders',
           url: "#{@url_prefix}/fulfillment_orders/519788021/cancel.json",
-          :method => :post,
-          :body => ActiveSupport::JSON.encode(body)
+          method: :post,
+          body: ActiveSupport::JSON.encode(body)
 
         response_fulfillment_orders = fulfillment_order.cancel
 
@@ -208,9 +208,9 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         }
         fake 'fulfillment_orders',
           url: "#{@url_prefix}/fulfillment_orders/519788021/close.json",
-          :method => :post,
-          :request_body => ActiveSupport::JSON.encode(request_body),
-          :body => ActiveSupport::JSON.encode(closed)
+          method: :post,
+          request_body: ActiveSupport::JSON.encode(request_body),
+          body: ActiveSupport::JSON.encode(closed)
 
         assert fulfillment_order.close(message: "Test close message.")
         assert_equal 'incomplete', fulfillment_order.status
@@ -244,9 +244,9 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         }
         fake 'fulfillment_orders',
           url: "#{@url_prefix}/fulfillment_orders/519788021/fulfillment_request.json",
-          :method => :post,
-          :request_body => ActiveSupport::JSON.encode(request_body),
-          :body => ActiveSupport::JSON.encode(body)
+          method: :post,
+          request_body: ActiveSupport::JSON.encode(request_body),
+          body: ActiveSupport::JSON.encode(body)
 
         fulfillment_order = ShopifyAPI::FulfillmentOrder.find(519788021)
         params = {
@@ -295,9 +295,9 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         }
         fake 'fulfillment_orders',
           url: "#{@url_prefix}/fulfillment_orders/519788021/fulfillment_request.json",
-          :method => :post,
-          :request_body => ActiveSupport::JSON.encode(request_body),
-          :body => ActiveSupport::JSON.encode(body)
+          method: :post,
+          request_body: ActiveSupport::JSON.encode(request_body),
+          body: ActiveSupport::JSON.encode(body)
 
         fulfillment_order = ShopifyAPI::FulfillmentOrder.find(519788021)
         params = {
@@ -337,9 +337,9 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         }
         fake 'fulfillment_orders',
           url: "#{@url_prefix}/fulfillment_orders/519788021/fulfillment_request/accept.json",
-          :method => :post,
-          :request_body => ActiveSupport::JSON.encode(request_body),
-          :body => ActiveSupport::JSON.encode(fake_response)
+          method: :post,
+          request_body: ActiveSupport::JSON.encode(request_body),
+          body: ActiveSupport::JSON.encode(fake_response)
 
         accepted = fulfillment_order.accept_fulfillment_request(message: message)
 
@@ -364,9 +364,9 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         }
         fake 'fulfillment_orders',
           url: "#{@url_prefix}/fulfillment_orders/519788021/fulfillment_request/reject.json",
-          :method => :post,
-          :request_body => ActiveSupport::JSON.encode(request_body),
-          :body => ActiveSupport::JSON.encode(fake_response)
+          method: :post,
+          request_body: ActiveSupport::JSON.encode(request_body),
+          body: ActiveSupport::JSON.encode(fake_response)
 
         rejected = fulfillment_order.reject_fulfillment_request(message: message)
 
@@ -391,9 +391,9 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         cancelling['request_status'] = 'cancellation_requested'
         fake 'fulfillment_orders',
           url: "#{@url_prefix}/fulfillment_orders/519788021/cancellation_request.json",
-          :method => :post,
-          :request_body => ActiveSupport::JSON.encode(request_body),
-          :body => ActiveSupport::JSON.encode({ fulfillment_order: cancelling })
+          method: :post,
+          request_body: ActiveSupport::JSON.encode(request_body),
+          body: ActiveSupport::JSON.encode({ fulfillment_order: cancelling })
 
         cancelled = fulfillment_order.request_cancellation(message: "Cancelling this please.")
 
@@ -419,9 +419,9 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         }
         fake 'fulfillment_orders',
           url: "#{@url_prefix}/fulfillment_orders/519788021/cancellation_request/accept.json",
-          :method => :post,
-          :request_body => ActiveSupport::JSON.encode(request_body),
-          :body => ActiveSupport::JSON.encode(fake_response)
+          method: :post,
+          request_body: ActiveSupport::JSON.encode(request_body),
+          body: ActiveSupport::JSON.encode(fake_response)
 
         accepted = fulfillment_order.accept_cancellation_request(message: message)
 
@@ -447,9 +447,9 @@ class FulFillmentOrderTest < Test::Unit::TestCase
         }
         fake 'fulfillment_orders',
           url: "#{@url_prefix}/fulfillment_orders/519788021/cancellation_request/reject.json",
-          :method => :post,
-          :request_body => request_body,
-          :body => ActiveSupport::JSON.encode(fake_response)
+          method: :post,
+          request_body: request_body,
+          body: ActiveSupport::JSON.encode(fake_response)
 
         rejected = fulfillment_order.reject_cancellation_request(message: message)
 

+ 1 - 1
test/fulfillment_request_test.rb

@@ -3,7 +3,7 @@ require 'test_helper'
 class FulFillmentRequestTest < Test::Unit::TestCase
   def setup
     super
-    fake "orders/450789469/fulfillment_requests/695890229", method: :get, body: load_fixture('fulfillment_request')
+    fake("orders/450789469/fulfillment_requests/695890229", method: :get, body: load_fixture('fulfillment_request'))
   end
 
   context "#mark_as_failed" do

+ 3 - 3
test/fulfillment_service_test.rb

@@ -2,14 +2,14 @@ require 'test_helper'
 
 class FulFillmentServiceTest < Test::Unit::TestCase
 	test 'new should create fulfillment service' do
-		fake "fulfillment_services", :method => :post, :body => load_fixture('fulfillment_service')
-		fulfillment_service = ShopifyAPI::FulfillmentService.new(:name => "SomeService")
+		fake "fulfillment_services", method: :post, body: load_fixture('fulfillment_service')
+		fulfillment_service = ShopifyAPI::FulfillmentService.new(name: "SomeService")
 		fulfillment_service.save
 		assert_equal "SomeService" , fulfillment_service.name
 	end
 
 	test 'find should return the fulfillment service' do
-		fake "fulfillment_services/123456", :method => :get, :body => load_fixture('fulfillment_service')
+		fake "fulfillment_services/123456", method: :get, body: load_fixture('fulfillment_service')
 		fulfillment_service = ShopifyAPI::FulfillmentService.find(123456)
 		assert_equal 123456 , fulfillment_service.id
 		assert_equal "SomeService", fulfillment_service.name

+ 12 - 12
test/fulfillment_test.rb

@@ -6,17 +6,17 @@ class FulFillmentTest < Test::Unit::TestCase
 
   def setup
     super
-    fake "orders/450789469/fulfillments/255858046", :method => :get, :body => load_fixture('fulfillment')
+    fake("orders/450789469/fulfillments/255858046", method: :get, body: load_fixture('fulfillment'))
   end
 
   context "Fulfillment" do
     context "#complete" do
       should "be able to complete fulfillment" do
-        fulfillment = ShopifyAPI::Fulfillment.find(255858046, :params => { :order_id => 450789469 })
+        fulfillment = ShopifyAPI::Fulfillment.find(255858046, params: { order_id: 450789469 })
 
         success = ActiveSupport::JSON.decode(load_fixture('fulfillment'))
         success['fulfillment']['status'] = 'success'
-        fake "orders/450789469/fulfillments/255858046/complete", :method => :post, :body => ActiveSupport::JSON.encode(success)
+        fake "orders/450789469/fulfillments/255858046/complete", method: :post, body: ActiveSupport::JSON.encode(success)
 
         assert_equal 'pending', fulfillment.status
         assert fulfillment.complete
@@ -26,11 +26,11 @@ class FulFillmentTest < Test::Unit::TestCase
 
     context "#cancel" do
       should "be able to cancel fulfillment" do
-        fulfillment = ShopifyAPI::Fulfillment.find(255858046, :params => { :order_id => 450789469 })
+        fulfillment = ShopifyAPI::Fulfillment.find(255858046, params: { order_id: 450789469 })
 
         cancelled = ActiveSupport::JSON.decode(load_fixture('fulfillment'))
         cancelled['fulfillment']['status'] = 'cancelled'
-        fake "orders/450789469/fulfillments/255858046/cancel", :method => :post, :body => ActiveSupport::JSON.encode(cancelled)
+        fake "orders/450789469/fulfillments/255858046/cancel", method: :post, body: ActiveSupport::JSON.encode(cancelled)
 
         assert_equal 'pending', fulfillment.status
         assert fulfillment.cancel
@@ -40,11 +40,11 @@ class FulFillmentTest < Test::Unit::TestCase
 
     context "#open" do
       should "be able to open a fulfillment" do
-        fulfillment = ShopifyAPI::Fulfillment.find(255858046, :params => { :order_id => 450789469 })
+        fulfillment = ShopifyAPI::Fulfillment.find(255858046, params: { order_id: 450789469 })
 
         open_fulfillment = ActiveSupport::JSON.decode(load_fixture('fulfillment'))
         open_fulfillment['fulfillment']['status'] = 'open'
-        fake "orders/450789469/fulfillments/255858046/open", :method => :post, :body => ActiveSupport::JSON.encode(open_fulfillment)
+        fake "orders/450789469/fulfillments/255858046/open", method: :post, body: ActiveSupport::JSON.encode(open_fulfillment)
 
         assert_equal 'pending', fulfillment.status
         assert fulfillment.open
@@ -54,7 +54,7 @@ class FulFillmentTest < Test::Unit::TestCase
 
     context "#find" do
       should "be able to find fulfillment" do
-        fulfillment = ShopifyAPI::Fulfillment.find(255858046, :params => { :order_id => 450789469 })
+        fulfillment = ShopifyAPI::Fulfillment.find(255858046, params: { order_id: 450789469 })
         assert_equal 255858046, fulfillment.id
         assert_equal 450789469, fulfillment.order_id
       end
@@ -82,7 +82,7 @@ class FulFillmentTest < Test::Unit::TestCase
         url_prefix = url_prefix_for_activated_session_for('2020-01')
         fake 'fulfillments',
           url: "#{url_prefix}/fulfillments.json",
-          :method => :post,
+          method: :post,
           request_body: ActiveSupport::JSON.encode(request_body),
           body: ActiveSupport::JSON.encode(response_body)
 
@@ -113,7 +113,7 @@ class FulFillmentTest < Test::Unit::TestCase
         url_prefix = url_prefix_for_activated_session_for('2019-10')
         fake 'fulfillments',
           url: "#{url_prefix}/fulfillments.json",
-          :method => :post,
+          method: :post,
           request_body: ActiveSupport::JSON.encode(request_body),
           body: ActiveSupport::JSON.encode(response_body)
 
@@ -145,7 +145,7 @@ class FulFillmentTest < Test::Unit::TestCase
         url_prefix = url_prefix_for_activated_session_for('2020-01')
         fake 'fulfillments',
           url: "#{url_prefix}/fulfillments.json",
-          :method => :post,
+          method: :post,
           request_body: ActiveSupport::JSON.encode(request_body),
           body: ActiveSupport::JSON.encode(response_body)
 
@@ -169,7 +169,7 @@ class FulFillmentTest < Test::Unit::TestCase
         }
         request_body = { fulfillment: create_fulfillment_attributes }
         response_body = { fulfillment: create_fulfillment_attributes.merge(id: 346743624) }
-        fake "orders/#{order_id}/fulfillments", :method => :post,
+        fake "orders/#{order_id}/fulfillments", method: :post,
           request_body: ActiveSupport::JSON.encode(request_body),
           body: ActiveSupport::JSON.encode(response_body)
 

+ 2 - 2
test/fulfillment_v2_test.rb

@@ -25,11 +25,11 @@ class FulfillmentV2Test < Test::Unit::TestCase
       }
     }
     @url_prefix = url_prefix_for_activated_session_for('2020-01')
-    fake 'fulfillments',
+    fake('fulfillments',
       url: "#{@url_prefix}/fulfillments/#{@fake_fulfillment['id']}/update_tracking.json",
       method: :post,
       request_body: ActiveSupport::JSON.encode(@request_body),
-      body: ActiveSupport::JSON.encode(fulfillment: @fake_fulfillment)
+      body: ActiveSupport::JSON.encode(fulfillment: @fake_fulfillment))
   end
 
   context "FulfillmentV2" do

+ 4 - 4
test/gift_card_test.rb

@@ -7,16 +7,16 @@ class GiftCardTest < Test::Unit::TestCase
   end
 
   def test_disable
-    fake 'gift_cards/1023670/disable.json', :body => load_fixture('gift_card_disabled'), :method => :post, :extension => false
+    fake('gift_cards/1023670/disable.json', body: load_fixture('gift_card_disabled'), method: :post, extension: false)
 
-    refute @gift_card.disabled_at
+    refute(@gift_card.disabled_at)
     @gift_card.disable
-    assert @gift_card.disabled_at
+    assert(@gift_card.disabled_at)
   end
 
   private
   def load_gift_card
-    fake 'gift_cards/1023670', :body => load_fixture('gift_card')
+    fake('gift_cards/1023670', body: load_fixture('gift_card'))
     @gift_card = ShopifyAPI::GiftCard.find(1023670)
   end
 end

+ 1 - 1
test/graphql_test.rb

@@ -95,7 +95,7 @@ class GraphQLTest < Test::Unit::TestCase
 
       assert_instance_of ::GraphQL::Client, client
 
-      query = client.parse <<~GRAPHQL
+      query = client.parse(<<~GRAPHQL)
         {
           product {
             name

+ 16 - 16
test/image_test.rb

@@ -2,38 +2,38 @@ require 'test_helper'
 
 class ImageTest < Test::Unit::TestCase
   def test_create_image
-    fake "products/632910392/images", :method => :post, :body => load_fixture('image')
-    image = ShopifyAPI::Image.new(:product_id => 632910392)
+    fake("products/632910392/images", method: :post, body: load_fixture('image'))
+    image = ShopifyAPI::Image.new(product_id: 632910392)
     image.position = 1
     image.attachment = "R0lGODlhbgCMAPf/APbr48VySrxTO7IgKt2qmKQdJeK8lsFjROG5p/nz7Zg3MNmnd7Q1MLNVS9GId71hSJMZIuzTu4UtKbeEeakhKMl8U8WYjfr18YQaIbAf=="
     image.save
 
-    assert_equal 'http://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1389388540', image.src
-    assert_equal 850703190, image.id
+    assert_equal('http://cdn.shopify.com/s/files/1/0006/9093/3842/products/ipod-nano.png?v=1389388540', image.src)
+    assert_equal(850703190, image.id)
   end
 
   def test_get_images
-    fake "products/632910392/images", :method => :get, :body => load_fixture('images')
-    image = ShopifyAPI::Image.find(:all, :params => { :product_id => 632910392 })
-    assert_equal 2, image.size
+    fake("products/632910392/images", method: :get, body: load_fixture('images'))
+    image = ShopifyAPI::Image.find(:all, params: { product_id: 632910392 })
+    assert_equal(2, image.size)
   end
 
   def test_get_image
-    fake "products/632910392/images/850703190", :method => :get, :body => load_fixture('image')
-    image = ShopifyAPI::Image.find(850703190, :params => { :product_id => 632910392 })
-    assert_equal 850703190, image.id
+    fake("products/632910392/images/850703190", method: :get, body: load_fixture('image'))
+    image = ShopifyAPI::Image.find(850703190, params: { product_id: 632910392 })
+    assert_equal(850703190, image.id)
   end
 
   def test_delete_image
-    fake "products/632910392/images/850703190", :method => :get, :body => load_fixture('image')
-    fake "products/632910392/images/850703190", :method => :delete, :body => "destroyed"
-    image = ShopifyAPI::Image.find(850703190, :params => { :product_id => 632910392 })
-    assert image.destroy
+    fake("products/632910392/images/850703190", method: :get, body: load_fixture('image'))
+    fake("products/632910392/images/850703190", method: :delete, body: "destroyed")
+    image = ShopifyAPI::Image.find(850703190, params: { product_id: 632910392 })
+    assert(image.destroy)
   end
 
   def test_delete_image_without_fetching
-    fake "products/632910392/images/850703190", :method => :delete, :body => "destroyed"
+    fake("products/632910392/images/850703190", method: :delete, body: "destroyed")
     image = ShopifyAPI::Image.new(product_id: 632910392, id: 850703190)
-    assert image.destroy
+    assert(image.destroy)
   end
 end

+ 1 - 1
test/inventory_level_test.rb

@@ -3,7 +3,7 @@ require 'test_helper'
 class InventoryLevelTest < Test::Unit::TestCase
   def setup
     super
-    @inventory_level_response = ActiveSupport::JSON.decode load_fixture('inventory_level')
+    @inventory_level_response = ActiveSupport::JSON.decode(load_fixture('inventory_level'))
     @inventory_level = ShopifyAPI::InventoryLevel.new(@inventory_level_response['inventory_level'])
   end
 

+ 18 - 18
test/marketing_event_test.rb

@@ -3,54 +3,54 @@ require 'test_helper'
 class MarketingEventTest < Test::Unit::TestCase
 
   def test_get_marketing_events
-    fake "marketing_events", :method => :get, :body => load_fixture('marketing_events')
+    fake("marketing_events", method: :get, body: load_fixture('marketing_events'))
     marketing_events = ShopifyAPI::MarketingEvent.all
-    assert_equal 2, marketing_events.size
+    assert_equal(2, marketing_events.size)
   end
 
   def test_get_marketing_event
-    fake "marketing_events/1", :method => :get, :body => load_fixture('marketing_event')
+    fake("marketing_events/1", method: :get, body: load_fixture('marketing_event'))
     marketing_event = ShopifyAPI::MarketingEvent.find(1)
-    assert_equal 1, marketing_event.id
+    assert_equal(1, marketing_event.id)
   end
 
   def test_create_marketing_event
-    fake "marketing_events", :method => :post, :body => load_fixture('marketing_event')
+    fake("marketing_events", method: :post, body: load_fixture('marketing_event'))
     marketing_event = ShopifyAPI::MarketingEvent.new
     marketing_event.currency_code = 'GBP'
     marketing_event.event_target = 'facebook'
     marketing_event.event_type = 'post'
     marketing_event.save
 
-    assert_equal 'facebook', marketing_event.event_target
-    assert_equal 1, marketing_event.id
+    assert_equal('facebook', marketing_event.event_target)
+    assert_equal(1, marketing_event.id)
   end
 
   def test_delete_marketing_event
-    fake "marketing_events/1", :method => :get, :body => load_fixture('marketing_event')
-    fake "marketing_events/1", :method => :delete, :body => "destroyed"
+    fake("marketing_events/1", method: :get, body: load_fixture('marketing_event'))
+    fake("marketing_events/1", method: :delete, body: "destroyed")
     marketing_event = ShopifyAPI::MarketingEvent.find(1)
-    assert marketing_event.destroy
+    assert(marketing_event.destroy)
   end
 
   def test_update_marketing_event
-    fake 'marketing_events/1', :method => :get, :status => 200, :body => load_fixture('marketing_event')
+    fake('marketing_events/1', method: :get, status: 200, body: load_fixture('marketing_event'))
     marketing_event = ShopifyAPI::MarketingEvent.find(1)
     marketing_event.currency = 'USD'
-    fake 'marketing_events/1', :method => :put, :status => 200, :body => load_fixture('marketing_event')
-    assert marketing_event.save
+    fake('marketing_events/1', method: :put, status: 200, body: load_fixture('marketing_event'))
+    assert(marketing_event.save)
   end
 
   def test_count_marketing_events
-    fake "marketing_events/count", :method => :get, :body => '{"count": 2}'
+    fake("marketing_events/count", method: :get, body: '{"count": 2}')
     marketing_events_count = ShopifyAPI::MarketingEvent.count
-    assert_equal 2, marketing_events_count
+    assert_equal(2, marketing_events_count)
   end
 
   def test_add_engagements
-    fake "marketing_events/1", method: :get, body: load_fixture('marketing_event')
+    fake("marketing_events/1", method: :get, body: load_fixture('marketing_event'))
     marketing_event = ShopifyAPI::MarketingEvent.find(1)
-    fake "marketing_events/1/engagements", method: :post, status: 201, body: load_fixture('engagement')
+    fake("marketing_events/1/engagements", method: :post, status: 201, body: load_fixture('engagement'))
     engagement = {
       occurred_on: "2017-04-20",
       impressions_count: nil,
@@ -63,6 +63,6 @@ class MarketingEventTest < Test::Unit::TestCase
       is_cumulative: true
     }
     marketing_event.add_engagements(engagement)
-    assert "2017-04-20", engagement[:occurred_on]
+    assert("2017-04-20", engagement[:occurred_on])
   end
 end

+ 5 - 5
test/message_enricher_test.rb

@@ -5,31 +5,31 @@ class MessageEnricherTest < Test::Unit::TestCase
   def test_enriches_initial_message_when_body_contains_error
     response = enriched_response(422, 'InitialMessage', { error: 'My Error' })
 
-    assert_equal 'InitialMessage (My Error)', response.message
+    assert_equal('InitialMessage (My Error)', response.message)
   end
 
   def test_enriches_initial_message_when_body_contains_errors_array
     response = enriched_response(422, 'InitialMessage', { errors: ['My Error1', 'My Error2'] })
 
-    assert_equal 'InitialMessage (My Error1; My Error2)', response.message
+    assert_equal('InitialMessage (My Error1; My Error2)', response.message)
   end
 
   def test_enriches_initial_message_when_body_contains_errors_single_value
     response = enriched_response(422, 'InitialMessage', { errors: 'My Error1' })
 
-    assert_equal 'InitialMessage (My Error1)', response.message
+    assert_equal('InitialMessage (My Error1)', response.message)
   end
 
   def test_returns_initial_message_when_code_is_200
     response = enriched_response(200, 'InitialMessage', { result: 'Success' })
 
-    assert_equal 'InitialMessage', response.message
+    assert_equal('InitialMessage', response.message)
   end
 
   def test_returns_initial_message_when_body_cant_be_parsed
     response = enriched_response(422, 'InitialMessage', 'not a json')
 
-    assert_equal 'InitialMessage', response.message
+    assert_equal('InitialMessage', response.message)
   end
 
   private

+ 17 - 17
test/metafield_test.rb

@@ -2,44 +2,44 @@ require 'test_helper'
 
 class MetafieldTest < Test::Unit::TestCase
   def test_get_metafields
-    fake "metafields", :method => :get, :body => load_fixture('metafields')
+    fake("metafields", method: :get, body: load_fixture('metafields'))
     ShopifyAPI::Metafield.find(:all)
   end
 
   def test_get_metafield
-    fake "metafields/721389482", :method => :get, :body => load_fixture('metafield')
-    assert ShopifyAPI::Metafield.find(721389482)
+    fake("metafields/721389482", method: :get, body: load_fixture('metafield'))
+    assert(ShopifyAPI::Metafield.find(721389482))
   end
 
   def test_get_metafield_of_a_blog
-    fake "blogs/1008414260/metafields/721389482", :method => :get, :body => load_fixture('metafield')
-    metafield = ShopifyAPI::Metafield.find(721389482, :params => { :resource => "blogs", :resource_id => 1008414260 })
-    assert_equal 1008414260, metafield.prefix_options[:resource_id]
+    fake("blogs/1008414260/metafields/721389482", method: :get, body: load_fixture('metafield'))
+    metafield = ShopifyAPI::Metafield.find(721389482, params: { resource: "blogs", resource_id: 1008414260 })
+    assert_equal(1008414260, metafield.prefix_options[:resource_id])
   end
 
   def test_create_metafield_for_a_blog
-    fake "blogs/1008414260", :method => :get, :body => load_fixture('blog')
-    fake "blogs/1008414260/metafields", :method => :post, :status => 201, :body => load_fixture('metafield')
+    fake("blogs/1008414260", method: :get, body: load_fixture('blog'))
+    fake("blogs/1008414260/metafields", method: :post, status: 201, body: load_fixture('metafield'))
 
     blog = ShopifyAPI::Blog.find(1008414260)
-    metafield = blog.add_metafield(ShopifyAPI::Metafield.new(:namespace => "summaries", :key => "First Summary", :value => "Make commerce better", :value_type => "string"))
+    metafield = blog.add_metafield(ShopifyAPI::Metafield.new(namespace: "summaries", key: "First Summary", value: "Make commerce better", value_type: "string"))
 
-    assert_equal ActiveSupport::JSON.decode('{"metafield":{"namespace":"summaries","key":"First Summary","value":"Make commerce better","value_type":"string"}}'), ActiveSupport::JSON.decode(WebMock.last_request.body)
-    assert !metafield.new_record?
+    assert_equal(ActiveSupport::JSON.decode('{"metafield":{"namespace":"summaries","key":"First Summary","value":"Make commerce better","value_type":"string"}}'), ActiveSupport::JSON.decode(WebMock.last_request.body))
+    assert(!metafield.new_record?)
   end
 
   def test_update_metafield
-    fake "metafields/721389482", :method => :get, :body => load_fixture('metafield')
-    fake "metafields/721389482", :method => :put, :status => 200, :body => load_fixture('metafield')
+    fake("metafields/721389482", method: :get, body: load_fixture('metafield'))
+    fake("metafields/721389482", method: :put, status: 200, body: load_fixture('metafield'))
     metafield = ShopifyAPI::Metafield.find(721389482)
     metafield.namespace = "teaser"
-    assert metafield.save
+    assert(metafield.save)
   end
 
   def test_delete_metafield
-    fake "metafields/721389482", :method => :get, :body => load_fixture('metafield')
-    fake "metafields/721389482", :method => :delete, :body => 'destroyed'
+    fake("metafields/721389482", method: :get, body: load_fixture('metafield'))
+    fake("metafields/721389482", method: :delete, body: 'destroyed')
     metafield = ShopifyAPI::Metafield.find(721389482)
-    assert metafield.destroy
+    assert(metafield.destroy)
   end
 end

+ 16 - 16
test/order_risk_test.rb

@@ -2,8 +2,8 @@ require 'test_helper'
 
 class OrderRiskTest < Test::Unit::TestCase
   def test_create_order_risk
-    fake "orders/450789469/risks", :method => :post, :body => load_fixture('order_risk')
-    v = ShopifyAPI::OrderRisk.new(:order_id => 450789469)
+    fake("orders/450789469/risks", method: :post, body: load_fixture('order_risk'))
+    v = ShopifyAPI::OrderRisk.new(order_id: 450789469)
     v.message = "This order was placed from a proxy IP"
     v.recommendation = "cancel"
     v.score = "1.0"
@@ -13,33 +13,33 @@ class OrderRiskTest < Test::Unit::TestCase
     v.cause_cancel = true
     v.save
 
-    assert_equal 284138680, v.id
+    assert_equal(284138680, v.id)
   end
 
   def test_get_order_risks
-    fake "orders/450789469/risks", :method => :get, :body => load_fixture('order_risks')
-    v = ShopifyAPI::OrderRisk.find(:all, :params => { :order_id => 450789469 })
-    assert_equal 2, v.size
+    fake("orders/450789469/risks", method: :get, body: load_fixture('order_risks'))
+    v = ShopifyAPI::OrderRisk.find(:all, params: { order_id: 450789469 })
+    assert_equal(2, v.size)
   end
 
   def test_get_order_risk
-    fake "orders/450789469/risks/284138680", :method => :get, :body => load_fixture('order_risk')
-    v = ShopifyAPI::OrderRisk.find(284138680, :params => { :order_id => 450789469 })
-    assert_equal 284138680, v.id
+    fake("orders/450789469/risks/284138680", method: :get, body: load_fixture('order_risk'))
+    v = ShopifyAPI::OrderRisk.find(284138680, params: { order_id: 450789469 })
+    assert_equal(284138680, v.id)
   end
 
   def test_delete_order_risk
-    fake "orders/450789469/risks/284138680", :method => :get, :body => load_fixture('order_risk')
-    fake "orders/450789469/risks/284138680", :method => :delete, :body => "destroyed"
-    v = ShopifyAPI::OrderRisk.find(284138680, :params => { :order_id => 450789469 })
-    assert v.destroy
+    fake("orders/450789469/risks/284138680", method: :get, body: load_fixture('order_risk'))
+    fake("orders/450789469/risks/284138680", method: :delete, body: "destroyed")
+    v = ShopifyAPI::OrderRisk.find(284138680, params: { order_id: 450789469 })
+    assert(v.destroy)
   end
 
   def test_update_order_risk
-    fake "orders/450789469/risks/284138680", :method => :get, :body => load_fixture('order_risk')
-    fake "orders/450789469/risks/284138680", :method => :put, :body => load_fixture('order_risk')
+    fake("orders/450789469/risks/284138680", method: :get, body: load_fixture('order_risk'))
+    fake("orders/450789469/risks/284138680", method: :put, body: load_fixture('order_risk'))
 
-    v = ShopifyAPI::OrderRisk.find(284138680, :params => { :order_id => 450789469 })
+    v = ShopifyAPI::OrderRisk.find(284138680, params: { order_id: 450789469 })
     v.position = 3
     v.save
   end

+ 12 - 12
test/order_test.rb

@@ -5,55 +5,55 @@ class OrderTest < Test::Unit::TestCase
   include FulfillmentOrderTestHelper
 
   test "create should create order" do
-    fake 'orders', :method => :post, :status => 201, :body => load_fixture('order')
+    fake 'orders', method: :post, status: 201, body: load_fixture('order')
     order = ShopifyAPI::Order.create(line_items: [{ quantity:1, variant_id:39072856 }], financial_status:"authorized")
     assert_equal 39072856, order.line_items.first.variant_id
   end
 
   test "create should create an order with custom properties" do
-    props = [{ :"By default may label with \"Roasted for " => { :"Your First Name" => { :"\". If you want something specific on the label, enter it here:" => "" } } }]
-    fake 'orders', :method => :post, :status => 201, :body => load_fixture('order_with_properties')
+    props = [{ "By default may label with \"Roasted for ": { "Your First Name": { "\". If you want something specific on the label, enter it here:": "" } } }]
+    fake 'orders', method: :post, status: 201, body: load_fixture('order_with_properties')
     order = ShopifyAPI::Order.create(line_items: [{ quantity:1, variant_id:39072856, properties:props }], financial_status:"authorized")
     assert_equal 39072856, order.line_items.first.variant_id
   end
 
   test "get should get an order" do
-    fake 'orders/450789469', :method => :get, :status => 200, :body => load_fixture('order')
+    fake 'orders/450789469', method: :get, status: 200, body: load_fixture('order')
     order = ShopifyAPI::Order.find(450789469)
     assert_equal 450789469, order.id
   end
 
   test "get should get an order with custom properties" do
-    fake 'orders/450789469', :method => :get, :status => 200, :body => load_fixture('order_with_properties')
+    fake 'orders/450789469', method: :get, status: 200, body: load_fixture('order_with_properties')
     order = ShopifyAPI::Order.find(450789469)
     assert_equal 450789469, order.id
   end
 
   test "get all should get all orders" do
-    fake 'orders', :method => :get, :status => 200, :body => load_fixture('orders')
+    fake 'orders', method: :get, status: 200, body: load_fixture('orders')
     order = ShopifyAPI::Order.all
     assert_equal 450789469, order.first.id
   end
 
   test "add note should add a note to order" do
-    fake 'orders/450789469', :method => :get, :status => 200, :body => load_fixture('order')
+    fake 'orders/450789469', method: :get, status: 200, body: load_fixture('order')
     order = ShopifyAPI::Order.find(450789469)
     order.note = "Test note"
-    fake 'orders/450789469', :method => :put, :status => 200, :body => load_fixture('order')
+    fake 'orders/450789469', method: :put, status: 200, body: load_fixture('order')
     order.save
     assert_equal "Test note", order.note
   end
 
   test "delete should delete an order" do
-    fake 'orders/450789469', :method => :get, :status => 200, :body => load_fixture('order')
-    fake 'orders/450789469', :method => :delete, :body => 'destroyed'
+    fake 'orders/450789469', method: :get, status: 200, body: load_fixture('order')
+    fake 'orders/450789469', method: :delete, body: 'destroyed'
     order = ShopifyAPI::Order.find(450789469)
     assert order.destroy
   end
 
   test "cancel an order with params" do
-    fake 'orders/450789469', :method => :get, :status => 200, :body => load_fixture('order')
-    fake 'orders/450789469/cancel', :method => :post, :body => load_fixture('order')
+    fake 'orders/450789469', method: :get, status: 200, body: load_fixture('order')
+    fake 'orders/450789469/cancel', method: :post, body: load_fixture('order')
     order = ShopifyAPI::Order.find(450789469)
     order.cancel(email: false, restock: true)
     assert_request_body({ 'email' => false, 'restock' => true }.to_json)

+ 17 - 17
test/pagination_test.rb

@@ -16,7 +16,7 @@ class PaginationTest < Test::Unit::TestCase
   test "navigates using next and previous link headers with no original params" do
     link_header ="#{@previous_link_header}, #{@next_link_header}"
 
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: link_header
     orders = ShopifyAPI::Order.all
 
     fake(
@@ -68,7 +68,7 @@ class PaginationTest < Test::Unit::TestCase
   end
 
   test "returns empty next page if just the previous page is present" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => @previous_link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: @previous_link_header
     orders = ShopifyAPI::Order.all
 
     next_page = orders.fetch_next_page
@@ -76,7 +76,7 @@ class PaginationTest < Test::Unit::TestCase
   end
 
   test "returns an empty previous page if just the next page is present" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => @next_link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: @next_link_header
     orders = ShopifyAPI::Order.all
 
     next_page = orders.fetch_previous_page
@@ -84,63 +84,63 @@ class PaginationTest < Test::Unit::TestCase
   end
 
   test "#next_page? returns true if next page is present" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => @next_link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: @next_link_header
     orders = ShopifyAPI::Order.all
 
     assert orders.next_page?
   end
 
   test "#next_page? returns false if next page is not present" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => @previous_link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: @previous_link_header
     orders = ShopifyAPI::Order.all
 
     refute orders.next_page?
   end
 
   test "#next_page_info returns next_page_info if next page is present" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => @next_link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: @next_link_header
     orders = ShopifyAPI::Order.all
 
     assert_equal @next_page_info, orders.next_page_info
   end
 
   test "#next_page_info returns nil if next page is not present" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => @previous_link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: @previous_link_header
     orders = ShopifyAPI::Order.all
 
     assert_nil orders.next_page_info
   end
 
   test "#previous_page? returns true if previous page is present" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => @previous_link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: @previous_link_header
     orders = ShopifyAPI::Order.all
 
     assert orders.previous_page?
   end
 
   test "#previous_page? returns false if next page is not present" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => @next_link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: @next_link_header
     orders = ShopifyAPI::Order.all
 
     refute orders.previous_page?
   end
 
   test "#previous_page_info returns previous_page_info if next page is present" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => @previous_link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: @previous_link_header
     orders = ShopifyAPI::Order.all
 
     assert_equal @previous_page_info, orders.previous_page_info
   end
 
   test "#previous_page_info returns nil if next page is not present" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => @next_link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: @next_link_header
     orders = ShopifyAPI::Order.all
 
     assert_nil orders.previous_page_info
   end
 
   test "pagination handles no link headers" do
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders')
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders')
     orders = ShopifyAPI::Order.all
 
     refute orders.next_page?
@@ -151,7 +151,7 @@ class PaginationTest < Test::Unit::TestCase
 
   test "raises on invalid pagination links" do
     link_header = "<https://this-is-my-test-shop.myshopify.com/admin/api/2019-10/orders.json?page_info=#{@next_page_info}>;"
-    fake 'orders', :method => :get, :status => 200, api_version: @version, :body => load_fixture('orders'), :link => link_header
+    fake 'orders', method: :get, status: 200, api_version: @version, body: load_fixture('orders'), link: link_header
 
     assert_raises ShopifyAPI::InvalidPaginationLinksError do
       ShopifyAPI::Order.all
@@ -162,7 +162,7 @@ class PaginationTest < Test::Unit::TestCase
     version = ShopifyAPI::ApiVersion.find_version('2019-04')
     ShopifyAPI::Base.api_version = version.to_s
 
-    fake 'orders', :method => :get, :status => 200, api_version: version, :body => load_fixture('orders')
+    fake 'orders', method: :get, status: 200, api_version: version, body: load_fixture('orders')
     orders = ShopifyAPI::Order.all
 
     assert_raises NotImplementedError do
@@ -174,7 +174,7 @@ class PaginationTest < Test::Unit::TestCase
     version = ShopifyAPI::ApiVersion.find_version('2019-07')
     ShopifyAPI::Base.api_version = version.to_s
 
-    fake 'orders', :method => :get, :status => 200, api_version: version, :body => load_fixture('orders')
+    fake 'orders', method: :get, status: 200, api_version: version, body: load_fixture('orders')
     orders = ShopifyAPI::Order.all
 
     assert_raises NotImplementedError do
@@ -186,7 +186,7 @@ class PaginationTest < Test::Unit::TestCase
     version = ShopifyAPI::ApiVersion.find_version('2019-07')
     ShopifyAPI::Base.api_version = version.to_s
 
-    fake 'events', :method => :get, :status => 200, api_version: version, :body => load_fixture('events')
+    fake 'events', method: :get, status: 200, api_version: version, body: load_fixture('events')
     events = ShopifyAPI::Event.all
 
     assert_empty events.fetch_next_page
@@ -200,7 +200,7 @@ class PaginationTest < Test::Unit::TestCase
 
     link_header ="#{@previous_link_header}, #{@next_link_header}"
 
-    fake 'orders', :method => :get, :status => 200, api_version: version, :body => load_fixture('orders'), :link => link_header
+    fake 'orders', method: :get, status: 200, api_version: version, body: load_fixture('orders'), link: link_header
     orders = ShopifyAPI::Order.all
 
     fake(

+ 5 - 5
test/policy_test.rb

@@ -3,17 +3,17 @@ require 'test_helper'
 class PolicyTest < Test::Unit::TestCase
   def setup
     super
-    fake 'shop'
+    fake('shop')
   end
 
   def test_getting_the_list_of_policies
-    fake 'policies'
+    fake('policies')
 
     policies = ShopifyAPI::Policy.all
-    assert_equal 1, policies.length
+    assert_equal(1, policies.length)
 
     policy = policies.first
-    assert_equal 'Privacy Policy', policy.title
-    assert_equal 'Your privacy is important to us', policy.body
+    assert_equal('Privacy Policy', policy.title)
+    assert_equal('Your privacy is important to us', policy.body)
   end
 end

+ 14 - 14
test/price_rule_test.rb

@@ -3,35 +3,35 @@ require 'test_helper'
 class PriceRuleTest < Test::Unit::TestCase
   def setup
     super
-    fake 'price_rules/102586120', body: load_fixture('price_rule')
+    fake('price_rules/102586120', body: load_fixture('price_rule'))
 
     @price_rule = ShopifyAPI::PriceRule.find(102586120)
   end
 
   def test_get_price_rule
-    fake 'price_rules/102586120', method: :get, status: 200, body: load_fixture('price_rule')
+    fake('price_rules/102586120', method: :get, status: 200, body: load_fixture('price_rule'))
     price_rule = ShopifyAPI::PriceRule.find(102586120)
 
-    assert_equal 102586120, price_rule.id
+    assert_equal(102586120, price_rule.id)
   end
 
   def test_get_all_price_rules
-    fake 'price_rules', method: :get, status: 200, body: load_fixture('price_rules')
+    fake('price_rules', method: :get, status: 200, body: load_fixture('price_rules'))
     price_rules = ShopifyAPI::PriceRule.all
 
-    assert_equal 1, price_rules.length
-    assert_equal 102586120, price_rules.first.id
+    assert_equal(1, price_rules.length)
+    assert_equal(102586120, price_rules.first.id)
   end
 
   def test_get_all_discount_codes_for_a_price_rule
-    fake 'price_rules/102586120/discount_codes', method: :get, status: 200, body: load_fixture('discount_codes')
+    fake('price_rules/102586120/discount_codes', method: :get, status: 200, body: load_fixture('discount_codes'))
     price_rule = ShopifyAPI::PriceRule.find(102586120)
 
-    assert_equal "SUMMERSALE10", price_rule.discount_codes.first.code
+    assert_equal("SUMMERSALE10", price_rule.discount_codes.first.code)
   end
 
   def test_create_price_rule
-    fake 'price_rules', method: :post, status: 201, body: load_fixture('price_rule')
+    fake('price_rules', method: :post, status: 201, body: load_fixture('price_rule'))
 
     price_rule = ShopifyAPI::PriceRule.create(
       target_type: "line_item",
@@ -42,7 +42,7 @@ class PriceRuleTest < Test::Unit::TestCase
       starts_at: "2017-01-19T00:00:00Z"
     )
 
-    assert_equal '{"price_rule":{"target_type":"line_item","allocation_method":"across","value_type":"fixed_amount","value":-10.0,"customer_selection":"all","starts_at":"2017-01-19T00:00:00Z"}}', WebMock.last_request.body
+    assert_equal('{"price_rule":{"target_type":"line_item","allocation_method":"across","value_type":"fixed_amount","value":-10.0,"customer_selection":"all","starts_at":"2017-01-19T00:00:00Z"}}', WebMock.last_request.body)
     assert_equal(-10, price_rule.value)
   end
 
@@ -50,16 +50,16 @@ class PriceRuleTest < Test::Unit::TestCase
     price_rule_response = ActiveSupport::JSON.decode(load_fixture('price_rule'))
     price_rule_response['price_rule']['value'] = -50.0
     @price_rule.value = -50.0
-    fake 'price_rules/102586120', method: :put, status: 200, body: ActiveSupport::JSON.encode(price_rule_response)
+    fake('price_rules/102586120', method: :put, status: 200, body: ActiveSupport::JSON.encode(price_rule_response))
 
     @price_rule.save
 
-    assert_equal price_rule_response['price_rule']['value'], @price_rule.value
+    assert_equal(price_rule_response['price_rule']['value'], @price_rule.value)
   end
 
   def test_delete_price_rule
-    fake 'price_rules/102586120', method: :delete, body: 'destroyed'
+    fake('price_rules/102586120', method: :delete, body: 'destroyed')
 
-    assert @price_rule.destroy
+    assert(@price_rule.destroy)
   end
 end

+ 19 - 19
test/product_listing_test.rb

@@ -3,39 +3,39 @@ require 'test_helper'
 class ProductListingTest < Test::Unit::TestCase
 
   def test_get_product_listings
-    fake "product_listings", method: :get, status: 201, body: load_fixture('product_listings')
+    fake("product_listings", method: :get, status: 201, body: load_fixture('product_listings'))
 
     product_listings = ShopifyAPI::ProductListing.find(:all)
-    assert_equal 2, product_listings.count
-    assert_equal 2, product_listings.first.product_id
-    assert_equal 1, product_listings.last.product_id
-    assert_equal 'Synergistic Silk Chair', product_listings.first.title
-    assert_equal 'Rustic Copper Bottle', product_listings.last.title
+    assert_equal(2, product_listings.count)
+    assert_equal(2, product_listings.first.product_id)
+    assert_equal(1, product_listings.last.product_id)
+    assert_equal('Synergistic Silk Chair', product_listings.first.title)
+    assert_equal('Rustic Copper Bottle', product_listings.last.title)
   end
 
   def test_get_product_listing
-    fake "product_listings/2", method: :get, status: 201, body: load_fixture('product_listing')
+    fake("product_listings/2", method: :get, status: 201, body: load_fixture('product_listing'))
 
     product_listing = ShopifyAPI::ProductListing.find(2)
-    assert_equal 'Synergistic Silk Chair', product_listing.title
+    assert_equal('Synergistic Silk Chair', product_listing.title)
   end
 
   def test_reload_product_listing
-    fake "product_listings/2", method: :get, status: 201, body: load_fixture('product_listing')
+    fake("product_listings/2", method: :get, status: 201, body: load_fixture('product_listing'))
 
     product_listing = ShopifyAPI::ProductListing.new(product_id: 2)
     product_listing.reload
 
-    assert_equal 'Synergistic Silk Chair', product_listing.title
+    assert_equal('Synergistic Silk Chair', product_listing.title)
   end
 
   def test_get_product_listing_product_ids
-    fake "product_listings/product_ids", method: :get, status: 201, body: load_fixture('product_listing_product_ids')
+    fake("product_listings/product_ids", method: :get, status: 201, body: load_fixture('product_listing_product_ids'))
 
     product_ids = ShopifyAPI::ProductListing.product_ids
-    assert_equal 2, product_ids.count
-    assert_equal 4, product_ids.first
-    assert_equal 3, product_ids.last
+    assert_equal(2, product_ids.count)
+    assert_equal(4, product_ids.first)
+    assert_equal(3, product_ids.last)
   end
 
   def test_get_product_listing_product_ids_multi_page_with_cursor
@@ -58,8 +58,8 @@ class ProductListingTest < Test::Unit::TestCase
     )
 
     product_ids = ShopifyAPI::ProductListing.product_ids
-    assert_equal [4, 3], product_ids
-    assert product_ids.next_page?
+    assert_equal([4, 3], product_ids)
+    assert(product_ids.next_page?)
 
     fake(
       "product_listings/product_ids",
@@ -71,7 +71,7 @@ class ProductListingTest < Test::Unit::TestCase
     )
 
     next_page = product_ids.fetch_next_page
-    assert_equal [2, 1], next_page
+    assert_equal([2, 1], next_page)
   end
 
   def test_get_product_listing_product_ids_multi_page_with_cursor_fails_on_older_api_version
@@ -89,8 +89,8 @@ class ProductListingTest < Test::Unit::TestCase
     )
 
     product_ids = ShopifyAPI::ProductListing.product_ids
-    assert_equal [4, 3], product_ids
-    assert_raises NotImplementedError do
+    assert_equal([4, 3], product_ids)
+    assert_raises(NotImplementedError) do
       product_ids.next_page?
     end
   end

+ 8 - 8
test/product_publication_test.rb

@@ -3,23 +3,23 @@ require 'test_helper'
 
 class ProductPublicationTest < Test::Unit::TestCase
   def test_get_all_product_publications
-    fake 'publications/55650051/product_publications', body: load_fixture('product_publications')
+    fake('publications/55650051/product_publications', body: load_fixture('product_publications'))
     product_publications = ShopifyAPI::ProductPublication.find(:all, params: { publication_id: 55650051 })
 
-    assert_equal 647162527768, product_publications.first.id
-    assert_equal 55650051, product_publications.first.publication_id
+    assert_equal(647162527768, product_publications.first.id)
+    assert_equal(55650051, product_publications.first.publication_id)
   end
 
   def test_get_product_publication
-    fake 'publications/55650051/product_publications/647162527768', body: load_fixture('product_publication')
+    fake('publications/55650051/product_publications/647162527768', body: load_fixture('product_publication'))
     product_publication = ShopifyAPI::ProductPublication.find(647162527768, params: { publication_id: 55650051 })
 
-    assert_equal 647162527768, product_publication.id
-    assert_equal 55650051, product_publication.publication_id
+    assert_equal(647162527768, product_publication.id)
+    assert_equal(55650051, product_publication.publication_id)
   end
 
   def test_create_product_publication
-    fake 'publications/55650051/product_publications', method: :post, body: load_fixture('product_publication')
+    fake('publications/55650051/product_publications', method: :post, body: load_fixture('product_publication'))
     ShopifyAPI::ProductPublication.create(
       publication_id: 55650051,
       published_at: "2018-01-29T14:06:08-05:00",
@@ -35,6 +35,6 @@ class ProductPublicationTest < Test::Unit::TestCase
       },
     }.to_json
 
-    assert_equal expected_body, WebMock.last_request.body
+    assert_equal(expected_body, WebMock.last_request.body)
   end
 end

+ 22 - 22
test/product_test.rb

@@ -8,39 +8,39 @@ class ProductTest < Test::Unit::TestCase
   end
 
   def test_add_metafields_to_product
-    fake "products/632910392/metafields", :method => :post, :status => 201, :body => load_fixture('metafield')
-
-    field = @product.add_metafield(ShopifyAPI::Metafield.new(:namespace => "contact", :key => "email", :value => "123@example.com", :value_type => "string"))
-    assert_equal ActiveSupport::JSON.decode('{"metafield":{"namespace":"contact","key":"email","value":"123@example.com","value_type":"string"}}'), ActiveSupport::JSON.decode(WebMock.last_request.body)
-    assert !field.new_record?
-    assert_equal "contact", field.namespace
-    assert_equal "email", field.key
-    assert_equal "123@example.com", field.value
+    fake("products/632910392/metafields", method: :post, status: 201, body: load_fixture('metafield'))
+
+    field = @product.add_metafield(ShopifyAPI::Metafield.new(namespace: "contact", key: "email", value: "123@example.com", value_type: "string"))
+    assert_equal(ActiveSupport::JSON.decode('{"metafield":{"namespace":"contact","key":"email","value":"123@example.com","value_type":"string"}}'), ActiveSupport::JSON.decode(WebMock.last_request.body))
+    assert(!field.new_record?)
+    assert_equal("contact", field.namespace)
+    assert_equal("email", field.key)
+    assert_equal("123@example.com", field.value)
   end
 
   def test_get_all_metafields_for_product
-    fake "products/632910392/metafields", :body => load_fixture('metafields')
+    fake("products/632910392/metafields", body: load_fixture('metafields'))
 
     metafields = @product.metafields
 
-    assert_equal 3, metafields.length
-    assert metafields.all? { |m| m.is_a? ShopifyAPI::Metafield }
+    assert_equal(3, metafields.length)
+    assert(metafields.all? { |m| m.is_a?(ShopifyAPI::Metafield) })
   end
 
   def test_get_2_metafields_for_product
-    body = ActiveSupport::JSON.decode load_fixture 'metafields'
-    body['metafields'].slice! 2, 1
+    body = ActiveSupport::JSON.decode(load_fixture('metafields'))
+    body['metafields'].slice!(2, 1)
 
-    fake 'products/632910392/metafields.json?limit=2', body: body.to_json, extension: false
+    fake('products/632910392/metafields.json?limit=2', body: body.to_json, extension: false)
 
-    metafields = @product.metafields limit: 2
+    metafields = @product.metafields(limit: 2)
 
-    assert_equal 2, metafields.length
-    assert metafields.all? { |m| m.is_a? ShopifyAPI::Metafield }
+    assert_equal(2, metafields.length)
+    assert(metafields.all? { |m| m.is_a?(ShopifyAPI::Metafield) })
   end
 
   def test_update_loaded_variant
-    fake "products/632910392/variants/808950810", :method => :put, :status => 200, :body => load_fixture('variant')
+    fake("products/632910392/variants/808950810", method: :put, status: 200, body: load_fixture('variant'))
 
     variant = @product.variants.first
     variant.price = "0.50"
@@ -62,7 +62,7 @@ class ProductTest < Test::Unit::TestCase
     refresh_product(api_version: ShopifyAPI::Base.api_version)
 
     variant = @product.variants.first
-    assert variant.as_json.include?('inventory_quantity')
+    assert(variant.as_json.include?('inventory_quantity'))
   end
 
   def test_deprecated_variant_inventory_fields_are_removed_in_2020_01
@@ -70,14 +70,14 @@ class ProductTest < Test::Unit::TestCase
     refresh_product(api_version: ShopifyAPI::Base.api_version)
 
     variant = @product.variants.first
-    refute variant.as_json.include?('inventory_quantity')
+    refute(variant.as_json.include?('inventory_quantity'))
   end
 
   def test_deprecated_inventory_fields_are_removed_in_2020_01
     ShopifyAPI::Base.api_version = '2020-01'
     refresh_product(api_version: ShopifyAPI::Base.api_version)
 
-    refute @product.as_json.include?('total_inventory')
+    refute(@product.as_json.include?('total_inventory'))
   end
 
   def test_setting_product_total_inventory_passes_in_api_before_2019_10
@@ -105,7 +105,7 @@ class ProductTest < Test::Unit::TestCase
   private
 
   def refresh_product(api_version: nil)
-    fake "products/632910392", :body => load_fixture('product'), api_version: api_version
+    fake("products/632910392", body: load_fixture('product'), api_version: api_version)
     @product = ShopifyAPI::Product.find(632910392)
   end
 end

+ 3 - 3
test/publication_test.rb

@@ -3,10 +3,10 @@ require 'test_helper'
 
 class PublicationTest < Test::Unit::TestCase
   def test_find_all_publications
-    fake 'publications'
+    fake('publications')
     publications = ShopifyAPI::Publication.find(:all)
 
-    assert_equal 55650051, publications.first.id
-    assert_equal "Buy Button", publications.first.name
+    assert_equal(55650051, publications.first.id)
+    assert_equal("Buy Button", publications.first.name)
   end
 end

+ 41 - 41
test/recurring_application_charge_test.rb

@@ -3,7 +3,7 @@ require 'test_helper'
 class RecurringApplicationChargeTest < Test::Unit::TestCase
 
   def test_recurring_application_charges_create
-    fake "recurring_application_charges", method: :post, status: 201, body: load_fixture('recurring_application_charge')
+    fake("recurring_application_charges", method: :post, status: 201, body: load_fixture('recurring_application_charge'))
 
     charge = ShopifyAPI::RecurringApplicationCharge.create(
       name: "Default Plan",
@@ -11,132 +11,132 @@ class RecurringApplicationChargeTest < Test::Unit::TestCase
       return_url: "http://test.com/confirm"
     )
 
-    assert_equal 'http://apple.myshopify.com/admin/charges/654381177/confirm_recurring_application_charge?signature=BAhpBHkQASc%3D--419fc7424f8c290ac2b21b9004ed223e35b52164', charge.confirmation_url
+    assert_equal('http://apple.myshopify.com/admin/charges/654381177/confirm_recurring_application_charge?signature=BAhpBHkQASc%3D--419fc7424f8c290ac2b21b9004ed223e35b52164', charge.confirmation_url)
   end
 
   def test_get_recurring_application_charges
-    fake "recurring_application_charges/654381177", method: :get, status: 201, body: load_fixture('recurring_application_charge')
+    fake("recurring_application_charges/654381177", method: :get, status: 201, body: load_fixture('recurring_application_charge'))
 
     charge = ShopifyAPI::RecurringApplicationCharge.find(654381177)
 
-    assert_equal "Super Duper Plan", charge.name
+    assert_equal("Super Duper Plan", charge.name)
   end
 
   def test_list_recurring_application_charges
-    fake "recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges')
+    fake("recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges'))
 
     charge = ShopifyAPI::RecurringApplicationCharge.find(:all)
 
-    assert_equal "Super Mega Plan", charge.last.name
+    assert_equal("Super Mega Plan", charge.last.name)
   end
 
   def test_list_since_recurring_application_charges
-    fake "recurring_application_charges.json?since_id=64512345",extension: false, method: :get, status: 201, body: load_fixture('recurring_application_charges')
+    fake("recurring_application_charges.json?since_id=64512345",extension: false, method: :get, status: 201, body: load_fixture('recurring_application_charges'))
 
     charge = ShopifyAPI::RecurringApplicationCharge.find(:all, params: { since_id: '64512345' })
 
-    assert_equal "Super Mega Plan", charge.last.name
+    assert_equal("Super Mega Plan", charge.last.name)
   end
 
   def test_list_fields_recurring_application_charges
-    fake "recurring_application_charges.json?fields=name",extension: false, method: :get, status: 201, body: load_fixture('recurring_application_charges')
+    fake("recurring_application_charges.json?fields=name",extension: false, method: :get, status: 201, body: load_fixture('recurring_application_charges'))
 
     charge = ShopifyAPI::RecurringApplicationCharge.find(:all, params: { fields: 'name' })
 
-    assert_equal "Super Mega Plan", charge.last.name
+    assert_equal("Super Mega Plan", charge.last.name)
   end
 
   def test_pending_recurring_application_charge
-    fake "recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges')
+    fake("recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges'))
 
     charge = ShopifyAPI::RecurringApplicationCharge.pending
 
-    assert_equal "Super Mega Plan2", charge.last.name
+    assert_equal("Super Mega Plan2", charge.last.name)
   end
 
   def test_cancelled_recurring_application_charge
-    fake "recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges')
+    fake("recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges'))
 
     charge = ShopifyAPI::RecurringApplicationCharge.cancelled
 
-    assert_equal "Super Mega Plan3", charge.last.name
+    assert_equal("Super Mega Plan3", charge.last.name)
   end
 
   def test_accepted_recurring_application_charge
-    fake "recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges')
+    fake("recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges'))
 
     charge = ShopifyAPI::RecurringApplicationCharge.accepted
 
-    assert_equal "Super Mega Plan4", charge.first.name
-    assert_equal "Super Mega Plan", charge.last.name
+    assert_equal("Super Mega Plan4", charge.first.name)
+    assert_equal("Super Mega Plan", charge.last.name)
   end
 
   def test_declined_recurring_application_charge
-    fake "recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges')
+    fake("recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges'))
 
     charge = ShopifyAPI::RecurringApplicationCharge.declined
 
-    assert_equal "Super Mega Plan5", charge.last.name
+    assert_equal("Super Mega Plan5", charge.last.name)
   end
 
   def test_activate_recurring_application_charge
-    fake "recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges')
-    fake "recurring_application_charges/455696199/activate", method: :post, status: 200, body: "{}"
+    fake("recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges'))
+    fake("recurring_application_charges/455696199/activate", method: :post, status: 200, body: "{}")
 
     charge = ShopifyAPI::RecurringApplicationCharge.accepted
 
-    assert charge.last.activate
+    assert(charge.last.activate)
   end
 
   def test_adjust_recurring_application_charge
-    fake "recurring_application_charges/654381177", method: :get, status: 201, body: load_fixture('recurring_application_charge')
-    fake "recurring_application_charges/654381177/customize.json?recurring_application_charge%5Bcapped_amount%5D=200", method: :put, body: load_fixture('recurring_application_charge_adjustment'), extension: false
+    fake("recurring_application_charges/654381177", method: :get, status: 201, body: load_fixture('recurring_application_charge'))
+    fake("recurring_application_charges/654381177/customize.json?recurring_application_charge%5Bcapped_amount%5D=200", method: :put, body: load_fixture('recurring_application_charge_adjustment'), extension: false)
 
     charge = ShopifyAPI::RecurringApplicationCharge.find(654381177)
 
-    assert charge.customize(capped_amount: 200)
+    assert(charge.customize(capped_amount: 200))
   end
 
   def test_cancel_recurring_application_charge
-    fake "recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges')
-    fake "recurring_application_charges/455696194", method: :delete, status: 200, body: "{}"
+    fake("recurring_application_charges", method: :get, status: 201, body: load_fixture('recurring_application_charges'))
+    fake("recurring_application_charges/455696194", method: :delete, status: 200, body: "{}")
 
     charge = ShopifyAPI::RecurringApplicationCharge.current
-    assert charge.cancel
+    assert(charge.cancel)
   end
 
   def test_usage_charges_recurring_application_charge_found
-    fake "recurring_application_charges/654381177", method: :get, status: 201, body: load_fixture('recurring_application_charge')
-    fake "recurring_application_charges/654381177/usage_charges", method: :get, status: 201, body: load_fixture('usage_charges')
+    fake("recurring_application_charges/654381177", method: :get, status: 201, body: load_fixture('recurring_application_charge'))
+    fake("recurring_application_charges/654381177/usage_charges", method: :get, status: 201, body: load_fixture('usage_charges'))
 
     charge = ShopifyAPI::RecurringApplicationCharge.find(654381177)
     usage_charges = charge.usage_charges
 
-    assert_equal 2, usage_charges.length
+    assert_equal(2, usage_charges.length)
   end
 
   def test_usage_charges_recurring_application_charge_not_found
-    fake "recurring_application_charges/654381177", method: :get, status: 201, body: load_fixture('recurring_application_charge')
-    fake "recurring_application_charges/654381177/usage_charges", method: :get, status: 201, body: "[]"
+    fake("recurring_application_charges/654381177", method: :get, status: 201, body: load_fixture('recurring_application_charge'))
+    fake("recurring_application_charges/654381177/usage_charges", method: :get, status: 201, body: "[]")
 
     charge = ShopifyAPI::RecurringApplicationCharge.find(654381177)
     usage_charges = charge.usage_charges
 
-    assert_equal 0, usage_charges.length
+    assert_equal(0, usage_charges.length)
   end
 
   def test_no_recurring_application_charge_found
-    fake "recurring_application_charges", body: { recurring_application_charges: [] }.to_json
+    fake("recurring_application_charges", body: { recurring_application_charges: [] }.to_json)
 
-    assert_equal 0, ShopifyAPI::RecurringApplicationCharge.all.count
-    assert_nil ShopifyAPI::RecurringApplicationCharge.current
-    assert_equal [], ShopifyAPI::RecurringApplicationCharge.pending
+    assert_equal(0, ShopifyAPI::RecurringApplicationCharge.all.count)
+    assert_nil(ShopifyAPI::RecurringApplicationCharge.current)
+    assert_equal([], ShopifyAPI::RecurringApplicationCharge.pending)
   end
 
   def test_recurring_application_charge_not_found_error
-    fake "recurring_application_charges", body: '{"errors":"Not Found"}', status: 404
-    assert_nil ShopifyAPI::RecurringApplicationCharge.all
-    assert_nil ShopifyAPI::RecurringApplicationCharge.current
+    fake("recurring_application_charges", body: '{"errors":"Not Found"}', status: 404)
+    assert_nil(ShopifyAPI::RecurringApplicationCharge.all)
+    assert_nil(ShopifyAPI::RecurringApplicationCharge.current)
     assert_equal([], ShopifyAPI::RecurringApplicationCharge.pending)
   end
 end

+ 2 - 2
test/redirect_test.rb

@@ -2,8 +2,8 @@ require 'test_helper'
 
 class RedirectTest < Test::Unit::TestCase
   test "#create should create a redirect" do
-    fake "redirects", :method => :post, :status => 201, :body => load_fixture('redirect')
-    redirect = ShopifyAPI::Redirect.create(:path => "/ipod", :target => "/pages/itunes")
+    fake "redirects", method: :post, status: 201, body: load_fixture('redirect')
+    redirect = ShopifyAPI::Redirect.create(path: "/ipod", target: "/pages/itunes")
     assert_equal 979034150, redirect.id
   end
 end

+ 12 - 12
test/refund_test.rb

@@ -3,29 +3,29 @@ require 'test_helper'
 class RefundTest < Test::Unit::TestCase
 
   test '#create should create a refund' do
-    fake "orders/450789469/refunds", :method => :post, :status => 201, :body => load_fixture('refund')
+    fake "orders/450789469/refunds", method: :post, status: 201, body: load_fixture('refund')
     refund = ShopifyAPI::Refund.create(
-      :order_id => 450789469,
-      :restock => true,
-      :note => "wrong size",
-      :shipping => { :full_refund => true },
-      :refund_line_items => [{ :line_item_id => 518995019, :quantity => 1 }]
+      order_id: 450789469,
+      restock: true,
+      note: "wrong size",
+      shipping: { full_refund: true },
+      refund_line_items: [{ line_item_id: 518995019, quantity: 1 }]
     )
     assert_equal 703073504, refund.refund_line_items.first.line_item_id
   end
 
   test '#find should return a refund' do
-    fake "orders/450789469/refunds/509562969.json?order_id=450789469", :extension => false, :method => :get, :body => load_fixture('refund')
-    fake "orders/450789469/refunds/509562969", :method => :get, :body => load_fixture('refund')
-    refund = ShopifyAPI::Refund.find(509562969, :params => { :order_id => 450789469 })
+    fake "orders/450789469/refunds/509562969.json?order_id=450789469", extension: false, method: :get, body: load_fixture('refund')
+    fake "orders/450789469/refunds/509562969", method: :get, body: load_fixture('refund')
+    refund = ShopifyAPI::Refund.find(509562969, params: { order_id: 450789469 })
     assert_equal 509562969, refund.id
   end
 
   test '#calculate a refund' do
-    fake "orders/450789469/refunds/calculate", :method => :post, :body => load_fixture('refund')
-    data = { :shipping => { :amount => 0 } }
+    fake "orders/450789469/refunds/calculate", method: :post, body: load_fixture('refund')
+    data = { shipping: { amount: 0 } }
 
-    refund = ShopifyAPI::Refund.calculate(data, :params => { :order_id => 450789469 })
+    refund = ShopifyAPI::Refund.calculate(data, params: { order_id: 450789469 })
     assert_equal 2, refund.refund_line_items.count
     assert_equal 703073504, refund.refund_line_items.first.line_item_id
   end

+ 11 - 11
test/resource_feedback_test.rb

@@ -1,41 +1,41 @@
 class ResourceFeedbackTest < Test::Unit::TestCase
   def test_get_resource_feedback
     body = { resource_feedback: [ { resource_type: 'Shop' } ] }.to_json
-    fake 'resource_feedback', method: :get, body: body
+    fake('resource_feedback', method: :get, body: body)
     resource_feedback = ShopifyAPI::ResourceFeedback.find(:all)
-    assert_equal 'Shop', resource_feedback.first.resource_type
+    assert_equal('Shop', resource_feedback.first.resource_type)
   end
 
   def test_save_with_resource_feedback_endpoint
     body = { resource_feedback: {} }.to_json
-    fake 'resource_feedback', method: :post, body: body
+    fake('resource_feedback', method: :post, body: body)
     ShopifyAPI::ResourceFeedback.new.save
-    assert_request_body body
+    assert_request_body(body)
   end
 
   def test_get_resource_feedback_with_product_id
     body = { resource_feedback: [ { resource_type: 'Product' } ] }.to_json
-    fake 'products/42/resource_feedback', method: :get, body: body
+    fake('products/42/resource_feedback', method: :get, body: body)
     resource_feedback = ShopifyAPI::ResourceFeedback.find(:all, params: { product_id: 42 })
-    assert_equal 'Product', resource_feedback.first.resource_type
+    assert_equal('Product', resource_feedback.first.resource_type)
   end
 
   def test_save_with_product_id_resource_feedback_endpoint
     body = { resource_feedback: {} }.to_json
-    fake 'products/42/resource_feedback', method: :post, body: body
+    fake('products/42/resource_feedback', method: :post, body: body)
     ShopifyAPI::ResourceFeedback.new(product_id: 42).save
-    assert_request_body body
+    assert_request_body(body)
   end
 
   def test_save_raises_exception_when_already_persisted
     body = { resource_feedback: {} }.to_json
-    fake 'resource_feedback', method: :post, body: body
+    fake('resource_feedback', method: :post, body: body)
     resource_feedback = ShopifyAPI::ResourceFeedback.new
     resource_feedback.save
-    assert_request_body body
+    assert_request_body(body)
 
     ShopifyAPI::ResourceFeedback.any_instance.expects(:persisted?).returns(true)
-    assert_raises ShopifyAPI::ResourceFeedback::ExistingFeedbackSaved do
+    assert_raises(ShopifyAPI::ResourceFeedback::ExistingFeedbackSaved) do
       resource_feedback.save
     end
   end

+ 5 - 5
test/script_tag_test.rb

@@ -2,28 +2,28 @@ require 'test_helper'
 
 class ScriptTagTest < Test::Unit::TestCase
   test "get all should get all script tags" do
-    fake 'script_tags', :method => :get, :status => 200, :body => load_fixture('script_tags')
+    fake 'script_tags', method: :get, status: 200, body: load_fixture('script_tags')
     script_tags = ShopifyAPI::ScriptTag.all
     assert_equal "http://js-aplenty.com/bar.js", script_tags.first.src
   end
 
   test "get should get a script tag" do
-    fake 'script_tags/421379493', :method => :get, :status => 200, :body => load_fixture('script_tag')
+    fake 'script_tags/421379493', method: :get, status: 200, body: load_fixture('script_tag')
     script_tag = ShopifyAPI::ScriptTag.find(421379493)
     assert_equal "http://js-aplenty.com/bar.js", script_tag.src
   end
 
   test "create should create a new script tag" do
-    fake 'script_tags', :method => :post, :status => 201, :body => load_fixture('script_tag')
+    fake 'script_tags', method: :post, status: 201, body: load_fixture('script_tag')
     script_tag = ShopifyAPI::ScriptTag.create(event: "onload", src: "http://js-aplenty.com/bar.js")
     assert_equal "http://js-aplenty.com/bar.js", script_tag.src
   end
 
   test "editing script tag should update script tag" do
-    fake 'script_tags/421379493', :method => :get, :status => 200, :body => load_fixture('script_tag')
+    fake 'script_tags/421379493', method: :get, status: 200, body: load_fixture('script_tag')
     script_tag = ShopifyAPI::ScriptTag.find(421379493)
     script_tag.src = "http://js-aplenty.com/bar.js"
-    fake 'script_tags/421379493', :method => :put, :status => 200, :body => load_fixture('script_tag')
+    fake 'script_tags/421379493', method: :put, status: 200, body: load_fixture('script_tag')
     script_tag.save
     assert_equal "http://js-aplenty.com/bar.js", script_tag.src
   end

+ 6 - 6
test/session_test.rb

@@ -86,7 +86,7 @@ class SessionTest < Test::Unit::TestCase
   end
 
   test "setup api_key and secret for all sessions" do
-    ShopifyAPI::Session.setup(:api_key => "My test key", :secret => "My test secret")
+    ShopifyAPI::Session.setup(api_key: "My test key", secret: "My test secret")
     assert_equal "My test key", ShopifyAPI::Session.api_key
     assert_equal "My test secret", ShopifyAPI::Session.secret
   end
@@ -254,7 +254,7 @@ class SessionTest < Test::Unit::TestCase
   end
 
   test "raise exception if code invalid in request token" do
-    ShopifyAPI::Session.setup(:api_key => "My test key", :secret => "My test secret")
+    ShopifyAPI::Session.setup(api_key: "My test key", secret: "My test secret")
     session = ShopifyAPI::Session.new(
       domain: 'http://localhost.myshopify.com',
       token: nil,
@@ -337,22 +337,22 @@ class SessionTest < Test::Unit::TestCase
   end
 
   test "raise error if signature does not match expected" do
-    params = { :code => "any-code", :timestamp => Time.now }
+    params = { code: "any-code", timestamp: Time.now }
     signature = generate_signature(params)
     params[:foo] = 'world'
     assert_raises(ShopifyAPI::ValidationException) do
       session = ShopifyAPI::Session.new(domain: "testshop.myshopify.com", token: nil, api_version: any_api_version)
-      session.request_token(params.merge(:hmac => signature))
+      session.request_token(params.merge(hmac: signature))
     end
   end
 
   test "raise error if timestamp is too old" do
-    params = { :code => "any-code", :timestamp => Time.now - 2.days }
+    params = { code: "any-code", timestamp: Time.now - 2.days }
     signature = generate_signature(params)
     params[:foo] = 'world'
     assert_raises(ShopifyAPI::ValidationException) do
       session = ShopifyAPI::Session.new(domain: "testshop.myshopify.com", token: nil, api_version: any_api_version)
-      session.request_token(params.merge(:hmac => signature))
+      session.request_token(params.merge(hmac: signature))
     end
   end
 

+ 1 - 1
test/shipping_zone_test.rb

@@ -2,7 +2,7 @@ require 'test_helper'
 
 class ShippingZoneTest < Test::Unit::TestCase
   test "get all should get all shipping zones" do
-    fake 'shipping_zones', :method => :get, :status => 200, :body => load_fixture('shipping_zones')
+    fake 'shipping_zones', method: :get, status: 200, body: load_fixture('shipping_zones')
     checkout = ShopifyAPI::ShippingZone.all
     assert_equal 1, checkout.first.id
     assert_equal "Canada", checkout.first.name

+ 31 - 31
test/shop_test.rb

@@ -3,66 +3,66 @@ require 'test_helper'
 class ShopTest < Test::Unit::TestCase
   def setup
     super
-    fake "shop"
+    fake("shop")
     @shop = ShopifyAPI::Shop.current
   end
 
   def test_current_should_return_current_shop
-    assert @shop.is_a?(ShopifyAPI::Shop)
-    assert_equal "Apple Computers", @shop.name
-    assert_equal "apple.myshopify.com", @shop.myshopify_domain
-    assert_equal 690933842, @shop.id
-    assert_equal "2007-12-31T19:00:00-05:00", @shop.created_at
-    assert_nil @shop.tax_shipping
+    assert(@shop.is_a?(ShopifyAPI::Shop))
+    assert_equal("Apple Computers", @shop.name)
+    assert_equal("apple.myshopify.com", @shop.myshopify_domain)
+    assert_equal(690933842, @shop.id)
+    assert_equal("2007-12-31T19:00:00-05:00", @shop.created_at)
+    assert_nil(@shop.tax_shipping)
   end
 
   def test_current_with_options_should_return_current_shop
-    fake "shop.json?fields%5B%5D=name&fields%5B%5D=myshopify_domain", :extension => false, :method => :get, :status => 201, :body => load_fixture('shop')
+    fake("shop.json?fields%5B%5D=name&fields%5B%5D=myshopify_domain", extension: false, method: :get, status: 201, body: load_fixture('shop'))
 
     @shop = ShopifyAPI::Shop.current(params: { fields: [:name, :myshopify_domain] })
-    assert @shop.is_a?(ShopifyAPI::Shop)
-    assert_equal "Apple Computers", @shop.name
-    assert_equal "apple.myshopify.com", @shop.myshopify_domain
+    assert(@shop.is_a?(ShopifyAPI::Shop))
+    assert_equal("Apple Computers", @shop.name)
+    assert_equal("apple.myshopify.com", @shop.myshopify_domain)
   end
 
   def test_get_all_metafields_for_shop
-    fake "metafields"
+    fake("metafields")
 
     metafields = @shop.metafields
 
-    assert_equal 3, metafields.length
-    assert metafields.all? { |m| m.is_a?(ShopifyAPI::Metafield) }
+    assert_equal(3, metafields.length)
+    assert(metafields.all? { |m| m.is_a?(ShopifyAPI::Metafield) })
   end
 
   def test_get_2_metafields_for_shop
-    body = ActiveSupport::JSON.decode load_fixture 'metafields'
-    body['metafields'].slice! 2, 1
+    body = ActiveSupport::JSON.decode(load_fixture('metafields'))
+    body['metafields'].slice!(2, 1)
 
-    fake 'metafields.json?limit=2', body: body.to_json, extension: false
+    fake('metafields.json?limit=2', body: body.to_json, extension: false)
 
-    metafields = @shop.metafields limit: 2
+    metafields = @shop.metafields(limit: 2)
 
-    assert_equal 2, metafields.length
-    assert metafields.all? { |m| m.is_a? ShopifyAPI::Metafield }
+    assert_equal(2, metafields.length)
+    assert(metafields.all? { |m| m.is_a?(ShopifyAPI::Metafield) })
   end
 
   def test_add_metafield
-    fake "metafields", :method => :post, :status => 201, :body =>load_fixture('metafield')
-
-    field = @shop.add_metafield(ShopifyAPI::Metafield.new(:namespace => "contact", :key => "email", :value => "123@example.com", :value_type => "string"))
-    assert_equal ActiveSupport::JSON.decode('{"metafield":{"namespace":"contact","key":"email","value":"123@example.com","value_type":"string"}}'), ActiveSupport::JSON.decode(WebMock.last_request.body)
-    assert !field.new_record?
-    assert_equal "contact", field.namespace
-    assert_equal "email", field.key
-    assert_equal "123@example.com", field.value
+    fake("metafields", method: :post, status: 201, body: load_fixture('metafield'))
+
+    field = @shop.add_metafield(ShopifyAPI::Metafield.new(namespace: "contact", key: "email", value: "123@example.com", value_type: "string"))
+    assert_equal(ActiveSupport::JSON.decode('{"metafield":{"namespace":"contact","key":"email","value":"123@example.com","value_type":"string"}}'), ActiveSupport::JSON.decode(WebMock.last_request.body))
+    assert(!field.new_record?)
+    assert_equal("contact", field.namespace)
+    assert_equal("email", field.key)
+    assert_equal("123@example.com", field.value)
   end
 
   def test_events
-    fake "events"
+    fake("events")
 
     events = @shop.events
 
-    assert_equal 3, events.length
-    assert events.all? { |m| m.is_a?(ShopifyAPI::Event) }
+    assert_equal(3, events.length)
+    assert(events.all? { |m| m.is_a?(ShopifyAPI::Event) })
   end
 end

+ 3 - 3
test/smart_collection_test.rb

@@ -2,9 +2,9 @@ require 'test_helper'
 
 class SmartCollectionTest < Test::Unit::TestCase
   test "Smart Collection creation" do
-    fake "smart_collections", :method => :post, :status => 201, :body => load_fixture('smart_collection')
-    rules = { :column => "title", :relation => "starts_with", :condition => "mac" }
-    smart_collection = ShopifyAPI::SmartCollection.create(:title => "Macbooks", :rules => rules)
+    fake "smart_collections", method: :post, status: 201, body: load_fixture('smart_collection')
+    rules = { column: "title", relation: "starts_with", condition: "mac" }
+    smart_collection = ShopifyAPI::SmartCollection.create(title: "Macbooks", rules: rules)
     assert_equal 1063001432, smart_collection.id
   end
 end

+ 12 - 12
test/storefront_access_token_test.rb

@@ -3,30 +3,30 @@ require 'test_helper'
 class StorefrontAccessTokenTest < Test::Unit::TestCase
 
   def test_create_storefront_access_token
-    fake "storefront_access_tokens", :method => :post, :body => load_fixture('storefront_access_token')
+    fake("storefront_access_tokens", method: :post, body: load_fixture('storefront_access_token'))
     storefront_access_token = ShopifyAPI::StorefrontAccessToken.create(title: 'Test')
-    assert_equal 1, storefront_access_token.id
-    assert_equal "Test", storefront_access_token.title
+    assert_equal(1, storefront_access_token.id)
+    assert_equal("Test", storefront_access_token.title)
   end
 
   def test_delete_storefront_access_token
-    fake 'storefront_access_tokens/1', method: :get, status: 200, body: load_fixture('storefront_access_token')
-    fake 'storefront_access_tokens/1', method: :delete, status: 200, body: 'destroyed'
+    fake('storefront_access_tokens/1', method: :get, status: 200, body: load_fixture('storefront_access_token'))
+    fake('storefront_access_tokens/1', method: :delete, status: 200, body: 'destroyed')
     
     storefront_access_tokens = ShopifyAPI::StorefrontAccessToken.find(1)
-    assert storefront_access_tokens.destroy
+    assert(storefront_access_tokens.destroy)
   end
 
   def test_get_storefront_access_tokens
-    fake "storefront_access_tokens", method: :get, status: 201, body: load_fixture('storefront_access_tokens')
+    fake("storefront_access_tokens", method: :get, status: 201, body: load_fixture('storefront_access_tokens'))
 
     tokens = ShopifyAPI::StorefrontAccessToken.all
 
-    assert_equal 2, tokens.size
-    assert_equal 1, tokens.first.id
-    assert_equal 2, tokens.last.id
-    assert_equal 'Test 1', tokens.first.title
-    assert_equal 'Test 2', tokens.last.title
+    assert_equal(2, tokens.size)
+    assert_equal(1, tokens.first.id)
+    assert_equal(2, tokens.last.id)
+    assert_equal('Test 1', tokens.first.title)
+    assert_equal('Test 2', tokens.last.title)
   end
 
 end

+ 2 - 2
test/tax_service_test.rb

@@ -1,8 +1,8 @@
 require 'test_helper'
 class TaxServiceTest < Test::Unit::TestCase
   test "tax service creation" do
-    fake "tax_services", :method => :post, :status => 202, :body => load_fixture('tax_service')
-    ShopifyAPI::TaxService.create(:name => "My Tax Service", :url => "https://mytaxservice.com")
+    fake "tax_services", method: :post, status: 202, body: load_fixture('tax_service')
+    ShopifyAPI::TaxService.create(name: "My Tax Service", url: "https://mytaxservice.com")
     assert_equal '{"tax_service":{"name":"My Tax Service","url":"https://mytaxservice.com"}}', WebMock.last_request.body
 
   end

+ 1 - 1
test/tender_transaction_test.rb

@@ -5,7 +5,7 @@ require 'test_helper'
 class TenderTransactionTest < Test::Unit::TestCase
   def setup
     super
-    fake "tender_transactions", method: :get, body: load_fixture('tender_transactions')
+    fake("tender_transactions", method: :get, body: load_fixture('tender_transactions'))
   end
 
   context "Tender Transaction" do

+ 4 - 4
test/test_helper.rb

@@ -69,7 +69,7 @@ module Test
 
       # Custom Assertions
       def assert_not(expression)
-        refute expression, "Expected <#{expression}> to be false!"
+        refute(expression, "Expected <#{expression}> to be false!")
       end
 
       def assert_nothing_raised
@@ -77,11 +77,11 @@ module Test
       end
 
       def assert_not_includes(array, value)
-        refute array.include?(value)
+        refute(array.include?(value))
       end
 
       def assert_includes(array, value)
-        assert array.include?(value)
+        assert(array.include?(value))
       end
 
       def load_fixture(name, format = :json)
@@ -89,7 +89,7 @@ module Test
       end
 
       def assert_request_body(expected)
-        assert_equal expected, WebMock.last_request.body
+        assert_equal(expected, WebMock.last_request.body)
       end
 
       def fake(endpoint, options = {})

+ 2 - 2
test/transaction_test.rb

@@ -3,13 +3,13 @@ require 'test_helper'
 class TransactionTest < Test::Unit::TestCase
   def setup
     super
-    fake "orders/450789469/transactions/389404469", :method => :get, :body => load_fixture('transaction')
+    fake("orders/450789469/transactions/389404469", method: :get, body: load_fixture('transaction'))
   end
 
   context "Transaction" do
     context "#find" do
       should "find a specific transaction" do
-        transaction = ShopifyAPI::Transaction.find(389404469, :params => { :order_id => 450789469 })
+        transaction = ShopifyAPI::Transaction.find(389404469, params: { order_id: 450789469 })
         assert_equal "409.94", transaction.amount
       end
     end

+ 4 - 4
test/usage_charge_test.rb

@@ -3,19 +3,19 @@ require 'test_helper'
 class UsageChargeTest < Test::Unit::TestCase
 
   def test_create_usage_charges
-    fake "recurring_application_charges/654381177/usage_charges", method: :post, body: load_fixture('usage_charge')
+    fake("recurring_application_charges/654381177/usage_charges", method: :post, body: load_fixture('usage_charge'))
 
     usage_charge = ShopifyAPI::UsageCharge.new(description: '1000 emails', price: 1.0)
     usage_charge.prefix_options = { recurring_application_charge_id: 654381177 }
-    assert usage_charge.save
+    assert(usage_charge.save)
   end
 
   def test_get_usage_charges
-    fake "recurring_application_charges/654381177/usage_charges/359376002", method: :get, status: 201, body: load_fixture('usage_charge')
+    fake("recurring_application_charges/654381177/usage_charges/359376002", method: :get, status: 201, body: load_fixture('usage_charge'))
 
     usage_charge = ShopifyAPI::UsageCharge.find(359376002, params: { recurring_application_charge_id: 654381177 })
 
-    assert_equal "1000 emails", usage_charge.description
+    assert_equal("1000 emails", usage_charge.description)
   end
 
 end

+ 13 - 13
test/variant_test.rb

@@ -7,43 +7,43 @@ class VariantTest < Test::Unit::TestCase
   end
 
   def test_get_variants
-    fake "products/632910392/variants", :method => :get, :body => load_fixture('variants')
+    fake("products/632910392/variants", method: :get, body: load_fixture('variants'))
 
-    variants = ShopifyAPI::Variant.find(:all, :params => { :product_id => 632910392 })
-    assert_equal variants.map(&:id).sort, [39072856, 49148385, 457924702, 808950810]
+    variants = ShopifyAPI::Variant.find(:all, params: { product_id: 632910392 })
+    assert_equal(variants.map(&:id).sort, [39072856, 49148385, 457924702, 808950810])
   end
 
   def test_get_variant_namespaced
-    assert_equal 632910392, @variant.product_id
+    assert_equal(632910392, @variant.product_id)
   end
 
   def test_get_variant
-    assert_equal 632910392, @variant.product_id
+    assert_equal(632910392, @variant.product_id)
   end
 
   def test_product_id_should_be_accessible_if_via_product_endpoint
-    assert_equal 632910392, @variant.product_id
+    assert_equal(632910392, @variant.product_id)
   end
 
   def test_product_id_should_be_accessible_if_via_variant_endpoint
-    assert_equal 632910392, @variant.product_id
+    assert_equal(632910392, @variant.product_id)
   end
 
   def test_delete_variant
-    fake "products/632910392/variants/808950810", :method => :delete, :body => 'destroyed'
-    assert @variant.destroy
+    fake("products/632910392/variants/808950810", method: :delete, body: 'destroyed')
+    assert(@variant.destroy)
   end
 
   def test_deprecated_inventory_fields_are_included_in_2019_07
     ShopifyAPI::Base.api_version = '2019-07'
     refresh_variant(api_version: ShopifyAPI::Base.api_version)
-    assert @variant.as_json.include?('inventory_quantity')
+    assert(@variant.as_json.include?('inventory_quantity'))
   end
 
   def test_deprecated_inventory_fields_are_removed_in_2020_01
     ShopifyAPI::Base.api_version = '2020-01'
     refresh_variant(api_version: ShopifyAPI::Base.api_version)
-    refute @variant.as_json.include?('inventory_quantity')
+    refute(@variant.as_json.include?('inventory_quantity'))
   end
 
   def test_setting_variant_inventory_quantity_adjustment_passes_in_api_before_2019_10
@@ -108,7 +108,7 @@ class VariantTest < Test::Unit::TestCase
   private
 
   def refresh_variant(api_version: nil)
-    fake "products/632910392/variants/808950810", method: :get, body: load_fixture('variant'), api_version: api_version
-    @variant = ShopifyAPI::Variant.find(808950810, :params => { :product_id => 632910392 })
+    fake("products/632910392/variants/808950810", method: :get, body: load_fixture('variant'), api_version: api_version)
+    @variant = ShopifyAPI::Variant.find(808950810, params: { product_id: 632910392 })
   end
 end

+ 3 - 3
test/webhook_test.rb

@@ -2,19 +2,19 @@ require 'test_helper'
 
 class WebhookTest < Test::Unit::TestCase
   test 'create should create a webhook' do
-    fake 'webhooks', :method => :post, :status => 201, :body => load_fixture('webhook')
+    fake 'webhooks', method: :post, status: 201, body: load_fixture('webhook')
     webhook = ShopifyAPI::Webhook.create(address: "http://www.yoloship.it/webhook", topic: "orders/create", format: "json")
     assert_equal "http://www.yoloship.it/webhook", webhook.address
   end
 
   test 'get should retrieve a webhook' do
-    fake 'webhooks/123456', :method => :get, :status => 200, :body => load_fixture('webhook')
+    fake 'webhooks/123456', method: :get, status: 200, body: load_fixture('webhook')
     webhook = ShopifyAPI::Webhook.find(123456)
     assert_equal "http://www.yoloship.it/webhook", webhook.address
   end
 
   test 'find all should return all webhooks' do
-    fake 'webhooks', :method => :get, :status => 200, :body => load_fixture('webhooks')
+    fake 'webhooks', method: :get, status: 200, body: load_fixture('webhooks')
     webhook = ShopifyAPI::Webhook.all
     assert_equal 123456, webhook.first.id
   end