Created
August 28, 2009 15:15
-
-
Save adkron/177032 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fork {system 'echo "startup.sh"'} | |
# RSpec | |
require 'spec/expectations' | |
require 'webrat/selenium' | |
Webrat.configure do |config| | |
config.mode = :selenium | |
config.application_address = 'localhost' | |
config.application_port = 8080 | |
config.application_framework = :external | |
end | |
require 'rubygems' | |
require 'activerecord' | |
require 'ibm_db' | |
require 'active_support' | |
ActiveRecord::Base.establish_connection(:adapter => 'ibm_db', | |
:database => '', | |
:username => '', | |
:password => '', | |
:schema => '', | |
:host => '', | |
:port => '50000') | |
#this creates a class for each table. This will make it easier to deal with later. | |
ActiveRecord::Base.connection.tables.collect { |table_name| eval "#{table_name.singularize.classify} = Class.new(ActiveRecord::Base)" } | |
def active_record_classes | |
@active_record_classes ||= ObjectSpace.enum_for(:each_object, class << ActiveRecord::Base; self; end).to_a | |
@active_record_classes.delete SchemaMigration | |
@active_record_classes.delete ActiveRecord::Base | |
@active_record_classes | |
end | |
World do | |
session = Webrat::SeleniumSession.new | |
session.extend(Webrat::Methods) | |
session.extend(Webrat::Selenium::Methods) | |
session.extend(Webrat::Selenium::Matchers) | |
session | |
end | |
Before do | |
end | |
After do | |
active_record_classes.each {|klass| klass.delete_all } | |
end | |
at_exit do | |
fork {system 'echo "shutdown.sh"'} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment