{"action":"closed","issue":{"url":"https://api.github.com/repos/blowmage/minitest-rails/issues/200","repository_url":"https://api.github.com/repos/blowmage/minitest-rails","labels_url":"https://api.github.com/repos/blowmage/minitest-rails/issues/200/labels{/name}","comments_url":"https://api.github.com/repos/blowmage/minitest-rails/issues/200/comments","events_url":"https://api.github.com/repos/blowmage/minitest-rails/issues/200/events","html_url":"https://github.com/blowmage/minitest-rails/issues/200","id":170118423,"number":200,"title":"unable to use 'describe' block for controller with Devise","user":{"login":"gpr","id":309019,"avatar_url":"https://avatars.githubusercontent.com/u/309019?v=3","gravatar_id":"","url":"https://api.github.com/users/gpr","html_url":"https://github.com/gpr","followers_url":"https://api.github.com/users/gpr/followers","following_url":"https://api.github.com/users/gpr/following{/other_user}","gists_url":"https://api.github.com/users/gpr/gists{/gist_id}","starred_url":"https://api.github.com/users/gpr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gpr/subscriptions","organizations_url":"https://api.github.com/users/gpr/orgs","repos_url":"https://api.github.com/users/gpr/repos","events_url":"https://api.github.com/users/gpr/events{/privacy}","received_events_url":"https://api.github.com/users/gpr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-09T09:14:43Z","updated_at":"2016-08-09T09:47:47Z","closed_at":"2016-08-09T09:47:47Z","body":"I'm not able to make the following test working:\r\n\r\n```ruby\r\ndescribe UsersController do\r\n  include Devise::Test::ControllerHelpers\r\n\r\n  before do\r\n    sign_in create(:admin)\r\n  end\r\n\r\n  it 'gets index' do\r\n    get users_url\r\n    value(response).must_be :success?\r\n  end\r\nend\r\n```\r\n\r\nI get: \r\n```ruby\r\nMinitest::UnexpectedError: NoMethodError: undefined method `env' for nil:NilClass\r\n    devise (4.2.0) lib/devise/test/controller_helpers.rb:40:in `setup_controller_for_warden'`\r\n```\r\n\r\nThis function is quite simple (see https://github.com/plataformatec/devise/blob/22784cb55abefc8a62c69dcc170a30d18e45c7ac/lib/devise/test/controller_helpers.rb#L39):\r\n```ruby\r\n     def setup_controller_for_warden #:nodoc:\r\n        @request.env['action_controller.instance'] = @controller\r\n      end\r\n```\r\n\r\nAnd the issue is that `@request` is `nil`.\r\n\r\nObviously I have no issue if I replace the `describe` block by  `class UsersControllerTest < ActionController::TestCase`.\r\n\r\nAn extract of my `Gemfile.lock`:\r\n```Gemfile.lock\r\nrails (5.0.0)\r\nminitest-rails (3.0.0)\r\nminitest (5.9.0)\r\ndevise (4.2.0)\r\n```"}}
{"actor":{"display_login":"gpr"}}