Sha256: 9e4ac5299721c8df949d2df9a0b7598b7479db97d84d6bd44efe9c39336961a6

Contents?: true

Size: 856 Bytes

Versions: 22

Compression:

Stored size: 856 Bytes

Contents

require 'spec_helper'

describe Postmark::Json do
  let(:data) { {"bar" => "foo", "foo" => "bar"} }

  shared_examples "json parser" do
    it 'encodes and decodes data correctly' do
      hash = Postmark::Json.decode(Postmark::Json.encode(data))
      expect(hash).to have_key("bar")
      expect(hash).to have_key("foo")
    end
  end

  context "given response parser is JSON" do
    before do
      Postmark.response_parser_class = :Json
    end

    it_behaves_like "json parser"
  end

  context "given response parser is ActiveSupport::JSON" do
    before do
      Postmark.response_parser_class = :ActiveSupport
    end

    it_behaves_like "json parser"
  end

  context "given response parser is Yajl", :skip_for_platform => 'java' do
    before do
      Postmark.response_parser_class = :Yajl
    end

    it_behaves_like "json parser"
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
postmark-1.25.1 spec/unit/postmark/json_spec.rb
postmark-1.25.0 spec/unit/postmark/json_spec.rb
postmark-1.24.1 spec/unit/postmark/json_spec.rb
postmark-1.24.0 spec/unit/postmark/json_spec.rb
postmark-1.23.0 spec/unit/postmark/json_spec.rb
postmark-1.22.3 spec/unit/postmark/json_spec.rb
postmark-1.22.2 spec/unit/postmark/json_spec.rb
postmark-1.22.1 spec/unit/postmark/json_spec.rb
postmark-1.22.0 spec/unit/postmark/json_spec.rb
postmark-1.21.8 spec/unit/postmark/json_spec.rb
postmark-1.21.7 spec/unit/postmark/json_spec.rb
postmark-1.21.6 spec/unit/postmark/json_spec.rb
postmark-1.21.5 spec/unit/postmark/json_spec.rb
postmark-1.21.4 spec/unit/postmark/json_spec.rb
postmark-1.21.3 spec/unit/postmark/json_spec.rb
postmark-1.21.2 spec/unit/postmark/json_spec.rb
postmark-1.21.1 spec/unit/postmark/json_spec.rb
postmark-1.21.0 spec/unit/postmark/json_spec.rb
postmark-1.20.0 spec/unit/postmark/json_spec.rb
postmark-1.19.2 spec/unit/postmark/json_spec.rb