Sha256: 8b391cf2b67bfe45effa6355fe03c49e755bc037e31a6129f4e45ffc9d37735f

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

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

describe EenyMeeny::ExperimentConstraint, experiments: true do

  let(:request) do
    session = Rack::MockSession.new(EenyMeeny::Middleware.new(MockRackApp.new))
    session.set_cookie('eeny_meeny_my_page_v1=ctRsrHCj21pZt%2FELsjedHRT9GkYOuIdoTwEyP9kxfI7dDS4I9g1nv77j9Umij1P44SCU7Zebdb8mqwLabTrskg%3D%3D; path=/; expires=Sun, 06 Nov 2016 11:26:01 -0000; HttpOnly')
    session
  end

  describe 'when initialized' do

    context 'for an inactive experiment' do
      subject do
        described_class.new(:expired)
      end

      describe '#matches?' do
        it 'returns false' do
          expect(subject.matches?(request)).to be false
        end
      end
    end

    context 'for an active experiment' do
      subject do
        described_class.new(:my_page)
      end

      describe '#matches?' do
        it 'returns true' do
          expect(subject.matches?(request)).to be true
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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