Skip to content

Instantly share code, notes, and snippets.

@weilu
Last active December 26, 2015 05:59
Show Gist options
  • Save weilu/7104353 to your computer and use it in GitHub Desktop.
Save weilu/7104353 to your computer and use it in GitHub Desktop.
Never forget to make requests in controller specs
# spec/support/rspec-rails/controller-example-group.rb
module RSpec::Rails
module ControllerExampleGroup
def process *args
@requested = true
super
end
def self.included(base)
base.class_eval do
after do
unless @requested
puts 'WARNING: No request method invoked. Have you forgotten to make a request?'
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment