Sha256: 33e10828792d9dd14be461c72e62f574c971e846b132773c3222d3f96b36a6e3
Contents?: true
Size: 900 Bytes
Versions: 2
Compression:
Stored size: 900 Bytes
Contents
require 'test_helper' class MessageEnricherTest < Test::Unit::TestCase def test_enriches_initial_message_when_body_is_passed response = enriched_response(422, 'InitialMessage', { error: 'My Error' }) assert_equal 'InitialMessage (My Error)', response.message end def test_returns_initial_message_when_code_is_200 response = enriched_response(200, 'InitialMessage', { result: 'Success' }) 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 end private def enriched_response(code, message, body) mock_response = Struct .new(:code, :message, :body) .new(code.to_s, message.to_s, body.to_json) ShopifyAPI::MessageEnricher.new(mock_response) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shopify_api-9.0.0 | test/message_enricher_test.rb |
shopify_api-8.1.0 | test/message_enricher_test.rb |