cucumber-rails 1.4.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/ISSUE_TEMPLATE.md +52 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- data/.gitignore +3 -0
- data/.rspec +4 -1
- data/.rubocop.yml +68 -0
- data/.travis.yml +53 -26
- data/Appraisals +27 -63
- data/{History.md → CHANGELOG.md} +299 -19
- data/CONTRIBUTING.md +18 -27
- data/Gemfile +2 -4
- data/LICENSE +1 -1
- data/README.md +73 -29
- data/Rakefile +18 -14
- data/bin/install_geckodriver.sh +19 -0
- data/bin/install_webpacker.sh +9 -0
- data/config/cucumber.yml +5 -3
- data/cucumber-rails.gemspec +37 -25
- data/dev_tasks/cucumber.rake +3 -3
- data/dev_tasks/rspec.rake +3 -6
- data/dev_tasks/yard/default/layout/html/footer.erb +1 -1
- data/dev_tasks/yard/default/layout/html/layout.erb +5 -5
- data/dev_tasks/yard/default/layout/html/logo.erb +1 -1
- data/dev_tasks/yard/default/layout/html/setup.rb +6 -1
- data/dev_tasks/yard.rake +7 -14
- data/features/allow_rescue.feature +17 -12
- data/features/annotations.feature +20 -0
- data/features/capybara_javascript_drivers.feature +42 -32
- data/features/choose_javascript_database_strategy.feature +38 -57
- data/features/configuration.feature +48 -0
- data/features/database_cleaner.feature +20 -20
- data/features/disable_automatic_database_cleaning.feature +13 -19
- data/features/emulate_javascript.feature +65 -48
- data/features/install_cucumber_rails.feature +6 -5
- data/features/no_database.feature +8 -15
- data/features/raising_errors.feature +10 -4
- data/features/rerun_profile.feature +18 -8
- data/features/rest_api.feature +13 -13
- data/features/step_definitions/cucumber_rails_steps.rb +52 -66
- data/features/support/aruba.rb +5 -0
- data/features/support/cucumber_rails_helper.rb +85 -0
- data/features/support/env.rb +4 -35
- data/features/support/hooks.rb +8 -0
- data/gemfiles/rails_4_2.gemfile +10 -0
- data/gemfiles/rails_5_0.gemfile +10 -0
- data/gemfiles/rails_5_1.gemfile +10 -0
- data/gemfiles/rails_5_2.gemfile +10 -0
- data/gemfiles/rails_6_0.gemfile +9 -0
- data/lib/cucumber/rails/action_dispatch.rb +21 -0
- data/lib/cucumber/rails/application.rb +17 -8
- data/lib/cucumber/rails/capybara/javascript_emulation.rb +47 -39
- data/lib/cucumber/rails/capybara/select_dates_and_times.rb +8 -6
- data/lib/cucumber/rails/capybara.rb +2 -0
- data/lib/cucumber/rails/database.rb +36 -17
- data/lib/cucumber/rails/hooks/active_record.rb +14 -12
- data/lib/cucumber/rails/hooks/allow_rescue.rb +2 -0
- data/lib/cucumber/rails/hooks/database_cleaner.rb +6 -4
- data/lib/cucumber/rails/hooks/mail.rb +4 -4
- data/lib/cucumber/rails/hooks.rb +2 -0
- data/lib/cucumber/rails/rspec.rb +5 -3
- data/lib/cucumber/rails/world.rb +26 -9
- data/lib/cucumber/rails.rb +21 -18
- data/lib/generators/cucumber/{install/USAGE → USAGE} +2 -2
- data/lib/generators/cucumber/{install/install_generator.rb → install_generator.rb} +28 -15
- data/lib/generators/cucumber/{install/templates → templates}/config/cucumber.yml.erb +4 -3
- data/lib/generators/cucumber/{install/templates → templates}/script/cucumber +1 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/_rails_each_run.rb.erb +4 -4
- data/lib/generators/cucumber/{install/templates → templates}/support/_rails_prefork.rb.erb +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/capybara.rb +2 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/edit_warning.txt +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/rails.rb.erb +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/rails_spork.rb.erb +2 -2
- data/lib/generators/cucumber/{install/templates → templates}/tasks/cucumber.rake.erb +19 -8
- data/spec/cucumber/rails/database_spec.rb +46 -33
- data/spec/generators/cucumber/install_generator_spec.rb +55 -0
- data/spec/spec_helper.rb +14 -2
- metadata +228 -142
- data/Gemfile.appraisal +0 -3
- data/features/step_definitions/mongo_steps.rb +0 -3
- data/features/support/bundler_pre_support.rb +0 -28
- data/features/support/fixtures/bundler-1.0.21.gem +0 -0
- data/features/support/fixtures/bundler-1.1.rc.gem +0 -0
- data/features/support/legacy_web_steps_support.rb +0 -290
- data/gemfiles/capybara_1_1.gemfile +0 -17
- data/gemfiles/rails_3_0.gemfile +0 -16
- data/gemfiles/rails_3_1.gemfile +0 -17
- data/gemfiles/rails_3_2.gemfile +0 -17
- data/gemfiles/rails_4_0.gemfile +0 -20
- data/lib/cucumber/rails/action_controller.rb +0 -12
- data/spec/generators/cucumber/install/install_generator_spec.rb +0 -47
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Rails
|
3
5
|
module Capybara
|
4
6
|
# This module defines methods for selecting dates and times
|
5
7
|
module SelectDatesAndTimes
|
6
|
-
# Select a Rails date. Options
|
8
|
+
# Select a Rails date. Options hash must include from: +label+
|
7
9
|
def select_date(date, options)
|
8
10
|
date = Date.parse(date)
|
9
11
|
base_dom_id = get_base_dom_id_from_label_tag(options[:from])
|
10
12
|
|
11
13
|
find(:xpath, ".//select[@id='#{base_dom_id}_1i']").select(date.year.to_s)
|
12
|
-
find(:xpath, ".//select[@id='#{base_dom_id}_2i']").select(I18n.l
|
14
|
+
find(:xpath, ".//select[@id='#{base_dom_id}_2i']").select(I18n.l(date, format: '%B'))
|
13
15
|
find(:xpath, ".//select[@id='#{base_dom_id}_3i']").select(date.day.to_s)
|
14
16
|
end
|
15
|
-
|
16
|
-
# Select a Rails time. Options
|
17
|
+
|
18
|
+
# Select a Rails time. Options hash must include from: +label+
|
17
19
|
def select_time(time, options)
|
18
20
|
time = Time.zone.parse(time)
|
19
21
|
base_dom_id = get_base_dom_id_from_label_tag(options[:from])
|
@@ -21,8 +23,8 @@ module Cucumber
|
|
21
23
|
find(:xpath, ".//select[@id='#{base_dom_id}_4i']").select(time.hour.to_s.rjust(2, '0'))
|
22
24
|
find(:xpath, ".//select[@id='#{base_dom_id}_5i']").select(time.min.to_s.rjust(2, '0'))
|
23
25
|
end
|
24
|
-
|
25
|
-
# Select a Rails datetime. Options
|
26
|
+
|
27
|
+
# Select a Rails datetime. Options hash must include from: +label+
|
26
28
|
def select_datetime(datetime, options)
|
27
29
|
select_date(datetime, options)
|
28
30
|
select_time(datetime, options)
|
@@ -1,13 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Rails
|
3
5
|
module Database
|
6
|
+
CUSTOM_STRATEGY_INTERFACE = %w[before_js before_non_js].freeze
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
class InvalidStrategy < ArgumentError;end
|
8
|
+
class InvalidStrategy < ArgumentError; end
|
8
9
|
|
9
10
|
class << self
|
10
|
-
|
11
11
|
attr_accessor :autorun_database_cleaner
|
12
12
|
|
13
13
|
def javascript_strategy=(args)
|
@@ -15,12 +15,12 @@ module Cucumber
|
|
15
15
|
strategy_type =
|
16
16
|
case strategy
|
17
17
|
when Symbol
|
18
|
-
map[strategy] ||
|
18
|
+
map[strategy] || throw_invalid_strategy_error(strategy)
|
19
19
|
when Class
|
20
20
|
strategy
|
21
21
|
end
|
22
22
|
|
23
|
-
@strategy =
|
23
|
+
@strategy = strategy_type.new(*strategy_opts)
|
24
24
|
|
25
25
|
validate_interface!
|
26
26
|
end
|
@@ -37,32 +37,50 @@ module Cucumber
|
|
37
37
|
@strategy.after
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
private
|
41
41
|
|
42
42
|
def map
|
43
43
|
{
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
44
|
+
truncation: TruncationStrategy,
|
45
|
+
shared_connection: SharedConnectionStrategy,
|
46
|
+
transaction: SharedConnectionStrategy,
|
47
|
+
deletion: DeletionStrategy
|
48
48
|
}
|
49
49
|
end
|
50
50
|
|
51
|
+
def throw_invalid_strategy_error(strategy)
|
52
|
+
raise(InvalidStrategy, "The strategy '#{strategy}' is not understood. Please use one of #{mapped_keys}")
|
53
|
+
end
|
54
|
+
|
55
|
+
def mapped_keys
|
56
|
+
map.keys.join(', ')
|
57
|
+
end
|
58
|
+
|
51
59
|
def validate_interface!
|
52
|
-
|
53
|
-
|
54
|
-
|
60
|
+
return if CUSTOM_STRATEGY_INTERFACE.all? { |m| @strategy.respond_to?(m) }
|
61
|
+
|
62
|
+
throw_invalid_strategy_interface_error
|
55
63
|
end
|
56
64
|
|
65
|
+
def throw_invalid_strategy_interface_error
|
66
|
+
raise(
|
67
|
+
ArgumentError,
|
68
|
+
"Strategy must respond to all of: #{CUSTOM_STRATEGY_INTERFACE.map { |method| "##{method}" } * ' '} !"
|
69
|
+
)
|
70
|
+
end
|
57
71
|
end
|
58
72
|
|
59
73
|
class Strategy
|
60
|
-
def initialize(options={})
|
61
|
-
@options=options
|
74
|
+
def initialize(options = {})
|
75
|
+
@options = options
|
62
76
|
end
|
63
77
|
|
64
78
|
def before_js(strategy)
|
65
|
-
@original_strategy = DatabaseCleaner.
|
79
|
+
@original_strategy = if Gem::Version.new(DatabaseCleaner::VERSION) >= Gem::Version.new('1.8.0.beta')
|
80
|
+
DatabaseCleaner.cleaners.values.first.strategy # that feels like a nasty hack
|
81
|
+
else
|
82
|
+
DatabaseCleaner.connections.first.strategy # that feels like a nasty hack
|
83
|
+
end
|
66
84
|
DatabaseCleaner.strategy = strategy, @options
|
67
85
|
end
|
68
86
|
|
@@ -72,6 +90,7 @@ module Cucumber
|
|
72
90
|
|
73
91
|
def after
|
74
92
|
return unless @original_strategy
|
93
|
+
|
75
94
|
DatabaseCleaner.strategy = @original_strategy
|
76
95
|
@original_strategy = nil
|
77
96
|
end
|
@@ -1,21 +1,23 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
class Base
|
3
5
|
class_attribute :shared_connection
|
4
6
|
|
5
7
|
def self.connection
|
6
|
-
|
8
|
+
shared_connection || retrieve_connection
|
7
9
|
end
|
8
10
|
end
|
11
|
+
end
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
+
Before('@javascript') do
|
14
|
+
Cucumber::Rails::Database.before_js if Cucumber::Rails::Database.autorun_database_cleaner
|
15
|
+
end
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
Before('not @javascript') do
|
18
|
+
Cucumber::Rails::Database.before_non_js if Cucumber::Rails::Database.autorun_database_cleaner
|
19
|
+
end
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
+
After do
|
22
|
+
Cucumber::Rails::Database.after if Cucumber::Rails::Database.autorun_database_cleaner
|
21
23
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
4
|
require 'database_cleaner'
|
3
5
|
|
4
|
-
Before('
|
6
|
+
Before('not @no-database-cleaner') do
|
5
7
|
DatabaseCleaner.start if Cucumber::Rails::Database.autorun_database_cleaner
|
6
8
|
end
|
7
9
|
|
8
|
-
After('
|
10
|
+
After('not @no-database-cleaner') do
|
9
11
|
DatabaseCleaner.clean if Cucumber::Rails::Database.autorun_database_cleaner
|
10
12
|
end
|
11
|
-
|
12
|
-
|
13
|
+
rescue LoadError
|
14
|
+
Cucumber.logger.debug('database_cleaner gem not present.')
|
13
15
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Before do
|
4
|
+
ActionMailer::Base.deliveries = []
|
5
5
|
end
|
data/lib/cucumber/rails/hooks.rb
CHANGED
data/lib/cucumber/rails/rspec.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cucumber/rails/world'
|
2
4
|
|
3
5
|
begin
|
4
6
|
require 'rspec/rails/matchers'
|
5
7
|
|
6
|
-
[Cucumber::Rails::World,
|
8
|
+
[Cucumber::Rails::World, ActionDispatch::Integration::Session].each do |klass|
|
7
9
|
klass.class_eval do
|
8
10
|
include RSpec::Matchers
|
9
11
|
end
|
10
12
|
end
|
11
|
-
rescue LoadError
|
13
|
+
rescue LoadError
|
12
14
|
require 'spec/expectations'
|
13
15
|
require 'spec/rails'
|
14
16
|
|
15
|
-
[Cucumber::Rails::World,
|
17
|
+
[Cucumber::Rails::World, ActionDispatch::Integration::Session].each do |klass|
|
16
18
|
klass.class_eval do
|
17
19
|
include Spec::Matchers
|
18
20
|
include Spec::Rails::Matchers if defined?(Spec::Rails::Matchers)
|
data/lib/cucumber/rails/world.rb
CHANGED
@@ -1,21 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
4
|
# Try to load it so we can assign @_result below if needed.
|
3
5
|
require 'test/unit/testresult'
|
4
|
-
rescue LoadError
|
6
|
+
rescue LoadError
|
7
|
+
Cucumber.logger.debug('Minitest not found.')
|
8
|
+
end
|
9
|
+
|
10
|
+
module Cucumber
|
11
|
+
module Rails
|
12
|
+
class << self
|
13
|
+
def include_rack_test_helpers?
|
14
|
+
# Using ActiveModel Boolean casting here will give false positives more often than not!
|
15
|
+
!ENV['CR_REMOVE_RACK_TEST_HELPERS']&.casecmp('true')&.zero?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
5
19
|
end
|
6
20
|
|
7
|
-
module Cucumber
|
8
|
-
module Rails
|
9
|
-
class World < ActionDispatch::IntegrationTest
|
10
|
-
include Rack::Test::Methods
|
11
|
-
include ActiveSupport::Testing::SetupAndTeardown if ActiveSupport::Testing.const_defined?(
|
21
|
+
module Cucumber
|
22
|
+
module Rails
|
23
|
+
class World < ::ActionDispatch::IntegrationTest
|
24
|
+
include Rack::Test::Methods if Cucumber::Rails.include_rack_test_helpers?
|
25
|
+
include ActiveSupport::Testing::SetupAndTeardown if ActiveSupport::Testing.const_defined?('SetupAndTeardown')
|
12
26
|
|
13
|
-
def initialize
|
27
|
+
def initialize
|
14
28
|
@_result = Test::Unit::TestResult.new if defined?(Test::Unit::TestResult)
|
15
29
|
end
|
16
30
|
|
17
|
-
|
18
|
-
|
31
|
+
unless defined?(ActiveRecord::Base)
|
32
|
+
# Workaround for projects that don't use ActiveRecord
|
33
|
+
def self.fixture_table_names
|
34
|
+
[]
|
35
|
+
end
|
19
36
|
end
|
20
37
|
end
|
21
38
|
end
|
data/lib/cucumber/rails.rb
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
called_from_env_rb = caller.detect { |f| f =~ /\/env\.rb:/ }
|
4
|
+
|
5
|
+
if called_from_env_rb
|
6
|
+
env_caller = File.dirname(called_from_env_rb)
|
7
|
+
|
3
8
|
require 'rails'
|
4
9
|
require 'cucumber/rails/application'
|
5
|
-
ENV[
|
6
|
-
ENV[
|
7
|
-
require File.expand_path(ENV[
|
8
|
-
require 'cucumber/rails/
|
9
|
-
|
10
|
-
if defined?(ActiveRecord::Base)
|
11
|
-
require 'rails/test_help'
|
12
|
-
else
|
13
|
-
require 'action_dispatch/testing/test_process'
|
14
|
-
require 'action_dispatch/testing/integration'
|
15
|
-
end
|
10
|
+
ENV['RAILS_ENV'] ||= 'test'
|
11
|
+
ENV['RAILS_ROOT'] ||= File.expand_path(env_caller + '/../..')
|
12
|
+
require File.expand_path(ENV['RAILS_ROOT'] + '/config/environment')
|
13
|
+
require 'cucumber/rails/action_dispatch'
|
14
|
+
require 'rails/test_help'
|
16
15
|
|
17
|
-
|
18
|
-
warn "WARNING: You have set Rails' config.cache_classes to false
|
16
|
+
unless Rails.application.config.cache_classes || defined?(Spring)
|
17
|
+
warn "WARNING: You have set Rails' config.cache_classes to false
|
18
|
+
(Spring needs cache_classes set to false). This is known to cause problems
|
19
|
+
with database transactions. Set config.cache_classes to true if you want to use transactions."
|
19
20
|
end
|
20
21
|
|
21
22
|
require 'cucumber/rails/world'
|
@@ -23,8 +24,10 @@ if env_caller
|
|
23
24
|
require 'cucumber/rails/capybara'
|
24
25
|
require 'cucumber/rails/database'
|
25
26
|
|
27
|
+
MultiTest.disable_autorun
|
26
28
|
else
|
27
|
-
warn "WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being deferred
|
28
|
-
To avoid this warning, move 'gem \'cucumber-rails\', :
|
29
|
-
If already in the :test group, be sure you are
|
29
|
+
warn "WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being deferred
|
30
|
+
until env.rb is called. To avoid this warning, move 'gem \'cucumber-rails\', require: false'
|
31
|
+
under only group :test in your Gemfile. If already in the :test group, be sure you are
|
32
|
+
specifying 'require: false'."
|
30
33
|
end
|
@@ -1,13 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rbconfig'
|
2
4
|
|
3
5
|
module Cucumber
|
4
6
|
class InstallGenerator < ::Rails::Generators::Base
|
5
|
-
source_root File.expand_path(
|
7
|
+
source_root File.expand_path('templates', __dir__)
|
6
8
|
|
7
9
|
DEFAULT_SHEBANG = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
8
10
|
|
9
|
-
class_option :spork,
|
10
|
-
|
11
|
+
class_option :spork,
|
12
|
+
type: :boolean,
|
13
|
+
desc: 'Use Spork'
|
14
|
+
|
15
|
+
class_option :skip_database,
|
16
|
+
type: :boolean,
|
17
|
+
desc: 'Skip modification of database.yml',
|
18
|
+
aliases: '-D',
|
19
|
+
default: false
|
11
20
|
|
12
21
|
def create_templates
|
13
22
|
template 'config/cucumber.yml.erb', 'config/cucumber.yml'
|
@@ -20,6 +29,7 @@ module Cucumber
|
|
20
29
|
|
21
30
|
def create_step_definitions
|
22
31
|
empty_directory 'features/step_definitions'
|
32
|
+
create_file 'features/step_definitions/.gitkeep'
|
23
33
|
end
|
24
34
|
|
25
35
|
def create_feature_support
|
@@ -38,13 +48,13 @@ module Cucumber
|
|
38
48
|
|
39
49
|
def create_database
|
40
50
|
return unless File.exist?('config/database.yml')
|
41
|
-
unless File.read('config/database.yml').include? 'cucumber:'
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
51
|
+
return unless File.read('config/database.yml').include? 'cucumber:'
|
52
|
+
|
53
|
+
gsub_file 'config/database.yml', /^test:.*\n/, "test: &test\n"
|
54
|
+
gsub_file 'config/database.yml', /\z/, "\ncucumber:\n <<: *test\n"
|
55
|
+
|
56
|
+
# Since gsub_file doesn't ask the user, just inform user that the file was overwritten.
|
57
|
+
puts ' force config/database.yml'
|
48
58
|
end
|
49
59
|
|
50
60
|
protected
|
@@ -53,14 +63,17 @@ module Cucumber
|
|
53
63
|
options[:spork]
|
54
64
|
end
|
55
65
|
|
56
|
-
def embed_file(source, indent='')
|
66
|
+
def embed_file(source, indent = '')
|
57
67
|
IO.read(File.join(self.class.source_root, source)).gsub(/^/, indent)
|
58
68
|
end
|
59
69
|
|
60
|
-
def embed_template(source, indent='')
|
70
|
+
def embed_template(source, indent = '')
|
61
71
|
template = File.join(self.class.source_root, source)
|
62
|
-
|
72
|
+
if RUBY_VERSION >= '2.6'
|
73
|
+
ERB.new(IO.read(template), trim_mode: '-').result(binding).gsub(/^/, indent)
|
74
|
+
else
|
75
|
+
ERB.new(IO.read(template), nil, '-').result(binding).gsub(/^/, indent)
|
76
|
+
end
|
63
77
|
end
|
64
|
-
|
65
78
|
end
|
66
|
-
end
|
79
|
+
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
<%%
|
2
2
|
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
-
|
4
|
-
|
3
|
+
rerun = rerun.strip.gsub /\s/, ' '
|
4
|
+
rerun_opts = rerun.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
5
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags 'not @wip'"
|
5
6
|
%>
|
6
7
|
default: <%= spork? ? '--drb ' : '' %><%%= std_opts %> features
|
7
8
|
wip: <%= spork? ? '--drb ' : '' %>--tags @wip:3 --wip features
|
8
|
-
rerun: <%= spork? ? '--drb ' : '' %><%%= rerun_opts %> --format rerun --out rerun.txt --strict --tags
|
9
|
+
rerun: <%= spork? ? '--drb ' : '' %><%%= rerun_opts %> --format rerun --out rerun.txt --strict --tags 'not @wip'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# By default, any exception happening in your Rails application will bubble up
|
2
|
-
# to Cucumber so that your scenario will fail. This is a different from how
|
3
|
-
# your application behaves in the production environment, where an error page will
|
2
|
+
# to Cucumber so that your scenario will fail. This is a different from how
|
3
|
+
# your application behaves in the production environment, where an error page will
|
4
4
|
# be rendered instead.
|
5
5
|
#
|
6
6
|
# Sometimes we want to override this default behaviour and allow Rails to rescue
|
@@ -27,13 +27,13 @@ end
|
|
27
27
|
# See the DatabaseCleaner documentation for details. Example:
|
28
28
|
#
|
29
29
|
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
|
30
|
-
# # { :
|
30
|
+
# # { except: [:widgets] } may not do what you expect here
|
31
31
|
# # as Cucumber::Rails::Database.javascript_strategy overrides
|
32
32
|
# # this setting.
|
33
33
|
# DatabaseCleaner.strategy = :truncation
|
34
34
|
# end
|
35
35
|
#
|
36
|
-
# Before('
|
36
|
+
# Before('not @no-txn', 'not @selenium', 'not @culerity', 'not @celerity', 'not @javascript') do
|
37
37
|
# DatabaseCleaner.strategy = :transaction
|
38
38
|
# end
|
39
39
|
#
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<%= embed_file('support/edit_warning.txt') %>
|
2
2
|
require 'rubygems'
|
3
3
|
require 'spork'
|
4
|
-
|
4
|
+
|
5
5
|
Spork.prefork do
|
6
6
|
<%= embed_template('support/_rails_prefork.rb.erb', ' ') %>
|
7
7
|
|
8
8
|
<%= embed_file("support/capybara.rb", ' ') %>
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
Spork.each_run do
|
12
12
|
<%= embed_template('support/_rails_each_run.rb.erb', ' ') %>
|
13
13
|
end
|
@@ -9,39 +9,48 @@ begin
|
|
9
9
|
require 'cucumber/rake/task'
|
10
10
|
|
11
11
|
namespace :cucumber do
|
12
|
-
Cucumber::Rake::Task.new({:
|
12
|
+
Cucumber::Rake::Task.new({ok: 'test:prepare'}, 'Run features that should pass') do |t|
|
13
13
|
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
14
14
|
t.fork = true # You may get faster startup if you set this to false
|
15
15
|
t.profile = 'default'
|
16
16
|
end
|
17
17
|
|
18
|
-
Cucumber::Rake::Task.new({:
|
18
|
+
Cucumber::Rake::Task.new({wip: 'test:prepare'}, 'Run features that are being worked on') do |t|
|
19
19
|
t.binary = vendored_cucumber_bin
|
20
20
|
t.fork = true # You may get faster startup if you set this to false
|
21
21
|
t.profile = 'wip'
|
22
22
|
end
|
23
23
|
|
24
|
-
Cucumber::Rake::Task.new({:
|
24
|
+
Cucumber::Rake::Task.new({rerun: 'test:prepare'}, 'Record failing features and run only them if any exist') do |t|
|
25
25
|
t.binary = vendored_cucumber_bin
|
26
26
|
t.fork = true # You may get faster startup if you set this to false
|
27
27
|
t.profile = 'rerun'
|
28
28
|
end
|
29
29
|
|
30
30
|
desc 'Run all features'
|
31
|
-
task :
|
31
|
+
task all: [:ok, :wip]
|
32
32
|
|
33
33
|
task :statsetup do
|
34
34
|
require 'rails/code_statistics'
|
35
35
|
::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
|
36
36
|
::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
|
37
37
|
end
|
38
|
+
|
39
|
+
task :annotations_setup do
|
40
|
+
Rails.application.configure do
|
41
|
+
if config.respond_to?(:annotations)
|
42
|
+
config.annotations.directories << 'features'
|
43
|
+
config.annotations.register_extensions('feature') { |tag| /#\s*(#{tag}):?\s*(.*)$/ }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
38
47
|
end
|
39
48
|
desc 'Alias for cucumber:ok'
|
40
|
-
task :
|
49
|
+
task cucumber: 'cucumber:ok'
|
41
50
|
|
42
|
-
task :
|
51
|
+
task default: :cucumber
|
43
52
|
|
44
|
-
task :
|
53
|
+
task features: :cucumber do
|
45
54
|
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
46
55
|
end
|
47
56
|
|
@@ -49,7 +58,9 @@ begin
|
|
49
58
|
task 'test:prepare' do
|
50
59
|
end
|
51
60
|
|
52
|
-
task :
|
61
|
+
task stats: 'cucumber:statsetup'
|
62
|
+
|
63
|
+
task notes: 'cucumber:annotations_setup'
|
53
64
|
rescue LoadError
|
54
65
|
desc 'cucumber rake task not available (cucumber not installed)'
|
55
66
|
task :cucumber do
|