Sha256: 0e50ce876941d68f1177dfa81b5471d32828e2a3d6e728eb69d2b9497c243c00

Contents?: true

Size: 656 Bytes

Versions: 9

Compression:

Stored size: 656 Bytes

Contents

# frozen_string_literal: true
require 'test_helper'

module ActiveResource
  class JsonErrorsTest < Test::Unit::TestCase
    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])
    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)
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
shopify_api-9.5.2 test/active_resource/json_errors_test.rb
ruby_shopify_api-1.2.0 test/active_resource/json_errors_test.rb
ruby_shopify_api-1.1.0 test/active_resource/json_errors_test.rb
ruby_shopify_api-1.0.0 test/active_resource/json_errors_test.rb
shopify_api-9.5.1 test/active_resource/json_errors_test.rb
shopify_api-9.5 test/active_resource/json_errors_test.rb
shopify_api-9.4.1 test/active_resource/json_errors_test.rb
shopify_api-9.4.0 test/active_resource/json_errors_test.rb
shopify_api-9.3.0 test/active_resource/json_errors_test.rb