Created
November 5, 2012 23:42
-
-
Save matenia/4021169 to your computer and use it in GitHub Desktop.
Failing helper spec calling route helper
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
# app/helpers/application_helper.rb | |
module ApplicationHelper | |
def go_to_page(resource) | |
polymorphic_path([resource.company, resource]) | |
end | |
end | |
# spec/helpers/application_helper_spec.rb | |
require 'spec_helper' | |
require 'uri' | |
describe ApplicationHelper do | |
it "builds a non-secure page url" do | |
# make new product with valid associated company | |
res = Product.make! | |
uri = helper.go_to_page(res) | |
uri.scheme.should == 'http' | |
end | |
end | |
# error | |
1) ApplicationHelper builds a non-secure page url | |
Failure/Error: uri = helper.go_to_page(res) | |
NoMethodError: | |
undefined method `company_product_path' for #<#<Class:0x007fddac62ac78>:0x007fddb0acd470> | |
## notes: | |
# company_product_path exists in routes and the view that uses this helper works as expected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment