Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Session isolation in Capybara/Steak tests
class SessionsController < ApplicationController
def create
session[:created] = true
render :text => "Session created"
end
def check
if session[:created]
render :text => "Session exists"
else
render :text => "Session does not exist"
end
end
end
require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper')
feature "Sessions" do
scenario "Test creating a session" do
visit "/session/create"
page.body.should =~ /Session created/
visit "/session/check"
page.body.should =~ /Session exists/
end
scenario "Test not creating a session" do
visit "/session/check"
page.body.should =~ /Session does not exist/
# expected: /Session does not exist/
# got: "Session exists" (using =~)
end
# after :each do
# page.reset!
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.