##// END OF EJS Templates
Removed database_cleaner dependency (#15377)....
Jean-Philippe Lang -
r12067:bc0ec54afa72
parent child
Show More
@@ -1,99 +1,98
1 source 'https://rubygems.org'
1 source 'https://rubygems.org'
2
2
3 gem "rails", "3.2.15"
3 gem "rails", "3.2.15"
4 gem "jquery-rails", "~> 2.0.2"
4 gem "jquery-rails", "~> 2.0.2"
5 gem "coderay", "~> 1.1.0"
5 gem "coderay", "~> 1.1.0"
6 gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
6 gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
7 gem "builder", "3.0.0"
7 gem "builder", "3.0.0"
8
8
9 # Optional gem for LDAP authentication
9 # Optional gem for LDAP authentication
10 group :ldap do
10 group :ldap do
11 gem "net-ldap", "~> 0.3.1"
11 gem "net-ldap", "~> 0.3.1"
12 end
12 end
13
13
14 # Optional gem for OpenID authentication
14 # Optional gem for OpenID authentication
15 group :openid do
15 group :openid do
16 gem "ruby-openid", "~> 2.3.0", :require => "openid"
16 gem "ruby-openid", "~> 2.3.0", :require => "openid"
17 gem "rack-openid"
17 gem "rack-openid"
18 end
18 end
19
19
20 # Optional gem for exporting the gantt to a PNG file, not supported with jruby
20 # Optional gem for exporting the gantt to a PNG file, not supported with jruby
21 platforms :mri, :mingw do
21 platforms :mri, :mingw do
22 group :rmagick do
22 group :rmagick do
23 # RMagick 2 supports ruby 1.9
23 # RMagick 2 supports ruby 1.9
24 # RMagick 1 would be fine for ruby 1.8 but Bundler does not support
24 # RMagick 1 would be fine for ruby 1.8 but Bundler does not support
25 # different requirements for the same gem on different platforms
25 # different requirements for the same gem on different platforms
26 gem "rmagick", ">= 2.0.0"
26 gem "rmagick", ">= 2.0.0"
27 end
27 end
28 end
28 end
29
29
30 platforms :jruby do
30 platforms :jruby do
31 # jruby-openssl is bundled with JRuby 1.7.0
31 # jruby-openssl is bundled with JRuby 1.7.0
32 gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0'
32 gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0'
33 gem "activerecord-jdbc-adapter", "~> 1.3.2"
33 gem "activerecord-jdbc-adapter", "~> 1.3.2"
34 end
34 end
35
35
36 # Include database gems for the adapters found in the database
36 # Include database gems for the adapters found in the database
37 # configuration file
37 # configuration file
38 require 'erb'
38 require 'erb'
39 require 'yaml'
39 require 'yaml'
40 database_file = File.join(File.dirname(__FILE__), "config/database.yml")
40 database_file = File.join(File.dirname(__FILE__), "config/database.yml")
41 if File.exist?(database_file)
41 if File.exist?(database_file)
42 database_config = YAML::load(ERB.new(IO.read(database_file)).result)
42 database_config = YAML::load(ERB.new(IO.read(database_file)).result)
43 adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
43 adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
44 if adapters.any?
44 if adapters.any?
45 adapters.each do |adapter|
45 adapters.each do |adapter|
46 case adapter
46 case adapter
47 when 'mysql2'
47 when 'mysql2'
48 gem "mysql2", "~> 0.3.11", :platforms => [:mri, :mingw]
48 gem "mysql2", "~> 0.3.11", :platforms => [:mri, :mingw]
49 gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
49 gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
50 when 'mysql'
50 when 'mysql'
51 gem "mysql", "~> 2.8.1", :platforms => [:mri, :mingw]
51 gem "mysql", "~> 2.8.1", :platforms => [:mri, :mingw]
52 gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
52 gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
53 when /postgresql/
53 when /postgresql/
54 gem "pg", ">= 0.11.0", :platforms => [:mri, :mingw]
54 gem "pg", ">= 0.11.0", :platforms => [:mri, :mingw]
55 gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby
55 gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby
56 when /sqlite3/
56 when /sqlite3/
57 gem "sqlite3", :platforms => [:mri, :mingw]
57 gem "sqlite3", :platforms => [:mri, :mingw]
58 gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
58 gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
59 when /sqlserver/
59 when /sqlserver/
60 gem "tiny_tds", "~> 0.5.1", :platforms => [:mri, :mingw]
60 gem "tiny_tds", "~> 0.5.1", :platforms => [:mri, :mingw]
61 gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw]
61 gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw]
62 else
62 else
63 warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems")
63 warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems")
64 end
64 end
65 end
65 end
66 else
66 else
67 warn("No adapter found in config/database.yml, please configure it first")
67 warn("No adapter found in config/database.yml, please configure it first")
68 end
68 end
69 else
69 else
70 warn("Please configure your config/database.yml first")
70 warn("Please configure your config/database.yml first")
71 end
71 end
72
72
73 group :development do
73 group :development do
74 gem "rdoc", ">= 2.4.2"
74 gem "rdoc", ">= 2.4.2"
75 gem "yard"
75 gem "yard"
76 end
76 end
77
77
78 group :test do
78 group :test do
79 gem "shoulda", "~> 3.3.2"
79 gem "shoulda", "~> 3.3.2"
80 gem "mocha", ">= 0.14", :require => 'mocha/api'
80 gem "mocha", ">= 0.14", :require => 'mocha/api'
81 if RUBY_VERSION >= '1.9.3'
81 if RUBY_VERSION >= '1.9.3'
82 gem "capybara", "~> 2.1.0"
82 gem "capybara", "~> 2.1.0"
83 gem "selenium-webdriver"
83 gem "selenium-webdriver"
84 gem "database_cleaner"
85 end
84 end
86 end
85 end
87
86
88 local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
87 local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
89 if File.exists?(local_gemfile)
88 if File.exists?(local_gemfile)
90 puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v`
89 puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v`
91 instance_eval File.read(local_gemfile)
90 instance_eval File.read(local_gemfile)
92 end
91 end
93
92
94 # Load plugins' Gemfiles
93 # Load plugins' Gemfiles
95 Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
94 Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
96 puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
95 puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
97 #TODO: switch to "eval_gemfile file" when bundler >= 1.2.0 will be required (rails 4)
96 #TODO: switch to "eval_gemfile file" when bundler >= 1.2.0 will be required (rails 4)
98 instance_eval File.read(file), file
97 instance_eval File.read(file), file
99 end
98 end
@@ -1,72 +1,69
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2013 Jean-Philippe Lang
2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19 require 'capybara/rails'
19 require 'capybara/rails'
20
20
21 Capybara.default_driver = :selenium
21 Capybara.default_driver = :selenium
22 Capybara.register_driver :selenium do |app|
22 Capybara.register_driver :selenium do |app|
23 # Use the following driver definition to test locally using Chrome
23 # Use the following driver definition to test locally using Chrome
24 # (also requires chromedriver to be in PATH)
24 # (also requires chromedriver to be in PATH)
25 # Capybara::Selenium::Driver.new(app, :browser => :chrome)
25 # Capybara::Selenium::Driver.new(app, :browser => :chrome)
26 # Add :switches => %w[--lang=en] to force default browser locale to English
26 # Add :switches => %w[--lang=en] to force default browser locale to English
27 # Default for Selenium remote driver is to connect to local host on port 4444
27 # Default for Selenium remote driver is to connect to local host on port 4444
28 # This can be change using :url => 'http://localhost:9195' if necessary
28 # This can be change using :url => 'http://localhost:9195' if necessary
29 # PhantomJS 1.8 now directly supports Webdriver Wire API,
29 # PhantomJS 1.8 now directly supports Webdriver Wire API,
30 # simply run it with `phantomjs --webdriver 4444`
30 # simply run it with `phantomjs --webdriver 4444`
31 # Add :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.internet_explorer)
31 # Add :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.internet_explorer)
32 # to run on Selenium Grid Hub with IE
32 # to run on Selenium Grid Hub with IE
33 Capybara::Selenium::Driver.new(app, :browser => :remote)
33 Capybara::Selenium::Driver.new(app, :browser => :remote)
34 end
34 end
35
35
36 # default: 2
36 # default: 2
37 Capybara.default_wait_time = 2
37 Capybara.default_wait_time = 2
38
38
39 DatabaseCleaner.strategy = :truncation
40
41 module Redmine
39 module Redmine
42 module UiTest
40 module UiTest
43 # Base class for UI tests
41 # Base class for UI tests
44 class Base < ActionDispatch::IntegrationTest
42 class Base < ActionDispatch::IntegrationTest
45 include Capybara::DSL
43 include Capybara::DSL
46
44
47 # Stop ActiveRecord from wrapping tests in transactions
45 # Stop ActiveRecord from wrapping tests in transactions
48 # Transactional fixtures do not work with Selenium tests, because Capybara
46 # Transactional fixtures do not work with Selenium tests, because Capybara
49 # uses a separate server thread, which the transactions would be hidden
47 # uses a separate server thread, which the transactions would be hidden
50 self.use_transactional_fixtures = false
48 self.use_transactional_fixtures = false
51
49
52 # Should not depend on locale since Redmine displays login page
50 # Should not depend on locale since Redmine displays login page
53 # using default browser locale which depend on system locale for "real" browsers drivers
51 # using default browser locale which depend on system locale for "real" browsers drivers
54 def log_user(login, password)
52 def log_user(login, password)
55 visit '/my/page'
53 visit '/my/page'
56 assert_equal '/login', current_path
54 assert_equal '/login', current_path
57 within('#login-form form') do
55 within('#login-form form') do
58 fill_in 'username', :with => login
56 fill_in 'username', :with => login
59 fill_in 'password', :with => password
57 fill_in 'password', :with => password
60 find('input[name=login]').click
58 find('input[name=login]').click
61 end
59 end
62 assert_equal '/my/page', current_path
60 assert_equal '/my/page', current_path
63 end
61 end
64
62
65 teardown do
63 teardown do
66 Capybara.reset_sessions! # Forget the (simulated) browser state
64 Capybara.reset_sessions! # Forget the (simulated) browser state
67 Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver
65 Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver
68 DatabaseCleaner.clean
69 end
66 end
70 end
67 end
71 end
68 end
72 end
69 end
General Comments 0
You need to be logged in to leave comments. Login now