module RSpec::Rails::FixtureSupport::Fixtures

Public Instance Methods

fixtures(*args) click to toggle source
Calls superclass method
# File lib/rspec/rails/fixture_support.rb, line 43
def fixtures(*args)
  super.tap do
    fixture_sets.each_pair do |method_name, fixture_name|
      proxy_method_warning_if_called_in_before_context_scope(method_name, fixture_name)
    end
  end
end
proxy_method_warning_if_called_in_before_context_scope(method_name, fixture_name) click to toggle source
# File lib/rspec/rails/fixture_support.rb, line 51
def proxy_method_warning_if_called_in_before_context_scope(method_name, fixture_name)
  define_method(method_name) do |*args, **kwargs, &blk|
    if RSpec.current_scope == :before_context_hook
      RSpec.warn_with("Calling fixture method in before :context ")
    else
      access_fixture(fixture_name, *args, **kwargs, &blk)
    end
  end
end