I have the following in my controller:
def create
@board = Board.find(session[:board])
@greeting = @board.Greetings.build(params[:greeting])
respond_to do |format|
if @greeting.save
format.js { render :action => "success" }
else
format.js { render :action => "failure" }
end
end
end
In my rspec selenium test I want to set the session for the board. But it seems I can't
describe "greeting creation" do
before(:each) do
@board = Factory(:board)
session[:board] = @board.id
end
THis gives the following error:
Failure/Error: session[:board] = @board.id
NoMethodError:
undefined method `session' for nil:NilClass
How can I set the session so this test works?
I had this issue and 'solved' it by using ApplicationController.session[:key].
But now I get the error TypeError:
can't convert Symbol into Integer
level_spec.rb:7:in
[]='`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With