Skip to content

Instantly share code, notes, and snippets.

@davetapley
Created January 11, 2013 05:35
Show Gist options
  • Save davetapley/4508214 to your computer and use it in GitHub Desktop.
Save davetapley/4508214 to your computer and use it in GitHub Desktop.
# If you have a filter which is used in a lot of controllers and thus requires constant mocking
# implicitly skip before_filter in all controllers:
# in spec_helper.rb
config.before(:each) do
if defined? controller and not example.options[:with_before_filter] == :my_filter
controller.class.skip_before_filter :my_filter
end
end
# if you want to run the filter
it 'does stuff', with_before_filter: :my_filter do
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment