Sha256: db96fad1dae0f01749e09e23d353706ee37ddbea4257c341a71809c6b5b2907e

Contents?: true

Size: 914 Bytes

Versions: 24

Compression:

Stored size: 914 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'
        object.should_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'
        object.should_receive(:to_json).with(:indent => "\t")
        MultiJson.dump(object, :indent => "\t")
      end
    end
  end

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

Version data entries

24 entries across 23 versions & 7 rubygems

Version Path
challah-1.0.0 vendor/bundle/gems/multi_json-1.7.7/spec/json_common_shared_example.rb
swipe-rails-0.0.5 vendor/bundle/gems/multi_json-1.7.7/spec/json_common_shared_example.rb
multi_json-1.7.7 spec/json_common_shared_example.rb
multi_json-1.7.6 spec/json_common_shared_example.rb
multi_json-1.7.5 spec/json_common_shared_example.rb
multi_json-1.7.4 spec/json_common_shared_example.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/multi_json-1.7.2/spec/json_common_shared_example.rb
vagrant-shell-0.2.6 vendor/bundle/gems/multi_json-1.7.2/spec/json_common_shared_example.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/multi_json-1.7.2/spec/json_common_shared_example.rb
challah-1.0.0.beta3 vendor/bundle/gems/multi_json-1.7.3/spec/json_common_shared_example.rb
challah-1.0.0.beta3 vendor/bundle/gems/multi_json-1.7.2/spec/json_common_shared_example.rb
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/multi_json-1.7.3/spec/json_common_shared_example.rb
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/multi_json-1.7.3/spec/json_common_shared_example.rb
vagrant-shell-0.2.5 vendor/bundle/gems/multi_json-1.7.2/spec/json_common_shared_example.rb
multi_json-1.7.3 spec/json_common_shared_example.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/multi_json-1.7.2/spec/json_common_shared_example.rb
challah-1.0.0.beta2 vendor/bundle/gems/multi_json-1.7.2/spec/json_common_shared_example.rb
challah-1.0.0.beta vendor/bundle/gems/multi_json-1.7.2/spec/json_common_shared_example.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/multi_json-1.7.2/spec/json_common_shared_example.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/multi_json-1.7.2/spec/json_common_shared_example.rb