Skip to content

Commit

Permalink
Add failing spec
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 committed Apr 21, 2021
1 parent efdc7b5 commit f093617
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions spec/rspec/rails/fixture_support_spec.rb
Expand Up @@ -12,6 +12,33 @@ module RSpec::Rails
end
end

context "with use_transactional_tests set to true" do
it "works with #uses_transaction helper" do
group = RSpec::Core::ExampleGroup.describe do
include FixtureSupport
self.use_transactional_tests = true

uses_transaction "doesn't run in transaction"

it "doesn't run in transaction" do
expect(ActiveRecord::Base.connection.transaction_open?).to eq(false)
end

it "runs in transaction" do
expect(ActiveRecord::Base.connection.transaction_open?).to eq(true)
end
end

expect_to_pass(group)
end

def expect_to_pass(group)
result = group.run(failure_reporter)
failure_reporter.exceptions.map { |e| raise e }
expect(result).to be true
end
end

it "will allow #setup_fixture to run successfully", skip: Rails.version.to_f <= 6.0 do
group = RSpec::Core::ExampleGroup.describe do
include FixtureSupport
Expand Down

0 comments on commit f093617

Please sign in to comment.