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 36
def fixtures(*args)
  orig_methods = private_instance_methods
  super.tap do
    new_methods = private_instance_methods - orig_methods
    new_methods.each do |method_name|
      proxy_method_warning_if_called_in_before_context_scope(method_name)
    end
  end
end
proxy_method_warning_if_called_in_before_context_scope(method_name) click to toggle source
# File lib/rspec/rails/fixture_support.rb, line 46
def proxy_method_warning_if_called_in_before_context_scope(method_name)
  orig_implementation = instance_method(method_name)
  define_method(method_name) do |*args, &blk|
    if inspect.include?("before(:context)")
      RSpec.warn_with("Calling fixture method in before :context ")
    else
      orig_implementation.bind(self).call(*args, &blk)
    end
  end
end