Sha256: 00b9672e77854058d3de746008ae37454b39855bf13460f71afde78cee532d57

Contents?: true

Size: 1023 Bytes

Versions: 10

Compression:

Stored size: 1023 Bytes

Contents

require 'eeny-meeny/routing/smoke_test_constraint'
require 'eeny-meeny/middleware'
require 'rack/test'

describe EenyMeeny::SmokeTestConstraint do

  let(:request) do
    Rack::MockSession.new(EenyMeeny::Middleware.new(MockRackApp.new))
  end

  let(:request_with_cookie) do
    request.set_cookie('smoke_test_shadow_v1=kqe%2Bt%2F72JZ9s7fOv0nQ8GszTEmmXj3tUsjqmqy31i4yZLku5okuya%2F3PYb8Oi%2BSi53hDP8egfeiCcbrlBN4s5ifQwToaZHNAs43V1EKb8ca%2BTRK0lpCWfR58%2BQjpWwZL; expires=Tue, 11 Oct 2016 13:30:31 -0000; HttpOnly')
    request
  end

  describe 'when initialized' do

    subject do
      described_class.new(:shadow)
    end

    describe '#matches?' do
      context 'for a request with a valid smoke test cookie' do
        it 'returns true' do
          expect(subject.matches?(request_with_cookie)).to be true
        end
      end
      context 'for a request without a smoke test cookie' do
        it 'returns false' do
          expect(subject.matches?(request)).to be false
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
eeny-meeny-2.3.0 spec/eeny-meeny/routing/smoke_test_constraint_spec.rb
eeny-meeny-2.2.2 spec/eeny-meeny/routing/smoke_test_constraint_spec.rb
eeny-meeny-2.2.1 spec/eeny-meeny/routing/smoke_test_constraint_spec.rb
eeny-meeny-2.2.0 spec/eeny-meeny/routing/smoke_test_constraint_spec.rb
eeny-meeny-2.1.4 spec/eeny-meeny/routing/smoke_test_constraint_spec.rb
eeny-meeny-2.1.3 spec/eeny-meeny/routing/smoke_test_constraint_spec.rb
eeny-meeny-2.1.2 spec/eeny-meeny/routing/smoke_test_constraint_spec.rb
eeny-meeny-2.1.1 spec/eeny-meeny/routing/smoke_test_constraint_spec.rb
eeny-meeny-2.1.0 spec/eeny-meeny/routing/smoke_test_constraint_spec.rb
eeny-meeny-2.0.0 spec/eeny-meeny/routing/smoke_test_constraint_spec.rb