Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routes In Decorators #102

Closed
Gerhardk opened this issue Dec 19, 2011 · 3 comments
Closed

Routes In Decorators #102

Gerhardk opened this issue Dec 19, 2011 · 3 comments

Comments

@Gerhardk
Copy link

Hey I am running into a weird error with the decorators.
The error/problem is when I have link_to(account_path(model.id)) inside my decorator it works when I render the view. But when I run my rspec decorator test :

### Rspec Test
it "should render link" do
@account = AccountDecorator(account)
@account.tabnavs.should_not be_nil
end

###Decorator
def tabnavs
content_tag(:li, link_to('Summary', account_path(model, :ofc=>"#{model.id}.json"),:remote => true))
end

I get the following error:

AccountDecorator should render link
Failure/Error: @account.tabnavs.should_not be_nil
undefined method `account_path' for #AccountDecorator:0xd9b236

Can you please advise what is needed so the test can understand where to find the account_path

Thanks for a awesome gem
Gerhard

@Gerhardk
Copy link
Author

I have the include Draper::LazyHelpers inside my decorator

@angelim
Copy link
Contributor

angelim commented Dec 19, 2011

Have you taken a look at https://github.com/jcasimir/draper/issues/60 ?

@Gerhardk
Copy link
Author

Thanks did not see that issue it works now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants