Sha256: 37406c2f8b0ffb83f3e681893497f99de941f2c8ccb914c68aa97245d6fd4cb9
Contents?: true
Size: 1.8 KB
Versions: 2
Compression:
Stored size: 1.8 KB
Contents
require "spec_helper" describe "Rollout::Feature" do let(:rollout) { Rollout.new($redis) } describe "#add_user" do it "ids a user using id_user_by" do user = double("User", email: "test@test.com") feature = Rollout::Feature.new(:chat, state: nil, rollout: rollout, options: { id_user_by: :email }) feature.add_user(user) expect(user).to have_received :email end end describe "#initialize" do describe "when string does not exist" do it 'clears feature attributes when string is not given' do feature = Rollout::Feature.new(:chat, rollout: rollout) expect(feature.groups).to be_empty expect(feature.users).to be_empty expect(feature.percentage).to eq 0 expect(feature.data).to eq({}) end it 'clears feature attributes when string is nil' do feature = Rollout::Feature.new(:chat, state: nil, rollout: rollout) expect(feature.groups).to be_empty expect(feature.users).to be_empty expect(feature.percentage).to eq 0 expect(feature.data).to eq({}) end it 'clears feature attributes when string is empty string' do feature = Rollout::Feature.new(:chat, state: "", rollout: rollout) expect(feature.groups).to be_empty expect(feature.users).to be_empty expect(feature.percentage).to eq 0 expect(feature.data).to eq({}) end describe "when there is no data" do it 'sets @data to empty hash' do feature = Rollout::Feature.new(:chat, state: "0||", rollout: rollout) expect(feature.data).to eq({}) end it 'sets @data to empty hash' do feature = Rollout::Feature.new(:chat, state: "||| ", rollout: rollout) expect(feature.data).to eq({}) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rollout-2.6.1 | spec/rollout/feature_spec.rb |
rollout-2.6.0 | spec/rollout/feature_spec.rb |