Sha256: 66acc5b0b77985eb7032c5a593568cb5403c0d872c7ea40fbc5c8ff1fc5b434e

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe AbPanel do
  describe ".experiments" do
    subject { AbPanel.experiments }

    it { should =~ %w(experiment1 experiment2).map(&:to_sym) }
  end

  describe ".scenarios" do
    subject { AbPanel.scenarios(experiment) }

    let(:experiment) { AbPanel.experiments.first }

    it { should =~ %w( scenario1 scenario2 scenario3 original ).map(&:to_sym) }

    describe "With an unexisting experiment" do
      let(:experiment) { :does_not_exist }

      it 'should throw an ArgumentError' do
        expect { subject }.to raise_exception ArgumentError
      end
    end
  end

  describe ".conditions" do
    subject { AbPanel.conditions.experiment1 }

    it { should respond_to :scenario1? }
    it { should respond_to :original? }

    describe 'uniqueness' do
      let(:conditions) do
        [
          subject.scenario1?,
          subject.scenario2?,
          subject.scenario3?,
          subject.original?
        ]
      end

      it { conditions.any?.should be true }
      it { conditions.all?.should be false }
      it { conditions.select{|c| c}.size.should be 1 }
      it { conditions.reject{|c| c}.size.should be 3 }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ab_panel-0.1.0 spec/ab_panel_spec.rb
ab_panel-0.0.9 spec/ab_panel_spec.rb
ab_panel-0.0.8 spec/ab_panel_spec.rb
ab_panel-0.0.7 spec/ab_panel_spec.rb
ab_panel-0.0.6 spec/ab_panel_spec.rb
ab_panel-0.0.5 spec/ab_panel_spec.rb
ab_panel-0.0.4 spec/ab_panel_spec.rb
ab_panel-0.0.3 spec/ab_panel_spec.rb
ab_panel-0.0.2 spec/ab_panel_spec.rb
ab_panel-0.0.1 spec/ab_panel_spec.rb