Sha256: b8368fc8cc1d36e705615c38d1aca9e0532a4c29995413b85e2dd0286171aa4b

Contents?: true

Size: 926 Bytes

Versions: 93

Compression:

Stored size: 926 Bytes

Contents

shared_examples_for 'JSON-like adapter' do |adapter|
  before{ MultiJson.use adapter }

  describe '.dump' do
    before{ MultiJson.dump_options = MultiJson.adapter.dump_options = nil }

    describe 'with :pretty option set to true' do
      it 'passes default pretty options' do
        object = 'foo'
        expect(object).to receive(:to_json).with(JSON::PRETTY_STATE_PROTOTYPE.to_h)
        MultiJson.dump(object, :pretty => true)
      end
    end

    describe 'with :indent option' do
      it 'passes it on dump' do
        object = 'foo'
        expect(object).to receive(:to_json).with(:indent => "\t")
        MultiJson.dump(object, :indent => "\t")
      end
    end
  end

  describe '.load' do
    it 'passes :quirks_mode option' do
      expect(::JSON).to receive(:parse).with('[123]', {:quirks_mode => false, :create_additions => false})
      MultiJson.load('[123]', :quirks_mode => false)
    end
  end
end

Version data entries

93 entries across 85 versions & 8 rubygems

Version Path
multi_json-1.8.3 spec/shared/json_common_adapter.rb
plyom_user-0.1.8 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.1.7 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.1.6 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.1.5 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.1.4 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.1.3 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.1.2 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.1.1 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.1.0 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.0.9 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.0.8 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.0.7 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.0.6 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.0.5 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.0.4 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.0.3 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
plyom_user-0.0.2 vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb
scout-5.8.0.pre vendor/multi_json/spec/json_common_shared_example.rb
multi_json-1.8.2 spec/shared/json_common_adapter.rb