Created
March 15, 2011 17:05
-
-
Save jdudek/871049 to your computer and use it in GitHub Desktop.
Session isolation in Capybara/Steak tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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