mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-21 21:40:48 +02:00
finish upgrade of selenium
these were manual cherry-picks of the rails upgrade work.
This commit is contained in:
parent
551eab19a5
commit
e2841e31eb
9 changed files with 80 additions and 48 deletions
|
@ -3,6 +3,7 @@ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
|||
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
||||
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
|
||||
%>
|
||||
default: <%= std_opts %> features
|
||||
default: <%= std_opts %> features --tags ~@selenium
|
||||
selenium: <%= std_opts %> features --tags @selenium
|
||||
wip: --tags @wip:3 --wip features
|
||||
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
|
||||
|
|
|
@ -32,8 +32,8 @@ Rails::Initializer.run do |config|
|
|||
config.action_controller.session_store = :active_record_store
|
||||
|
||||
config.action_controller.session = {
|
||||
:key => '_tracks_session_id',
|
||||
:secret => SITE_CONFIG['salt'] * (30.0 / SITE_CONFIG['salt'].length).ceil #must be at least 30 characters
|
||||
:key => '_tracks_session_id',
|
||||
:secret => SITE_CONFIG['salt'] * (30.0 / SITE_CONFIG['salt'].length).ceil #must be at least 30 characters
|
||||
}
|
||||
|
||||
config.action_controller.relative_url_root = SITE_CONFIG['subdir'] if SITE_CONFIG['subdir']
|
||||
|
|
|
@ -14,4 +14,4 @@ config.action_controller.perform_caching = false
|
|||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Unique cookies
|
||||
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:session_key] = "TrackDev"
|
||||
config.action_controller.session = { :key => 'TracksDev' }
|
|
@ -21,10 +21,11 @@ config.action_controller.allow_forgery_protection = false
|
|||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
config.gem 'cucumber-rails', :lib => false, :version => '>=0.2.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
|
||||
config.gem 'webrat', :lib => false, :version => '>=0.6.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
||||
config.gem 'rspec', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
|
||||
config.gem 'rspec-rails', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
|
||||
|
||||
config.gem 'database_cleaner', :lib => false, :version => '>=0.2.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
|
||||
# Unique cookies
|
||||
config.action_controller.session = { :key => 'TracksSelenium' }
|
||||
|
||||
config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
|
||||
config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
|
||||
config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
||||
config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
|
||||
config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
|
|
@ -19,19 +19,8 @@ config.action_mailer.delivery_method = :test
|
|||
# Disable request forgery protection in test environment
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# We store more than 4K of data in the session during some tests.
|
||||
# Override the hard-coded cookie session store to use a memory store for tests.
|
||||
# See http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/5519ca7fd4dde3c1
|
||||
class ActionController::RackRequest
|
||||
DEFAULT_SESSION_OPTIONS = {
|
||||
#:database_manager => CGI::Session::MemoryStore, # store data in memory
|
||||
:prefix => "ruby_sess.", # prefix session file names
|
||||
:session_path => "/", # available to all paths in app
|
||||
:session_key => "_session_id",
|
||||
:cookie_only => false,
|
||||
:session_http_only=> true
|
||||
}
|
||||
end
|
||||
# Unique cookies
|
||||
config.action_controller.session = { :key => 'TracksTest' }
|
||||
|
||||
# Overwrite the default settings for fixtures in tests. See Fixtures
|
||||
# for more details about these settings.
|
||||
|
@ -50,7 +39,7 @@ config.gem "flexmock"
|
|||
config.gem "ZenTest", :lib => "zentest", :version => ">=4.0.0"
|
||||
config.gem "hpricot"
|
||||
config.gem "hoe"
|
||||
config.gem "rspec", :lib => false, :version => ">= 1.2.2"
|
||||
config.gem "rspec-rails", :lib => false, :version => ">=1.2.2"
|
||||
config.gem "webrat", :lib => false, :version => ">=0.4.3"
|
||||
config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
||||
config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
|
||||
config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
|
||||
config.gem "thoughtbot-factory_girl", :lib => "factory_girl", :source => "http://gems.github.com"
|
||||
|
|
2
features/support/init_factory_girl.rb
Normal file
2
features/support/init_factory_girl.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
require 'factory_girl'
|
||||
Dir.glob(File.join(File.dirname(__FILE__), '../../spec/factories/*.rb')).each {|f| require f }
|
|
@ -9,7 +9,23 @@ module NavigationHelpers
|
|||
case page_name
|
||||
|
||||
when /the home\s?page/
|
||||
'/'
|
||||
root_path
|
||||
when /the statistics page/
|
||||
stats_path
|
||||
when /the signup page/
|
||||
signup_path
|
||||
when /the login page/
|
||||
login_path
|
||||
when /the notes page/
|
||||
notes_path
|
||||
when /the contexts page/
|
||||
contexts_path
|
||||
when /the manage users page/
|
||||
users_path
|
||||
when /the repeating todos page/
|
||||
recurring_todos_path
|
||||
when /the integrations page/
|
||||
integrations_path
|
||||
|
||||
# Add more mappings here.
|
||||
# Here is an example that pulls values out of the Regexp:
|
||||
|
|
|
@ -1,22 +1,13 @@
|
|||
Webrat.configure do |config|
|
||||
config.mode = :selenium
|
||||
config.application_environment = :selenium
|
||||
config.selenium_browser_startup_timeout = 30
|
||||
#config.selenium_server_address = "localhost"
|
||||
end
|
||||
if ENV["RAILS_ENV"] == "selenium"
|
||||
puts "Configuring to use Selenium with Webrat for Cucumber stories"
|
||||
Webrat.configure do |config|
|
||||
config.mode = :selenium
|
||||
config.application_environment = :selenium
|
||||
config.selenium_browser_startup_timeout = 30
|
||||
# use only if you run a separate selenium server instance and do not
|
||||
# want webrat to start one for you
|
||||
#config.selenium_server_address = "localhost"
|
||||
end
|
||||
|
||||
Cucumber::Rails::World.use_transactional_fixtures = false
|
||||
|
||||
require 'database_cleaner'
|
||||
|
||||
# clean the database once when starting
|
||||
DatabaseCleaner.clean_with :truncation
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
|
||||
Before do
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
After do
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
Cucumber::Rails::World.use_transactional_fixtures = false
|
||||
end
|
32
lib/tasks/cucumber-tracks.rake
Normal file
32
lib/tasks/cucumber-tracks.rake
Normal file
|
@ -0,0 +1,32 @@
|
|||
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
||||
# It is recommended to regenerate this file in the future when you upgrade to a
|
||||
# newer version of cucumber-rails. Consider adding your own code to a new file
|
||||
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
||||
# files.
|
||||
|
||||
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
||||
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
||||
|
||||
begin
|
||||
require 'cucumber/rake/task'
|
||||
|
||||
namespace :cucumber do
|
||||
Cucumber::Rake::Task.new({:selenium => :env_to_selenium}, 'Run features that require selenium') do |t|
|
||||
t.binary = vendored_cucumber_bin
|
||||
t.fork = true # You may get faster startup if you set this to false
|
||||
t.profile = 'selenium'
|
||||
end
|
||||
|
||||
task :env_to_selenium => 'db:test:prepare' do
|
||||
ENV['RAILS_ENV'] = 'selenium'
|
||||
end
|
||||
|
||||
desc 'Run all features'
|
||||
task :all => [:ok, :wip, :selenium]
|
||||
end
|
||||
rescue LoadError
|
||||
desc 'cucumber rake task not available (cucumber not installed)'
|
||||
task :cucumber do
|
||||
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue