cucumber-rails 1.7.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +197 -19
- data/CONTRIBUTING.md +16 -14
- data/LICENSE +1 -1
- data/README.md +27 -21
- data/lib/cucumber/rails.rb +23 -17
- data/lib/cucumber/rails/action_dispatch.rb +21 -0
- data/lib/cucumber/rails/application.rb +16 -7
- data/lib/cucumber/rails/capybara.rb +2 -0
- data/lib/cucumber/rails/capybara/javascript_emulation.rb +42 -21
- data/lib/cucumber/rails/capybara/select_dates_and_times.rb +3 -1
- data/lib/cucumber/rails/database.rb +24 -56
- data/lib/cucumber/rails/database/deletion_strategy.rb +13 -0
- data/lib/cucumber/rails/database/shared_connection_strategy.rb +27 -0
- data/lib/cucumber/rails/database/strategy.rb +33 -0
- data/lib/cucumber/rails/database/truncation_strategy.rb +13 -0
- data/lib/cucumber/rails/hooks.rb +2 -0
- data/lib/cucumber/rails/hooks/active_record.rb +8 -4
- data/lib/cucumber/rails/hooks/allow_rescue.rb +2 -0
- data/lib/cucumber/rails/hooks/database_cleaner.rb +11 -3
- data/lib/cucumber/rails/hooks/mail.rb +3 -1
- data/lib/cucumber/rails/rspec.rb +3 -1
- data/lib/cucumber/rails/world.rb +24 -7
- data/lib/generators/cucumber/{install/USAGE → USAGE} +0 -0
- data/lib/generators/cucumber/{install/install_generator.rb → install_generator.rb} +18 -9
- data/lib/generators/cucumber/{install/templates → templates}/config/cucumber.yml.erb +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/script/cucumber +1 -0
- data/lib/generators/cucumber/{install/templates → templates}/support/_rails_each_run.rb.erb +0 -0
- 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 +0 -0
- data/lib/generators/cucumber/{install/templates → templates}/tasks/cucumber.rake.erb +0 -0
- metadata +100 -169
- data/.github/ISSUE_TEMPLATE.md +0 -52
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -42
- data/.gitignore +0 -13
- data/.rspec +0 -1
- data/.rubocop.yml +0 -1
- data/.rubocop_todo.yml +0 -443
- data/.travis.yml +0 -45
- data/Appraisals +0 -32
- data/Gemfile +0 -7
- data/Rakefile +0 -49
- data/bin/install_geckodriver.sh +0 -19
- data/bin/install_webpacker.sh +0 -9
- data/config/.gitignore +0 -1
- data/config/cucumber.yml +0 -17
- data/cucumber-rails.gemspec +0 -44
- data/dev_tasks/cucumber.rake +0 -3
- data/dev_tasks/rspec.rake +0 -3
- data/dev_tasks/yard.rake +0 -35
- data/dev_tasks/yard/default/layout/html/bubble_32x32.png +0 -0
- data/dev_tasks/yard/default/layout/html/footer.erb +0 -5
- data/dev_tasks/yard/default/layout/html/index.erb +0 -1
- data/dev_tasks/yard/default/layout/html/layout.erb +0 -25
- data/dev_tasks/yard/default/layout/html/logo.erb +0 -1
- data/dev_tasks/yard/default/layout/html/setup.rb +0 -4
- data/features/allow_rescue.feature +0 -65
- data/features/annotations.feature +0 -22
- data/features/capybara_javascript_drivers.feature +0 -73
- data/features/choose_javascript_database_strategy.feature +0 -145
- data/features/database_cleaner.feature +0 -44
- data/features/disable_automatic_database_cleaning.feature +0 -55
- data/features/emulate_javascript.feature +0 -94
- data/features/install_cucumber_rails.feature +0 -14
- data/features/no_database.feature +0 -61
- data/features/raising_errors.feature +0 -16
- data/features/rerun_profile.feature +0 -46
- data/features/rest_api.feature +0 -47
- data/features/step_definitions/cucumber_rails_steps.rb +0 -153
- data/features/support/aruba.rb +0 -3
- data/features/support/bundler_pre_support.rb +0 -28
- data/features/support/env.rb +0 -40
- 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 -289
- data/gemfiles/rails_4_2.gemfile +0 -10
- data/gemfiles/rails_5_0.gemfile +0 -10
- data/gemfiles/rails_5_1.gemfile +0 -10
- data/gemfiles/rails_5_2.gemfile +0 -10
- data/gemfiles/rails_6_0.gemfile +0 -8
- data/lib/cucumber/rails/action_controller.rb +0 -13
- data/spec/cucumber/rails/database_spec.rb +0 -57
- data/spec/generators/cucumber/install/install_generator_spec.rb +0 -47
- data/spec/spec_helper.rb +0 -14
@@ -1,145 +0,0 @@
|
|
1
|
-
Feature: Choose javascript database strategy
|
2
|
-
|
3
|
-
When running a scenario with the @javascript tag, Capybara will fire up a web server
|
4
|
-
in the same process in a separate thread to your cukes. By default, this means ActiveRecord will give it a
|
5
|
-
separate database connection, which in turn means data you put into your database from
|
6
|
-
Cucumber step definitions (e.g. using FactoryBot) won't be visible to the web server
|
7
|
-
until the database transaction is committed.
|
8
|
-
|
9
|
-
So if you use a transaction strategy for cleaning up your database at the end of a scenario,
|
10
|
-
it won't work for javascript scenarios by default.
|
11
|
-
|
12
|
-
There are two ways around this. One is to switch to a truncation strategy for javascript
|
13
|
-
scenarios. This is slower, but more reliable.
|
14
|
-
|
15
|
-
The alternative is to patch ActiveRecord to share a single database connection between
|
16
|
-
threads. This means you still get the speed benefits of using a transaction to roll back
|
17
|
-
your database, but you run the risk of the two threads stomping on one another as they
|
18
|
-
talk to the database.
|
19
|
-
|
20
|
-
Right now, the default behavior is to use truncation, but you can override this by telling
|
21
|
-
cucumber-rails which strategy to use for javascript scenarios.
|
22
|
-
|
23
|
-
The deletion strategy can be quicker for situations where truncation causes locks which
|
24
|
-
has been reported by some Oracle users.
|
25
|
-
|
26
|
-
Background:
|
27
|
-
Given I have created a new Rails app and installed cucumber-rails
|
28
|
-
And I have a "Widget" ActiveRecord model object
|
29
|
-
|
30
|
-
Scenario: Set the strategy to truncation and run a javascript scenario.
|
31
|
-
Given I append to "features/env.rb" with:
|
32
|
-
"""
|
33
|
-
DatabaseCleaner.strategy = :transaction
|
34
|
-
Cucumber::Rails::Database.javascript_strategy = :truncation
|
35
|
-
"""
|
36
|
-
And I write to "features/widgets.feature" with:
|
37
|
-
"""
|
38
|
-
Feature:
|
39
|
-
Background:
|
40
|
-
Given I have created 2 widgets
|
41
|
-
|
42
|
-
@javascript
|
43
|
-
Scenario:
|
44
|
-
Then the DatabaseCleaner strategy should be truncation
|
45
|
-
When I create 3 widgets
|
46
|
-
Then I should have 5 widgets
|
47
|
-
|
48
|
-
@javascript
|
49
|
-
Scenario:
|
50
|
-
Then the DatabaseCleaner strategy should be truncation
|
51
|
-
And I should have 2 widgets
|
52
|
-
|
53
|
-
Scenario:
|
54
|
-
Then the DatabaseCleaner strategy should be transaction
|
55
|
-
And I should have 2 widgets
|
56
|
-
"""
|
57
|
-
And I write to "features/step_definitions/widget_steps.rb" with:
|
58
|
-
"""
|
59
|
-
Given /created? (\d) widgets/ do |num|
|
60
|
-
num.to_i.times { Widget.create! }
|
61
|
-
end
|
62
|
-
|
63
|
-
Then /should have (\d) widgets/ do |num|
|
64
|
-
Widget.count.should == num.to_i
|
65
|
-
end
|
66
|
-
|
67
|
-
Then /^the DatabaseCleaner strategy should be (\w+)$/ do |strategy_name|
|
68
|
-
DatabaseCleaner.connections.first.strategy.to_s.should =~ /#{strategy_name}/i
|
69
|
-
end
|
70
|
-
"""
|
71
|
-
When I run the cukes
|
72
|
-
Then the feature run should pass with:
|
73
|
-
"""
|
74
|
-
3 scenarios (3 passed)
|
75
|
-
10 steps (10 passed)
|
76
|
-
"""
|
77
|
-
|
78
|
-
Scenario: Set the strategy to deletion and run a javascript scenario.
|
79
|
-
Given I append to "features/env.rb" with:
|
80
|
-
"""
|
81
|
-
Cucumber::Rails::Database.javascript_strategy = :deletion
|
82
|
-
"""
|
83
|
-
And I write to "features/widgets.feature" with:
|
84
|
-
"""
|
85
|
-
@javascript
|
86
|
-
Feature:
|
87
|
-
Background:
|
88
|
-
Given I have created 2 widgets
|
89
|
-
|
90
|
-
Scenario:
|
91
|
-
When I create 3 widgets
|
92
|
-
Then I should have 5 widgets
|
93
|
-
|
94
|
-
Scenario:
|
95
|
-
Then I should have 2 widgets
|
96
|
-
"""
|
97
|
-
And I write to "features/step_definitions/widget_steps.rb" with:
|
98
|
-
"""
|
99
|
-
Given /created? (\d) widgets/ do |num|
|
100
|
-
num.to_i.times { Widget.create! }
|
101
|
-
end
|
102
|
-
|
103
|
-
Then /should have (\d) widgets/ do |num|
|
104
|
-
Widget.count.should == num.to_i
|
105
|
-
end
|
106
|
-
"""
|
107
|
-
When I run the cukes
|
108
|
-
Then the feature run should pass with:
|
109
|
-
"""
|
110
|
-
2 scenarios (2 passed)
|
111
|
-
5 steps (5 passed)
|
112
|
-
"""
|
113
|
-
|
114
|
-
Scenario: Set the strategy to truncation with an except option and run a javascript scenario.
|
115
|
-
Given I append to "features/env.rb" with:
|
116
|
-
"""
|
117
|
-
Cucumber::Rails::Database.javascript_strategy = :truncation, {:except=>%w[widgets]}
|
118
|
-
"""
|
119
|
-
And I write to "features/widgets.feature" with:
|
120
|
-
"""
|
121
|
-
@javascript
|
122
|
-
Feature:
|
123
|
-
Scenario:
|
124
|
-
When I create 3 widgets
|
125
|
-
Then I should have 3 widgets
|
126
|
-
|
127
|
-
Scenario:
|
128
|
-
Then I should have 3 widgets
|
129
|
-
"""
|
130
|
-
And I write to "features/step_definitions/widget_steps.rb" with:
|
131
|
-
"""
|
132
|
-
Given /created? (\d) widgets/ do |num|
|
133
|
-
num.to_i.times { Widget.create! }
|
134
|
-
end
|
135
|
-
|
136
|
-
Then /should have (\d) widgets/ do |num|
|
137
|
-
Widget.count.should == num.to_i
|
138
|
-
end
|
139
|
-
"""
|
140
|
-
When I run the cukes
|
141
|
-
Then the feature run should pass with:
|
142
|
-
"""
|
143
|
-
2 scenarios (2 passed)
|
144
|
-
3 steps (3 passed)
|
145
|
-
"""
|
@@ -1,44 +0,0 @@
|
|
1
|
-
Feature: DatabaseCleaner
|
2
|
-
|
3
|
-
Scenario: Create records in background
|
4
|
-
Given I have created a new Rails app and installed cucumber-rails
|
5
|
-
And I write to "features/widgets.feature" with:
|
6
|
-
"""
|
7
|
-
Feature: Create widgets
|
8
|
-
Background: some widdgets
|
9
|
-
Given I have 2 widgets
|
10
|
-
|
11
|
-
Scenario: Add 3
|
12
|
-
When I create 3 more widgets
|
13
|
-
Then I should have 5 widgets
|
14
|
-
|
15
|
-
Scenario: Add 7
|
16
|
-
When I create 7 more widgets
|
17
|
-
Then I should have 9 widgets
|
18
|
-
"""
|
19
|
-
And I run `rails generate model widget name:string`
|
20
|
-
And I write to "features/step_definitions/widget_steps.rb" with:
|
21
|
-
"""
|
22
|
-
Given /^I have (\d+) widgets$/ do |n|
|
23
|
-
n.to_i.times do |i|
|
24
|
-
Widget.create! name: "Widget #{Widget.count + i}"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
When /^I create (\d+) more widgets$/ do |n|
|
29
|
-
n.to_i.times do |i|
|
30
|
-
Widget.create! name: "Widget #{Widget.count + i}"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
Then /^I should have (\d+) widgets$/ do |n|
|
35
|
-
Widget.count.should == n.to_i
|
36
|
-
end
|
37
|
-
"""
|
38
|
-
And I run `bundle exec rake db:migrate`
|
39
|
-
And I run `bundle exec rake cucumber`
|
40
|
-
Then the feature run should pass with:
|
41
|
-
"""
|
42
|
-
2 scenarios (2 passed)
|
43
|
-
6 steps (6 passed)
|
44
|
-
"""
|
@@ -1,55 +0,0 @@
|
|
1
|
-
Feature: Disable automatic database cleaning
|
2
|
-
|
3
|
-
By default, a set of Before/After hooks are installed to
|
4
|
-
invoke database_cleaner on every scenario except those tagged
|
5
|
-
"@no-database-cleaner". Sometimes when a user is switching between
|
6
|
-
cleaning strategies, this can initiate an undesired database
|
7
|
-
transaction.
|
8
|
-
|
9
|
-
To avoid the need for users making frequent strategy switches to apply
|
10
|
-
this tag, a configuration option is provided so that the user can
|
11
|
-
control the invocation of database_cleaner explicitly.
|
12
|
-
|
13
|
-
Scenario: Disabling automatic cleaning
|
14
|
-
Given I have created a new Rails app and installed cucumber-rails
|
15
|
-
And I append to "features/env.rb" with:
|
16
|
-
"""
|
17
|
-
Cucumber::Rails::Database.autorun_database_cleaner = false
|
18
|
-
"""
|
19
|
-
And I write to "features/widgets.feature" with:
|
20
|
-
"""
|
21
|
-
Feature: Create widgets
|
22
|
-
Scenario: Create 3 widgets
|
23
|
-
When I create 3 widgets
|
24
|
-
Then I should have 3 widgets
|
25
|
-
|
26
|
-
Scenario: Create 5 widgets
|
27
|
-
When I create 5 widgets
|
28
|
-
Then I should have 8 widgets
|
29
|
-
"""
|
30
|
-
And I run `rails generate model widget name:string`
|
31
|
-
And I write to "features/step_definitions/widget_steps.rb" with:
|
32
|
-
"""
|
33
|
-
Given /^I have (\d+) widgets$/ do |n|
|
34
|
-
n.to_i.times do |i|
|
35
|
-
Widget.create! name: "Widget #{Widget.count + i}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
When /^I create (\d+) widgets$/ do |n|
|
40
|
-
n.to_i.times do |i|
|
41
|
-
Widget.create! name: "Widget #{Widget.count + i}"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
Then /^I should have (\d+) widgets$/ do |n|
|
46
|
-
Widget.count.should == n.to_i
|
47
|
-
end
|
48
|
-
"""
|
49
|
-
And I run `bundle exec rake db:migrate`
|
50
|
-
And I run `bundle exec rake cucumber`
|
51
|
-
Then the feature run should pass with:
|
52
|
-
"""
|
53
|
-
2 scenarios (2 passed)
|
54
|
-
4 steps (4 passed)
|
55
|
-
"""
|
@@ -1,94 +0,0 @@
|
|
1
|
-
Feature: Emulate Javascript
|
2
|
-
|
3
|
-
Scenario: See a widget
|
4
|
-
Given I have created a new Rails app and installed cucumber-rails
|
5
|
-
And I force selenium to run Firefox in headless mode
|
6
|
-
And I run `rails generate scaffold widget name:string`
|
7
|
-
And I write to "features/f.feature" with:
|
8
|
-
"""
|
9
|
-
@javascript
|
10
|
-
Feature: Widget inventory
|
11
|
-
Scenario: Delete a widget
|
12
|
-
Given there is a widget named "wrench"
|
13
|
-
When I go to the widgets page
|
14
|
-
Then I should see "wrench"
|
15
|
-
"""
|
16
|
-
And I write to "features/step_definitions/s.rb" with:
|
17
|
-
"""
|
18
|
-
Given /^there is a widget named "([^"]*)"$/ do |name|
|
19
|
-
FactoryBot.create(:widget, name: name)
|
20
|
-
end
|
21
|
-
"""
|
22
|
-
And I write to "features/support/factories.rb" with:
|
23
|
-
"""
|
24
|
-
FactoryBot.define do
|
25
|
-
factory :widget do
|
26
|
-
name { 'testwidget' }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
"""
|
30
|
-
When I run `bundle exec rake db:migrate`
|
31
|
-
And I run `bundle exec rake cucumber`
|
32
|
-
Then the feature run should pass with:
|
33
|
-
"""
|
34
|
-
1 scenario (1 passed)
|
35
|
-
3 steps (3 passed)
|
36
|
-
"""
|
37
|
-
|
38
|
-
Scenario: Pass on the CSRF token
|
39
|
-
Given I have created a new Rails app and installed cucumber-rails
|
40
|
-
And I run `rails generate scaffold widget name:string`
|
41
|
-
And I run `sed -i -e 's/forgery_protection *= false/forgery_protection = true/' config/environments/test.rb`
|
42
|
-
And I run `rails generate controller session establish`
|
43
|
-
And I write to "app/controllers/session_controller.rb" with:
|
44
|
-
"""
|
45
|
-
class SessionController < ApplicationController
|
46
|
-
def establish
|
47
|
-
session[:verified] = true
|
48
|
-
end
|
49
|
-
end
|
50
|
-
"""
|
51
|
-
And I write to "app/controllers/application_controller.rb" with:
|
52
|
-
"""
|
53
|
-
class ApplicationController < ActionController::Base
|
54
|
-
protect_from_forgery
|
55
|
-
before_action except: :establish do
|
56
|
-
render text: "denied", status: :forbidden and return false unless session[:verified]
|
57
|
-
end
|
58
|
-
end
|
59
|
-
"""
|
60
|
-
And I write to "features/f.feature" with:
|
61
|
-
"""
|
62
|
-
Feature: Widget inventory
|
63
|
-
Scenario: Delete a widget
|
64
|
-
Given there is a widget named "wrench"
|
65
|
-
When I go to the session establish page
|
66
|
-
And I go to the widgets page
|
67
|
-
Then I should see "wrench"
|
68
|
-
When I follow "Destroy"
|
69
|
-
Then I should not see "denied"
|
70
|
-
And I should be on the widgets page
|
71
|
-
And I should not see "wrench"
|
72
|
-
"""
|
73
|
-
And I write to "features/step_definitions/s.rb" with:
|
74
|
-
"""
|
75
|
-
Given /^there is a widget named "([^"]*)"$/ do |name|
|
76
|
-
FactoryBot.create(:widget, name: name)
|
77
|
-
end
|
78
|
-
"""
|
79
|
-
And I write to "features/support/factories.rb" with:
|
80
|
-
"""
|
81
|
-
FactoryBot.define do
|
82
|
-
factory :widget do
|
83
|
-
name { 'testwidget' }
|
84
|
-
end
|
85
|
-
end
|
86
|
-
"""
|
87
|
-
When I run `bundle exec rake db:migrate`
|
88
|
-
And I run `bundle exec rake cucumber`
|
89
|
-
Then the feature run should pass with:
|
90
|
-
"""
|
91
|
-
1 scenario (1 passed)
|
92
|
-
8 steps (8 passed)
|
93
|
-
"""
|
94
|
-
|
@@ -1,14 +0,0 @@
|
|
1
|
-
Feature: Rails
|
2
|
-
In order to take over the world
|
3
|
-
Cucumber-Rails should work on major versions
|
4
|
-
of Rails and Ruby, with Capybara, Spork and DatabaseCleaner
|
5
|
-
|
6
|
-
Scenario: Install Cucumber-Rails
|
7
|
-
Given I have created a new Rails app and installed cucumber-rails
|
8
|
-
Then the following files should exist:
|
9
|
-
| config/cucumber.yml |
|
10
|
-
| script/cucumber |
|
11
|
-
| features/support/env.rb |
|
12
|
-
| features/step_definitions/.gitkeep |
|
13
|
-
| lib/tasks/cucumber.rake |
|
14
|
-
And the file "features/support/env.rb" should contain "require 'cucumber/rails'"
|
@@ -1,61 +0,0 @@
|
|
1
|
-
Feature: No Database
|
2
|
-
Allow Cucumber to work with a Rails app without a database
|
3
|
-
|
4
|
-
@fails-on-travis
|
5
|
-
Scenario: No ActiveRecord and DatabaseCleaner
|
6
|
-
Given I have created a new Rails app with no database and installed cucumber-rails
|
7
|
-
# Turn off ActiveRecord
|
8
|
-
And I write to "config/application.rb" with:
|
9
|
-
"""
|
10
|
-
require File.expand_path('../boot', __FILE__)
|
11
|
-
|
12
|
-
require 'action_controller/railtie'
|
13
|
-
require 'action_mailer/railtie'
|
14
|
-
require 'rails/test_unit/railtie'
|
15
|
-
|
16
|
-
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
17
|
-
|
18
|
-
module TestApp
|
19
|
-
class Application < Rails::Application
|
20
|
-
config.encoding = "utf-8"
|
21
|
-
config.filter_parameters += [:password]
|
22
|
-
end
|
23
|
-
end
|
24
|
-
"""
|
25
|
-
And I overwrite "features/support/env.rb" with:
|
26
|
-
"""
|
27
|
-
require 'cucumber/rails'
|
28
|
-
"""
|
29
|
-
And I remove the 'database_cleaner' gem from the Gemfile
|
30
|
-
And I remove the 'sqlite' gem from the Gemfile
|
31
|
-
And I write to "app/controllers/posts_controller.rb" with:
|
32
|
-
"""
|
33
|
-
class PostsController < ApplicationController
|
34
|
-
def index
|
35
|
-
raise "There is an error in index"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
"""
|
39
|
-
And I write to "config/routes.rb" with:
|
40
|
-
"""
|
41
|
-
TestApp::Application.routes.draw do
|
42
|
-
resources :posts
|
43
|
-
end
|
44
|
-
"""
|
45
|
-
And I write to "features/posts.feature" with:
|
46
|
-
"""
|
47
|
-
Feature: posts
|
48
|
-
Scenario: See them
|
49
|
-
When I do it
|
50
|
-
"""
|
51
|
-
And I write to "features/step_definitions/posts_steps.rb" with:
|
52
|
-
"""
|
53
|
-
When /^I do it$/ do
|
54
|
-
visit '/posts'
|
55
|
-
end
|
56
|
-
"""
|
57
|
-
And I run `bundle exec rake cucumber`
|
58
|
-
Then it should fail with:
|
59
|
-
"""
|
60
|
-
There is an error in index
|
61
|
-
"""
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Feature: Raise Errors
|
2
|
-
|
3
|
-
Scenario: Raise error for undefined route
|
4
|
-
Given I have created a new Rails app "test-app" with no database and installed cucumber-rails
|
5
|
-
And I write to "features/tests.feature" with:
|
6
|
-
"""
|
7
|
-
Feature: Tests
|
8
|
-
Scenario: Tests
|
9
|
-
When I go to the products page
|
10
|
-
"""
|
11
|
-
And I run `bundle exec cucumber`
|
12
|
-
Then it should fail with:
|
13
|
-
"""
|
14
|
-
1 scenario (1 failed)
|
15
|
-
1 step (1 failed)
|
16
|
-
"""
|
@@ -1,46 +0,0 @@
|
|
1
|
-
Feature: Rerun profile
|
2
|
-
In order to concentrate on failing features
|
3
|
-
As a Rails developer working with Cucumber
|
4
|
-
I want to rerun only failing features
|
5
|
-
|
6
|
-
Scenario: Rerun
|
7
|
-
Given I have created a new Rails app and installed cucumber-rails
|
8
|
-
And a file named "rerun.txt" with:
|
9
|
-
"""
|
10
|
-
features/rerun_test.feature:2
|
11
|
-
features/rerun_test.feature:5
|
12
|
-
"""
|
13
|
-
And a file named "features/rerun_test.feature" with:
|
14
|
-
"""
|
15
|
-
Feature: Rerun test
|
16
|
-
Scenario: failing before
|
17
|
-
Given fixed now
|
18
|
-
|
19
|
-
Scenario: still failing
|
20
|
-
Given broken
|
21
|
-
|
22
|
-
Scenario: always passing
|
23
|
-
Given passing
|
24
|
-
"""
|
25
|
-
And a file named "features/step_definitions/rerun_steps.rb" with:
|
26
|
-
"""
|
27
|
-
Given /fixed now/ do
|
28
|
-
puts "All fixed now"
|
29
|
-
end
|
30
|
-
|
31
|
-
Given /broken/ do
|
32
|
-
raise "I'm broken"
|
33
|
-
end
|
34
|
-
|
35
|
-
Given /passing/ do
|
36
|
-
puts "I've always been passing"
|
37
|
-
end
|
38
|
-
"""
|
39
|
-
When I run `bundle exec cucumber -p rerun`
|
40
|
-
Then it should fail with:
|
41
|
-
"""
|
42
|
-
2 scenarios (1 failed, 1 passed)
|
43
|
-
2 steps (1 failed, 1 passed)
|
44
|
-
"""
|
45
|
-
And the file "rerun.txt" should not contain "features/rerun_test.feature:2"
|
46
|
-
And the file "rerun.txt" should contain "features/rerun_test.feature:5"
|