Sha256: 950de41e86d90797b9ec3a585d0756e48c4ed0c3198766597acd02248bd8da35

Contents?: true

Size: 753 Bytes

Versions: 3

Compression:

Stored size: 753 Bytes

Contents

require 'spec_helper'

describe AbPanel::Config do
  let(:config) { AbPanel::Config.new }
  context "config" do
    before do
      AbPanel::Config.any_instance.stub(:settings) { { exp1: { scenario1: 25, scenario2: 75 } } }
    end

    describe '.experiments' do
      subject { config.experiments }
      it { should =~ [:exp1] }
    end

    describe '.weights' do
      subject { config.weights('exp1') }

      it { should =~ [75.0, 25.0] }
    end
  end
  context "empty config" do
    before do
      YAML.stub(:load) { false }
    end
    describe ".settings" do
      subject { config.settings }
      it { should eq nil }
    end

    describe ".experiments" do
      subject { config.experiments }
      it { should == {} }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ab_panel-0.3.3 spec/ab_panel/config_spec.rb
ab_panel-0.3.2 spec/ab_panel/config_spec.rb
ab_panel-0.3.1 spec/ab_panel/config_spec.rb