gon
gon copied to clipboard
Controller path in integration testing with rspec not available
https://github.com/gazay/gon/issues/43
Awesome, @gazay, thanks for the help! I've created a minimal app that reproduces the issue: [email protected]:KrisBraun/gon-rabl-rspec.git
Should be as simple as sync, bundle install, rspec, boom.
It's pretty clear what to do here - there not real request goes to gon from rspec - TestRequest goes. So there should be done some switch for env.test?.
I do not find this easy to fix. From where should the controller instance come then if it is not available through TestRequest
? This problem can always be solved from the caller side by simply requiring to pass the controller
object:
gon.jbuilder template: 'path/to/template.json.jbuilder', controller: self
But otherwise, no clue…
I have similar issue, may be it has same reason, described here #124 and how to temporary fix