Sha256: 308edbae68486f8f3ce30b22695feb6be4f207194615fb773934cdace9fe7a6f

Contents?: true

Size: 848 Bytes

Versions: 31

Compression:

Stored size: 848 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))
      hash.should have_key("bar")
      hash.should 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

31 entries across 31 versions & 1 rubygems

Version Path
postmark-1.18.0 spec/unit/postmark/json_spec.rb
postmark-1.17.0 spec/unit/postmark/json_spec.rb
postmark-1.16.0 spec/unit/postmark/json_spec.rb
postmark-1.15.0 spec/unit/postmark/json_spec.rb
postmark-1.14.0 spec/unit/postmark/json_spec.rb
postmark-1.13.0 spec/unit/postmark/json_spec.rb
postmark-1.12.0 spec/unit/postmark/json_spec.rb
postmark-1.11.0 spec/unit/postmark/json_spec.rb
postmark-1.10.0 spec/unit/postmark/json_spec.rb
postmark-1.9.1 spec/unit/postmark/json_spec.rb
postmark-1.9.0 spec/unit/postmark/json_spec.rb
postmark-1.8.1 spec/unit/postmark/json_spec.rb
postmark-1.8.0 spec/unit/postmark/json_spec.rb
postmark-1.7.1 spec/unit/postmark/json_spec.rb
postmark-1.7.0 spec/unit/postmark/json_spec.rb
postmark-1.6.0 spec/unit/postmark/json_spec.rb
postmark-1.5.0 spec/unit/postmark/json_spec.rb
postmark-1.4.3 spec/unit/postmark/json_spec.rb
postmark-1.4.2 spec/unit/postmark/json_spec.rb
postmark-1.4.1 spec/unit/postmark/json_spec.rb