Sha256: fd75514700afacca26199016253d4ad1778d75d1760fe34d9ddde0022b970fa6

Contents?: true

Size: 1.05 KB

Versions: 95

Compression:

Stored size: 1.05 KB

Contents

shared_examples_for 'JSON-like adapter' do |adapter|
  before do
    begin
      MultiJson.use adapter
    rescue LoadError
      pending "Adapter #{adapter} couldn't be loaded (not installed?)"
    end
  end

  describe '.dump' do
    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).and_return('["foo"]')
        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").and_return('["foo"]')
        MultiJson.dump(object, :indent => "\t")
      end
    end
  end

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

Version data entries

95 entries across 93 versions & 7 rubygems

Version Path
engineyard-serverside-2.8.0 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.8.0.pre4 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.8.0.pre3 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.8.0.pre2 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.8.0.pre lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.7.0.pre lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.19 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.17 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.16 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.15.alpha1 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.15.cf2 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.15.pre lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.14 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.13 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.12 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.12.prewut5 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.12.prewut4 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.12.prewut3 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.12.prewut2 lib/vendor/multi_json/spec/json_common_shared_example.rb
engineyard-serverside-2.6.12.prewut1 lib/vendor/multi_json/spec/json_common_shared_example.rb