Sha256: 8f7295054755133ba66bb6fca869971ebb9ce2ada8bd01909c9fc28a6bf5918a

Contents?: true

Size: 579 Bytes

Versions: 4

Compression:

Stored size: 579 Bytes

Contents

require 'rest-core/test'

describe RC::JsonDecode do
  before do
    @app = RC::JsonDecode.new(RC::Dry.new, true)
  end

  should 'do nothing' do
    @app.call({}).should.eq(RC::RESPONSE_BODY => nil)
  end

  should 'decode sync' do
    @app.call(RC::RESPONSE_BODY => '{}').should.eq(
              RC::RESPONSE_BODY =>  {} )
  end

  should 'decode async' do
    @app.call(RC::RESPONSE_BODY => '{}',
              RC::ASYNC => lambda{ |response|
                             response[RC::RESPONSE_BODY].should.eq({})}
             )[RC::RESPONSE_BODY].should.eq '{}'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rest-core-1.0.3 test/test_json_decode.rb
rest-core-1.0.2 test/test_json_decode.rb
rest-core-1.0.1 test/test_json_decode.rb
rest-core-1.0.0 test/test_json_decode.rb