Skip to content

Instantly share code, notes, and snippets.

@fairchild
Created January 8, 2009 11:15
Show Gist options
  • Select an option

  • Save fairchild/44686 to your computer and use it in GitHub Desktop.

Select an option

Save fairchild/44686 to your computer and use it in GitHub Desktop.
supporting multiple session with webrat integration tests
require File.join(File.dirname(__FILE__), '..', 'test_helper')
require "webrat"
Webrat.configure do |config|
config.mode = :rails
config.open_error_files = false
end
class UserFlowsTest < ActionController::IntegrationTest
include Webrat
def test_user_flow_from_signup_thru_first_trade
new_session do |person|
visit '/' #this works
person.extend(Webrat)
sally = person.user_signs_up('sally', 'sally_secret')
end
end
private
module BrightHouseTestingDSL
include Webrat #this line is including the Webrat modules methods, s
extend Webrat
def user_signs_up(login, password)
puts "--------------#{self.class} includes ---------#{pp self.class.included_modules}"
# require "rubygems"; require "ruby-debug"; debugger
visit '/' #this fails: NoMethodError: undefined method `visit' for #<ActionController::Integration::Session:0x347f448>
end
end
def new_session
open_session do |sess|
sess.extend(Webrat)
sess.extend(BrightHouseTestingDSL)
yield sess if block_given?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment