Skip to content

Commit

Permalink
Add specs to shared adapter specs/tests for double enable of single t…
Browse files Browse the repository at this point in the history
…hings
  • Loading branch information
jnunemaker committed Jun 28, 2019
1 parent db474e7 commit 171457d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/flipper/spec/shared_adapter_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,14 @@
expect(subject.enable(feature, group_gate, flipper.group(:admins))).to eq(true)
expect(subject.get(feature).fetch(:groups)).to eq(Set['admins'])
end

it 'can double enable percentage without error' do
expect(subject.enable(feature, actors_gate, flipper.actors(25))).to eq(true)
expect(subject.enable(feature, actors_gate, flipper.actors(25))).to eq(true)
end

it 'can double enable without error' do
expect(subject.enable(feature, boolean_gate, flipper.boolean)).to eq(true)
expect(subject.enable(feature, boolean_gate, flipper.boolean)).to eq(true)
end
end
10 changes: 10 additions & 0 deletions lib/flipper/test/shared_adapter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,16 @@ def test_can_double_enable_a_group_without_error
assert_equal true, @adapter.enable(@feature, @group_gate, @flipper.group(:admins))
assert_equal Set['admins'], @adapter.get(@feature).fetch(:groups)
end

def test_can_double_enable_percentage_without_error
assert_equal true, @adapter.enable(@feature, @actors_gate, @flipper.actors(25))
assert_equal true, @adapter.enable(@feature, @actors_gate, @flipper.actors(25))
end

def test_can_double_enable_without_error
assert_equal true, @adapter.enable(@feature, @boolean_gate, @flipper.boolean)
assert_equal true, @adapter.enable(@feature, @boolean_gate, @flipper.boolean)
end
end
end
end

0 comments on commit 171457d

Please sign in to comment.