module RSpec::Rails::FixtureSupport
def self.fixtures(*args)
def self.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
def self.proxy_method_warning_if_called_in_before_context_scope(method_name)
def self.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