test/unit/peddler/test_client.rb in peddler-1.2.0 vs test/unit/peddler/test_client.rb in peddler-1.3.0

- old
+ new

@@ -49,15 +49,15 @@ def test_inherits_parents_parser assert_equal @klass.parser, Class.new(@klass).parser end def test_params_include_seller_id - assert @klass.params.key?("SellerId") + assert @klass.params.key?('SellerId') end def test_params_include_auth_token - @klass.params.key?("MWSAuthToken") + @klass.params.key?('MWSAuthToken') end def test_configures @client.configure do |config| config.aws_access_key_id = '123' @@ -112,25 +112,27 @@ @client.run(&streamer) assert_equal @body, chunks end - def test_request_preserves_user_agent - instrumentor = Class.new - class << instrumentor + class Instrumentor + class << self attr_accessor :events def instrument(name, params = {}) events.update(name => params) yield if block_given? end end - instrumentor.events = {} - @client.defaults.update(instrumentor: instrumentor) + @events = {} + end + + def test_request_preserves_user_agent + @client.defaults.update(instrumentor: Instrumentor) @client.run - headers = instrumentor.events['excon.request'][:headers] + headers = Instrumentor.events['excon.request'][:headers] assert headers.key?('User-Agent') end def test_error_callback_on_class @@ -212,10 +214,10 @@ Excon.stubs.clear end def test_deprecated_marketplace_id_accessor refute_nil @client.marketplace_id - @client.marketplace_id = "123" - assert_equal "123", @client.marketplace_id + @client.marketplace_id = '123' + assert_equal '123', @client.marketplace_id assert_equal @client.primary_marketplace_id, @client.marketplace_id end end