Rspec Integration Test with Grape and Rails 4.2.x
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 10k
- Forks
- 1.2k
- Avg merge
- 14h 38m
- Merged PRs (30d)
- 92
Description
Issue:
Your using grape, rails 4.2.x and rspec and you get an error about Array not responding to url_helpers
Fix:
if Rails.version >= '4.2' && Rails.version < '5'
#see actionpack/lib/action_dispatch/testing/integration.rb:184 rails 4.2.6
#expects a rails app if resposnds to routes but we've got a grape app that responds to routes
module ActionDispatch
module Integration
class Session
def initialize(app)
super()
@app = app
if app.respond_to?(:routes) && app.routes.respond_to?(:url_helpers)
singleton_class.class_eval do
include app.routes.url_helpers
include app.routes.mounted_helpers
end
end
reset!
end
end
end
end
end
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the integration-test failure with Grape, Rails 4.2.x, and RSpec, then inspect actionpack/lib/action_dispatch/testing/integration.rb around line 184 as identified in the issue. Compare the behavior for a Grape app and a Rails app, and verify that the integration test runs without the Array/url_helpers error across the stated Rails versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100