My controller has the following:
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 testing of rspec selenium, I want to establish a session for the board. But it seems like I canβt
describe "greeting creation" do before(:each) do @board = Factory(:board) session[:board] = @board.id end
This results in the following error:
Failure/Error: session[:board] = @board.id NoMethodError: undefined method `session' for nil:NilClass
How to set up a session for this test to work?
source share