Sha256: 1f7d9075ce8a517920dbed09ee8eee86daf4299da073aad02dda1f270c3f16ec

Contents?: true

Size: 833 Bytes

Versions: 5

Compression:

Stored size: 833 Bytes

Contents

require 'spec_helper'

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

    describe '.experiments' do
      subject { config.experiments }
      it { is_expected.to match_array [:exp1] }
    end

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

      it { is_expected.to match_array [75.0, 25.0] }
    end
  end
  context "empty config" do
    before do
      allow(YAML).to receive(:load) { false }
    end
    describe ".settings" do
      subject { config.settings }
      it { is_expected.to eq nil }
    end

    describe ".experiments" do
      subject { config.experiments }
      it { is_expected.to eq({}) }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ab_panel-0.4.4 spec/ab_panel/config_spec.rb
ab_panel-0.4.3 spec/ab_panel/config_spec.rb
ab_panel-0.4.2 spec/ab_panel/config_spec.rb
ab_panel-0.4.1 spec/ab_panel/config_spec.rb
ab_panel-0.4.0 spec/ab_panel/config_spec.rb