Created
November 24, 2010 16:43
-
-
Save lucasmazza/713958 to your computer and use it in GitHub Desktop.
Using xhr with rspec + rack/test
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
module XhrHelpers | |
def xhr(path, params = {}) | |
verb = params.delete(:as) || :get | |
send(verb,path, params, "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest") | |
end | |
alias_method :ajax, :xhr | |
end | |
RSpec.configuration.include XhrHelpers, :type => :controller |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment