I'm trying to set up some feature specs before I get into refactoring some of my company's old code. It's kind of an unconventional setup, but I was able to figure out enough about test doubles to bypass the authentication enough to get started. One problem I'm still having is that some of the instance variables set in these methods I'm bypassing are expected by the view, so I get `undefined method for nil:NilClass` errors. I would like to get the specs running before I make any changes to the program code. In this case, I could easily just move the particular instance variable to another method. But I'm sure more situations like this will come up. Here's the example I'm currently working on:

```
def security_level
  @right_now = Time.now

  #
  # other code that wont work without
  # connecting to a remote authentication
  # server
  #

end

```

Then in my spec:

```
feature 'Navigation' do
  before(:each) do
    allow_any_instance_of(ApplicationController).to receive(:security_level).and_return(nil)
  end
  scenario 'is possible' do
    visit root_path
    expect(page.has_content?('Quick Stats'))
  end
end

```

Here's the error, coming from `@right_now.year` in the view

```
 Failure/Error: visit root_path
 NoMethodError:
   undefined method `year' for nil:NilClass
 # ./common/views/layouts/bootstrap/layout.haml:63

```

**EDIT:** Is there a way to set instance variables on the controller from within a feature spec?