Created
November 6, 2012 00:14
-
-
Save matenia/4021365 to your computer and use it in GitHub Desktop.
Failing helper spec calling route helper
This file contains hidden or 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
### console output | |
### 1.9.3p172 :018 > app.root_path | |
### => "/" | |
# spec/helpers/applcation_helper.rb | |
require 'spec_helper' | |
require 'uri' | |
describe ApplicationHelper do | |
include Rails.application.routes.url_helpers | |
it "does stuff" do | |
helper.go_to_page.should == '/' | |
end | |
end | |
# app/helpers/application_helper.rb | |
module ApplicationHelper | |
include Rails.application.routes.url_helpers | |
def go_to_page | |
root_path | |
end | |
end | |
### spec output | |
1) ApplicationHelper does stuff | |
Failure/Error: helper.go_to_page.should == '/' | |
RuntimeError: | |
In order to use #url_for, you must include routing helpers explicitly. For instance, `include Rails.application.routes.url_helpers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment