Sha256: 541f3178739f50d272c0bc05dbc82a6119f5978bb04dd6aa683a0053d379be78

Contents?: true

Size: 618 Bytes

Versions: 49

Compression:

Stored size: 618 Bytes

Contents

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

49 entries across 49 versions & 1 rubygems

Version Path
shopify_api-9.2.0 test/active_resource/json_errors_test.rb
shopify_api-9.1.0 test/active_resource/json_errors_test.rb
shopify_api-9.0.4 test/active_resource/json_errors_test.rb
shopify_api-9.0.3 test/active_resource/json_errors_test.rb
shopify_api-9.0.2 test/active_resource/json_errors_test.rb
shopify_api-9.0.1 test/active_resource/json_errors_test.rb
shopify_api-9.0.0 test/active_resource/json_errors_test.rb
shopify_api-8.1.0 test/active_resource/json_errors_test.rb
shopify_api-8.0.0 test/active_resource/json_errors_test.rb
shopify_api-7.1.0 test/active_resource/json_errors_test.rb
shopify_api-7.0.2 test/active_resource/json_errors_test.rb
shopify_api-7.0.1 test/active_resource/json_errors_test.rb
shopify_api-7.0.0 test/active_resource/json_errors_test.rb
shopify_api-6.0.0 test/active_resource/json_errors_test.rb
shopify_api-5.2.4 test/active_resource/json_errors_test.rb
shopify_api-5.2.3 test/active_resource/json_errors_test.rb
shopify_api-5.2.2 test/active_resource/json_errors_test.rb
shopify_api-5.2.1 test/active_resource/json_errors_test.rb
shopify_api-5.2.0 test/active_resource/json_errors_test.rb
shopify_api-5.1.0 test/active_resource/json_errors_test.rb