Skip to content

Commit

Permalink
Add test for actor implementing .nil?
Browse files Browse the repository at this point in the history
  • Loading branch information
stevecrozz committed Nov 7, 2024
1 parent e29a800 commit d91f5f3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/flipper/feature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@
expect(subject.enabled?(actors)).to be(false)
end
end

context "for an object that implements .nil? == true" do
let(:actor) { Flipper::Actor.new("User;1") }

before do
def actor.nil?
true
end
end

it 'returns true if feature is enabled' do
subject.enable
expect(subject.enabled?(actor)).to be(true)
end

it 'returns false if feature is disabled' do
subject.disable
expect(subject.enabled?(actor)).to be(false)
end
end
end

describe '#to_s' do
Expand Down

0 comments on commit d91f5f3

Please sign in to comment.