Last active
December 26, 2015 05:59
-
-
Save weilu/7104353 to your computer and use it in GitHub Desktop.
Never forget to make requests in controller specs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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