Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing test for odd transaction poisoning #867

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions spec/flipper/adapters/active_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@

it_should_behave_like 'a flipper adapter'

it "should not poision wrapping transactions" do
flipper = Flipper.new(subject)

actor = Struct.new(:flipper_id).new("flipper-id-123")
flipper.enable_actor(:foo, actor)

ActiveRecord::Base.transaction do
flipper.enable_actor(:foo, actor)

# we get here just fine!
puts "got here!"
expect(true).to be true

# whoa it's not until the next read that the transaction blows up
# with StatementInvalid
expect(Flipper::Adapters::ActiveRecord::Gate.count).to eq 1
puts "never got here!"
expect(true).to be false
end
end

it "should load actor ids fine" do
flipper.enable_percentage_of_time(:foo, 1)

Expand Down
Loading