mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
6052fa9288
The [Grape API framework](https://github.com/ruby-grape/grape) regularly writes tests like [spec/grape/api_spec.rb](https://github.com/ruby-grape/grape/blob/master/spec/grape/api_spec.rb). When attempting to write a test in a Rails environment similar to the following: ``` describe Grape::Api, type: :request do let(:app) { Class.new(Grape::API) do get 'test' do { foo: 'bar' } end end } it '200s' do get 'test' end end ``` The following exception is thrown: ``` NoMethodError: undefined method `url_helpers' for #<Array:0x00007fb4e4bc4c88> -- 0: .../lib/action_dispatch/testing/integration.rb:330:in `block in create_session' 1: .../lib/action_dispatch/testing/integration.rb:326:in `initialize' 2: .../lib/action_dispatch/testing/integration.rb:326:in `new' 3: .../lib/action_dispatch/testing/integration.rb:326:in `create_session' 4: .../lib/action_dispatch/testing/integration.rb:316:in `integration_session' 5: .../lib/action_dispatch/testing/integration.rb:348:in `block (2 levels) in <module:Runner>' ``` This change explicitly ensures that `app.routes` is an `ActionDispatch::Routing::RouteSet` instance. |
||
---|---|---|
.. | ||
request | ||
routing | ||
session | ||
system_testing | ||
callbacks_test.rb | ||
content_disposition_test.rb | ||
content_security_policy_test.rb | ||
cookies_test.rb | ||
debug_exceptions_test.rb | ||
debug_locks_test.rb | ||
exception_wrapper_test.rb | ||
executor_test.rb | ||
header_test.rb | ||
host_authorization_test.rb | ||
live_response_test.rb | ||
mapper_test.rb | ||
middleware_stack_test.rb | ||
mime_type_test.rb | ||
mount_test.rb | ||
prefix_generation_test.rb | ||
rack_cache_test.rb | ||
reloader_test.rb | ||
request_id_test.rb | ||
request_test.rb | ||
response_test.rb | ||
routing_assertions_test.rb | ||
routing_test.rb | ||
runner_test.rb | ||
show_exceptions_test.rb | ||
ssl_test.rb | ||
static_test.rb | ||
test_request_test.rb | ||
test_response_test.rb | ||
uploaded_file_test.rb | ||
url_generation_test.rb |