updated to change from instance variable in rspec test to local variable