{"action":"created","issue":{"url":"https://api.github.com/repos/rspec/rspec-rails/issues/1449","labels_url":"https://api.github.com/repos/rspec/rspec-rails/issues/1449/labels{/name}","comments_url":"https://api.github.com/repos/rspec/rspec-rails/issues/1449/comments","events_url":"https://api.github.com/repos/rspec/rspec-rails/issues/1449/events","html_url":"https://github.com/rspec/rspec-rails/issues/1449","id":101692372,"number":1449,"title":"Assigns inside Helper spec always returns nil","user":{"login":"roooodcastro","id":466635,"avatar_url":"https://avatars.githubusercontent.com/u/466635?v=3","gravatar_id":"","url":"https://api.github.com/users/roooodcastro","html_url":"https://github.com/roooodcastro","followers_url":"https://api.github.com/users/roooodcastro/followers","following_url":"https://api.github.com/users/roooodcastro/following{/other_user}","gists_url":"https://api.github.com/users/roooodcastro/gists{/gist_id}","starred_url":"https://api.github.com/users/roooodcastro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roooodcastro/subscriptions","organizations_url":"https://api.github.com/users/roooodcastro/orgs","repos_url":"https://api.github.com/users/roooodcastro/repos","events_url":"https://api.github.com/users/roooodcastro/events{/privacy}","received_events_url":"https://api.github.com/users/roooodcastro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-18T16:13:13Z","updated_at":"2015-08-23T12:13:31Z","closed_at":"2015-08-23T12:13:31Z","body":"Whenever I call `assigns[key]` on my helper spec, it returns nil regardless of the key I use to access it.\r\n\r\nMy helper method assigns the variable `@barra`, and when I try to test it (after calling it), both of these return nil:\r\n\r\n```\r\nassigns[:barra]\r\nhelper.assigns[:barra]\r\n```\r\n\r\nAlso, after inspecting it with pry, I noticed that the assigns is completely void of any trace of my variable. Manually setting `assign(:barra, some_value)` before the spec will make `assigns[:barra]` return `some_value`, instead of the value that was set during the helper's execution.\r\n\r\n[I asked this on StackOverflow](https://stackoverflow.com/questions/32010698/assigns-in-rspec-helper-test-is-returning-nil) but got no responses.\r\n\r\nAm I using it in a wrong way? [The docs](https://www.relishapp.com/rspec/rspec-rails/v/3-0/docs/helper-specs/helper-spec) only mention assigning the variable before and using it inside the helper, which is the other way around of what I want.\r\n\r\nI'm using rspec-rails 3.3, Ruby 2.1.5 and Rails 4.1.12."},"comment":{"url":"https://api.github.com/repos/rspec/rspec-rails/issues/comments/133823262","html_url":"https://github.com/rspec/rspec-rails/issues/1449#issuecomment-133823262","issue_url":"https://api.github.com/repos/rspec/rspec-rails/issues/1449","id":133823262,"user":{"login":"JonRowe","id":162976,"avatar_url":"https://avatars.githubusercontent.com/u/162976?v=3","gravatar_id":"","url":"https://api.github.com/users/JonRowe","html_url":"https://github.com/JonRowe","followers_url":"https://api.github.com/users/JonRowe/followers","following_url":"https://api.github.com/users/JonRowe/following{/other_user}","gists_url":"https://api.github.com/users/JonRowe/gists{/gist_id}","starred_url":"https://api.github.com/users/JonRowe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonRowe/subscriptions","organizations_url":"https://api.github.com/users/JonRowe/orgs","repos_url":"https://api.github.com/users/JonRowe/repos","events_url":"https://api.github.com/users/JonRowe/events{/privacy}","received_events_url":"https://api.github.com/users/JonRowe/received_events","type":"User","site_admin":false},"created_at":"2015-08-23T12:13:31Z","updated_at":"2015-08-23T12:13:31Z","body":"As far as I know `assigns` is intended to replicate the controller test method, e.g. a variable has been assigned for use in a view (or helper) and so isn't intended for bi-direction use like this, looking at your stack overflow question I'd argue you shouldn't be using a helper method like that at all, can I ask what it is you are trying to accomplish? If it's to DRY up your controller rendering then I'd suggest testing this via an anonymous controller (in a controller spec) and triggering the helper, otherwise I'd suggest refactoring your helper to use locals rather than instance variables."}}