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

NoMethodError when using route helpers #85

Open
erikaxel opened this issue Nov 6, 2017 · 5 comments
Open

NoMethodError when using route helpers #85

erikaxel opened this issue Nov 6, 2017 · 5 comments

Comments

@erikaxel
Copy link

erikaxel commented Nov 6, 2017

Hi,

Im getting a NoMethodError: undefined method `[]' for nil:NilClass
in rspec-testing when using path helpers. I have included the controller via the controller-method, and tried setting the type to :cell, but it doesn't help.
Using Rails 5.1 and Slim.

@michaldarda
Copy link

michaldarda commented Oct 30, 2018

I have the same issue

EDIT: @erikaxel I think it is because controller testing is deprecated - controller_for method always returns nil

@michaldarda
Copy link

@erikaxel

Workaround for the moment is

let(:controller) { double('controller', url_options: {}) }                                                                                                  

@JohnSmall
Copy link

JohnSmall commented Jul 15, 2019

I found that it depends on the order you put cells-rails and rspec-cells into the Gemfile.

If cells-rails goes first then it works, if it's after rspec-cells then it doesn't

Which indicates that rspec-cells has an implied dependency on cells-rails.

@apotonick
Copy link
Member

The order in the Gemfile matters? 😨

@rindek
Copy link

rindek commented Oct 24, 2019

I actually had same issue, and found out that when initializing cell object like this:

let(:cell_obj) { SomeCell.(data) }

then it does not work properly, but when I initialize it as

let(:cell_obj) { cell(SomeCell, data) }

then everything works. Maybe that's also the case for you @erikaxel

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

5 participants