Sha256: efa3e00cb718e914e9525a5af7840b6894112d72b710ddb49b47e1733f56cc05

Contents?: true

Size: 579 Bytes

Versions: 5

Compression:

Stored size: 579 Bytes

Contents

require 'rest-core/test'

describe RC::DefaultPayload do
  before do
    @app = RC::DefaultPayload.new(RC::Dry.new, {})
  end

  def app
    @app
  end

  should 'do nothing' do
    app.call({})[RC::REQUEST_PAYLOAD].should.eq({})
  end

  should 'merge payload' do
    app.instance_eval{@payload = {'pay' => 'load'}}

    app.call({}).should.eq({RC::REQUEST_PAYLOAD =>
      {'pay' => 'load'}})

    format = {'format' => 'json'}
    env    = {RC::REQUEST_PAYLOAD => format}

    app.call(env).should.eq({RC::REQUEST_PAYLOAD =>
      {'pay' => 'load'}.merge(format)})
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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