Sha256: e78e83319efbef5cd9ac9f1774ab70c96691bce6c88e227d853520e15c0490ff

Contents?: true

Size: 925 Bytes

Versions: 5

Compression:

Stored size: 925 Bytes

Contents

RSpec.describe Evil::Client::Middleware::MergeSecurity do
  let(:stack) { described_class.new(app) }
  let(:app)   { double :app }

  def update!(env)
    @result = env
  end

  before  { allow(app).to receive(:call) { |env| update! env } }
  subject { stack.call env }

  let(:env) do
    {
      body:    { "foo" => :FOO, "access_key" => :FOO },
      query:   { "bar" => :BAR, "access_key" => :FOO },
      headers: { "baz" => :BAZ, "authorization" => :FOO },
      security: {
        body:    { "access_key" => :QUX },
        query:   { "access_key" => :ZYX },
        headers: { "authorization" => "Basic 3ou08314tq==" }
      }
    }
  end

  it "merges security schema to env" do
    subject
    expect(@result).to eq \
      body:    { "foo" => :FOO, "access_key" => :QUX },
      query:   { "bar" => :BAR, "access_key" => :ZYX },
      headers: { "baz" => :BAZ, "authorization" => "Basic 3ou08314tq==" }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
evil-client-0.3.1 spec/unit/evil/client/middleware/merge_security_spec.rb
evil-client-0.3.0 spec/unit/evil/client/middleware/merge_security_spec.rb
evil-client-0.2.3 spec/unit/evil/client/middleware/merge_security_spec.rb
evil-client-0.2.2 spec/unit/evil/client/middleware/merge_security_spec.rb
evil-client-0.2.1 spec/unit/evil/client/middleware/merge_security_spec.rb