123456789_123456789_123456789_123456789_123456789_

Module: RSpec::Rails::FixtureSupport Private

Do not use. This module is for internal use only.
Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Defined in: rspec-rails/lib/rspec/rails/fixture_support.rb

Class Method Summary

MinitestAssertionAdapter::ClassMethods - Extended

assertion_method_names

Returns the names of assertion methods that we want to expose to examples without exposing non-assertion methods in Test::Unit or Minitest.

define_assertion_delegators

SetupAndTeardownAdapter::ClassMethods - Extended

setup

Wraps ‘setup` calls from within Rails’ testing framework in ‘before` hooks.

teardown

Wraps ‘teardown` calls from within Rails’ testing framework in ‘after` hooks.

Instance Attribute Summary

Instance Method Summary

DSL Calls

included

[ GitHub ]


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'rspec-rails/lib/rspec/rails/fixture_support.rb', line 20

included do
  if RSpec.configuration.use_active_record?
    include Fixtures

    # TestFixtures#fixture_path is deprecated and will be removed in Rails 7.2
    if respond_to?(:fixture_paths=)
      self.fixture_paths = RSpec.configuration.fixture_paths
    else
      self.fixture_path = RSpec.configuration.fixture_path
    end

    self.use_transactional_tests = RSpec.configuration.use_transactional_fixtures
    self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures

    fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures
  end
end

Instance Attribute Details

#run_in_transaction?Boolean (readonly)

Monkey patched to avoid collisions with ‘let(:name)’ in ::RSpec::Rails 6.1 and after and let(:method_name) before ::RSpec::Rails 6.1.

[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/fixture_support.rb', line 15

def run_in_transaction?
  current_example_name = (RSpec.current_example && RSpec.current_example.[:description])
  use_transactional_tests && !self.class.uses_transaction?(current_example_name)
end