geordi 2.11.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +8 -2
- data/CHANGELOG.md +40 -0
- data/Gemfile +2 -5
- data/Gemfile.lock +50 -3
- data/README.md +34 -7
- data/Rakefile +6 -10
- data/{bin → exe}/b +0 -0
- data/{bin → exe}/cap-all +0 -0
- data/{bin → exe}/console-for +0 -0
- data/{bin → exe}/cuc +0 -0
- data/{bin → exe}/cuc-show +0 -0
- data/{bin → exe}/cuc-vnc-setup +0 -0
- data/{bin → exe}/deploy-to-production +0 -0
- data/{bin → exe}/dump-for +0 -0
- data/{bin → exe}/dumple +0 -0
- data/{bin → exe}/geordi +0 -0
- data/{bin → exe}/gitpt +0 -0
- data/{bin → exe}/launchy_browser +0 -0
- data/{bin → exe}/load-dump +0 -0
- data/{bin → exe}/migrate-all +0 -0
- data/{bin → exe}/rs +0 -0
- data/{bin → exe}/run_tests +0 -0
- data/{bin → exe}/shell-for +0 -0
- data/{bin → exe}/tests +0 -0
- data/geordi.gemspec +23 -20
- data/lib/geordi/COMMAND_TEMPLATE +4 -6
- data/lib/geordi/capistrano_config.rb +7 -7
- data/lib/geordi/chromedriver_updater.rb +9 -10
- data/lib/geordi/cli.rb +1 -7
- data/lib/geordi/commands/_setup_vnc.rb +23 -23
- data/lib/geordi/commands/apache_site.rb +3 -3
- data/lib/geordi/commands/bundle_install.rb +3 -3
- data/lib/geordi/commands/capistrano.rb +5 -6
- data/lib/geordi/commands/chromedriver_update.rb +0 -9
- data/lib/geordi/commands/clean.rb +5 -6
- data/lib/geordi/commands/commit.rb +0 -1
- data/lib/geordi/commands/console.rb +4 -4
- data/lib/geordi/commands/create_database_yml.rb +4 -4
- data/lib/geordi/commands/create_databases.rb +3 -3
- data/lib/geordi/commands/cucumber.rb +25 -25
- data/lib/geordi/commands/delete_dumps.rb +12 -12
- data/lib/geordi/commands/deploy.rb +27 -28
- data/lib/geordi/commands/drop_databases.rb +13 -15
- data/lib/geordi/commands/dump.rb +12 -13
- data/lib/geordi/commands/eurest.rb +2 -2
- data/lib/geordi/commands/firefox.rb +4 -4
- data/lib/geordi/commands/migrate.rb +3 -3
- data/lib/geordi/commands/png_optimize.rb +15 -14
- data/lib/geordi/commands/rake.rb +3 -3
- data/lib/geordi/commands/remove_executable_flags.rb +3 -3
- data/lib/geordi/commands/rspec.rb +11 -11
- data/lib/geordi/commands/security_update.rb +84 -27
- data/lib/geordi/commands/server.rb +6 -6
- data/lib/geordi/commands/setup.rb +8 -8
- data/lib/geordi/commands/shell.rb +3 -3
- data/lib/geordi/commands/tests.rb +1 -1
- data/lib/geordi/commands/unit.rb +3 -3
- data/lib/geordi/commands/update.rb +7 -7
- data/lib/geordi/commands/vnc.rb +1 -1
- data/lib/geordi/commands/with_rake.rb +3 -3
- data/lib/geordi/commands/yarn_install.rb +3 -3
- data/lib/geordi/cucumber.rb +35 -36
- data/lib/geordi/db_cleaner.rb +40 -41
- data/lib/geordi/dump_loader.rb +6 -5
- data/lib/geordi/firefox_for_selenium.rb +26 -29
- data/lib/geordi/gitpt.rb +14 -15
- data/lib/geordi/interaction.rb +2 -6
- data/lib/geordi/remote.rb +9 -10
- data/lib/geordi/util.rb +26 -27
- data/lib/geordi/version.rb +1 -1
- metadata +25 -37
- data/features/commit.feature +0 -17
- data/features/console.feature +0 -7
- data/features/cucumber.feature +0 -261
- data/features/deploy.feature +0 -66
- data/features/dump.feature +0 -34
- data/features/firefox.feature +0 -44
- data/features/server.feature +0 -31
- data/features/setup.feature +0 -11
- data/features/shell.feature +0 -78
- data/features/support/env.rb +0 -8
- data/features/support/step_definitions/aruba_backport_steps.rb +0 -5
- data/features/support/step_definitions/miscellaneous_steps.rb +0 -11
data/lib/geordi/interaction.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
module Geordi
|
4
4
|
module Interaction
|
5
5
|
|
6
|
+
module_function
|
7
|
+
|
6
8
|
# Start your command by `announce`-ing what you're about to do
|
7
9
|
def announce(text)
|
8
10
|
message = "\n# #{text}"
|
@@ -42,12 +44,6 @@ module Geordi
|
|
42
44
|
puts "\e[32m#{message}\e[0m" # green
|
43
45
|
end
|
44
46
|
|
45
|
-
def strip_heredoc(string)
|
46
|
-
leading_whitespace = (string.match(/\A( +)[^ ]+/) || [])[1]
|
47
|
-
string.gsub! /^#{leading_whitespace}/, '' if leading_whitespace
|
48
|
-
string
|
49
|
-
end
|
50
|
-
|
51
47
|
# Returns the user's input.
|
52
48
|
# If agreement_regex is given, returns whether the input matches the regex.
|
53
49
|
def prompt(text, default = nil, agreement_regex = nil)
|
data/lib/geordi/remote.rb
CHANGED
@@ -6,9 +6,8 @@ require 'pathname'
|
|
6
6
|
|
7
7
|
module Geordi
|
8
8
|
class Remote
|
9
|
-
include Geordi::Interaction
|
10
9
|
|
11
|
-
REMOTE_DUMP_PATH = '~/dumps/dump_for_download.dump'
|
10
|
+
REMOTE_DUMP_PATH = '~/dumps/dump_for_download.dump'.freeze
|
12
11
|
|
13
12
|
def initialize(stage)
|
14
13
|
@stage = stage
|
@@ -34,8 +33,8 @@ module Geordi
|
|
34
33
|
def dump(options = {})
|
35
34
|
# Generate dump on the server
|
36
35
|
shell options.merge({
|
37
|
-
:
|
38
|
-
:
|
36
|
+
remote_command: "dumple #{@config.env} --for_download",
|
37
|
+
select_server: nil, # Dump must be generated on the primary server
|
39
38
|
})
|
40
39
|
|
41
40
|
destination_directory = File.join(@config.root, 'tmp')
|
@@ -43,17 +42,17 @@ module Geordi
|
|
43
42
|
destination_path = File.join(destination_directory, "#{@stage}.dump")
|
44
43
|
relative_destination = Pathname.new(destination_path).relative_path_from Pathname.new(@config.root)
|
45
44
|
|
46
|
-
note "Downloading remote dump to #{relative_destination} ..."
|
45
|
+
Interaction.note "Downloading remote dump to #{relative_destination} ..."
|
47
46
|
server = @config.primary_server
|
48
|
-
Util.system! "scp -C #{
|
47
|
+
Util.system! "scp -C #{@config.user(server)}@#{server}:#{REMOTE_DUMP_PATH} #{destination_path}"
|
49
48
|
|
50
|
-
success "Dumped the #{@stage} database to #{relative_destination}."
|
49
|
+
Interaction.success "Dumped the #{@stage} database to #{relative_destination}."
|
51
50
|
|
52
51
|
destination_path
|
53
52
|
end
|
54
53
|
|
55
54
|
def console(options = {})
|
56
|
-
shell(options.merge
|
55
|
+
shell(options.merge(remote_command: Util.console_command(@config.env)))
|
57
56
|
end
|
58
57
|
|
59
58
|
def shell(options = {})
|
@@ -62,8 +61,8 @@ module Geordi
|
|
62
61
|
remote_command = "cd #{@config.remote_root} && #{@config.shell}"
|
63
62
|
remote_command << " -c '#{options[:remote_command]}'" if options[:remote_command]
|
64
63
|
|
65
|
-
note 'Connecting to ' + server.to_s
|
66
|
-
Util.system! 'ssh', "#{
|
64
|
+
Interaction.note 'Connecting to ' + server.to_s
|
65
|
+
Util.system! 'ssh', "#{@config.user(server)}@#{server}", '-t', remote_command
|
67
66
|
end
|
68
67
|
|
69
68
|
end
|
data/lib/geordi/util.rb
CHANGED
@@ -4,29 +4,28 @@ require 'socket'
|
|
4
4
|
module Geordi
|
5
5
|
class Util
|
6
6
|
class << self
|
7
|
-
include Geordi::Interaction
|
8
7
|
|
9
8
|
# Geordi commands sometimes require external gems. However, we don't want
|
10
9
|
# all employed gems as runtime dependencies because that would
|
11
10
|
# unnecessarily slow down all commands.
|
12
11
|
# Thus, we have this handy method here.
|
13
|
-
def installing_missing_gems
|
12
|
+
def installing_missing_gems
|
14
13
|
yield
|
15
14
|
rescue LoadError => error
|
16
15
|
error.message =~ /-- (\S+)\Z/
|
17
|
-
|
16
|
+
Regexp.last_match(1) || raise # could not extract a gem name from the error message, re-raise the error
|
18
17
|
|
19
|
-
gem_name =
|
18
|
+
gem_name = Regexp.last_match(1).strip.split('/').first
|
20
19
|
install_command = 'gem install ' + gem_name
|
21
20
|
|
22
21
|
# install missing gem
|
23
|
-
warn 'Probably missing gem: ' + gem_name
|
24
|
-
prompt('Install it now?', 'y', /y|yes/)
|
25
|
-
system! install_command, :
|
22
|
+
Interaction.warn 'Probably missing gem: ' + gem_name
|
23
|
+
Interaction.prompt('Install it now?', 'y', /y|yes/) || Interaction.fail('Missing Gems.')
|
24
|
+
system! install_command, show_cmd: true
|
26
25
|
|
27
26
|
# retry
|
28
27
|
Gem.clear_paths
|
29
|
-
note 'Retrying ...'
|
28
|
+
Interaction.note 'Retrying ...'
|
30
29
|
require gem_name
|
31
30
|
retry
|
32
31
|
end
|
@@ -39,14 +38,14 @@ module Geordi
|
|
39
38
|
# @option fail_message: The text to print on command failure
|
40
39
|
def system!(*commands)
|
41
40
|
options = commands.last.is_a?(Hash) ? commands.pop : {}
|
42
|
-
note_cmd commands.join(' ') if options[:show_cmd]
|
41
|
+
Interaction.note_cmd commands.join(' ') if options[:show_cmd]
|
43
42
|
|
44
43
|
if options[:confirm]
|
45
|
-
prompt('Run this now?', 'n', /y|yes/) or fail('Cancelled.')
|
44
|
+
Interaction.prompt('Run this now?', 'n', /y|yes/) or Interaction.fail('Cancelled.')
|
46
45
|
end
|
47
46
|
|
48
47
|
if testing?
|
49
|
-
puts "Util.system! #{
|
48
|
+
puts "Util.system! #{commands.join ', '}"
|
50
49
|
else
|
51
50
|
# Remove Geordi's Bundler environment when running commands.
|
52
51
|
success = if !defined?(Bundler)
|
@@ -59,7 +58,7 @@ module Geordi
|
|
59
58
|
Bundler.clean_system(*commands)
|
60
59
|
end
|
61
60
|
|
62
|
-
success
|
61
|
+
success || Interaction.fail(options[:fail_message] || 'Something went wrong.')
|
63
62
|
end
|
64
63
|
end
|
65
64
|
|
@@ -107,7 +106,7 @@ module Geordi
|
|
107
106
|
# try to guess user's favorite cli text editor
|
108
107
|
def decide_texteditor
|
109
108
|
%w[/usr/bin/editor vi].each do |texteditor|
|
110
|
-
if cmd_exists?
|
109
|
+
if cmd_exists?(texteditor) && texteditor.start_with?('$')
|
111
110
|
return ENV[texteditor[1..-1]]
|
112
111
|
elsif cmd_exists? texteditor
|
113
112
|
return texteditor
|
@@ -116,19 +115,17 @@ module Geordi
|
|
116
115
|
end
|
117
116
|
|
118
117
|
# check if given cmd is executable. Absolute path or command in $PATH allowed.
|
119
|
-
def cmd_exists?
|
118
|
+
def cmd_exists?(cmd)
|
120
119
|
system("which #{cmd} > /dev/null")
|
121
|
-
|
120
|
+
$?.exitstatus.zero?
|
122
121
|
end
|
123
122
|
|
124
123
|
def is_port_open?(port)
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
return false
|
131
|
-
end
|
124
|
+
socket = TCPSocket.new('127.0.0.1', port)
|
125
|
+
socket.close
|
126
|
+
true
|
127
|
+
rescue Errno::ECONNREFUSED
|
128
|
+
false
|
132
129
|
end
|
133
130
|
|
134
131
|
# splint lines e.g. read from a file into lines and clean those up
|
@@ -161,18 +158,20 @@ module Geordi
|
|
161
158
|
nil
|
162
159
|
end
|
163
160
|
|
164
|
-
def ruby_version
|
165
|
-
Gem::Version.new(RUBY_VERSION)
|
166
|
-
end
|
167
|
-
|
168
161
|
def file_containing?(file, regex)
|
169
|
-
File.
|
162
|
+
File.exist?(file) && File.read(file).scan(regex).any?
|
170
163
|
end
|
171
164
|
|
172
165
|
def testing?
|
173
166
|
!!ENV['GEORDI_TESTING']
|
174
167
|
end
|
175
168
|
|
169
|
+
def strip_heredoc(string)
|
170
|
+
leading_whitespace = (string.match(/\A( +)[^ ]+/) || [])[1]
|
171
|
+
string.gsub! /^#{leading_whitespace}/, '' if leading_whitespace
|
172
|
+
string
|
173
|
+
end
|
174
|
+
|
176
175
|
private
|
177
176
|
|
178
177
|
def bundle_list
|
data/lib/geordi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geordi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1'
|
27
27
|
description: Collection of command line tools we use in our daily work with Ruby,
|
28
28
|
Rails and Linux at makandra.
|
29
29
|
email:
|
@@ -59,36 +59,24 @@ files:
|
|
59
59
|
- LICENSE
|
60
60
|
- README.md
|
61
61
|
- Rakefile
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
80
|
-
- features/commit.feature
|
81
|
-
- features/console.feature
|
82
|
-
- features/cucumber.feature
|
83
|
-
- features/deploy.feature
|
84
|
-
- features/dump.feature
|
85
|
-
- features/firefox.feature
|
86
|
-
- features/server.feature
|
87
|
-
- features/setup.feature
|
88
|
-
- features/shell.feature
|
89
|
-
- features/support/env.rb
|
90
|
-
- features/support/step_definitions/aruba_backport_steps.rb
|
91
|
-
- features/support/step_definitions/miscellaneous_steps.rb
|
62
|
+
- exe/b
|
63
|
+
- exe/cap-all
|
64
|
+
- exe/console-for
|
65
|
+
- exe/cuc
|
66
|
+
- exe/cuc-show
|
67
|
+
- exe/cuc-vnc-setup
|
68
|
+
- exe/deploy-to-production
|
69
|
+
- exe/dump-for
|
70
|
+
- exe/dumple
|
71
|
+
- exe/geordi
|
72
|
+
- exe/gitpt
|
73
|
+
- exe/launchy_browser
|
74
|
+
- exe/load-dump
|
75
|
+
- exe/migrate-all
|
76
|
+
- exe/rs
|
77
|
+
- exe/run_tests
|
78
|
+
- exe/shell-for
|
79
|
+
- exe/tests
|
92
80
|
- geordi.gemspec
|
93
81
|
- lib/geordi.rb
|
94
82
|
- lib/geordi/COMMAND_TEMPLATE
|
@@ -149,14 +137,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
137
|
requirements:
|
150
138
|
- - ">="
|
151
139
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
140
|
+
version: 2.0.0
|
153
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
142
|
requirements:
|
155
143
|
- - ">="
|
156
144
|
- !ruby/object:Gem::Version
|
157
145
|
version: '0'
|
158
146
|
requirements: []
|
159
|
-
rubygems_version: 3.1.
|
147
|
+
rubygems_version: 3.1.4
|
160
148
|
signing_key:
|
161
149
|
specification_version: 4
|
162
150
|
summary: Collection of command line tools we use in our daily work with Ruby, Rails
|
data/features/commit.feature
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
@ruby>=1.9
|
2
|
-
Feature: Creating a git commit from a Pivotal Tracker story
|
3
|
-
|
4
|
-
Scenario: Extra arguments are forwarded to "git commit"
|
5
|
-
Given I have staged changes
|
6
|
-
|
7
|
-
When I run `geordi commit --extra-option` interactively
|
8
|
-
# No optional message
|
9
|
-
And I type ""
|
10
|
-
Then the output should contain "Util.system! git, commit, --allow-empty, -m, [#12] Test Story, --extra-option"
|
11
|
-
|
12
|
-
|
13
|
-
Scenario: With no staged changes, a warning is printed
|
14
|
-
When I run `geordi commit --allow-empty` interactively
|
15
|
-
# No optional message
|
16
|
-
And I type ""
|
17
|
-
Then the output should contain "> No staged changes. Will create an empty commit."
|
data/features/console.feature
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
Feature: The console command
|
2
|
-
Most aspects of connection to a server are tested in shell feature.
|
3
|
-
|
4
|
-
Scenario: Opening a local Rails console
|
5
|
-
When I run `geordi console`
|
6
|
-
Then the output should contain "# Opening a local Rails console"
|
7
|
-
And the output should contain "Util.system! bundle exec rails console -e development"
|
data/features/cucumber.feature
DELETED
@@ -1,261 +0,0 @@
|
|
1
|
-
Feature: The cucumber command
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given a file named "config/cucumber.yml" with:
|
5
|
-
"""
|
6
|
-
default: features
|
7
|
-
rerun: features
|
8
|
-
"""
|
9
|
-
|
10
|
-
|
11
|
-
Scenario: Run a single feature
|
12
|
-
Given a file named "features/single.feature" with:
|
13
|
-
"""
|
14
|
-
Feature: Running a single feature
|
15
|
-
Scenario: A single scenario
|
16
|
-
"""
|
17
|
-
|
18
|
-
When I run `geordi cucumber features/single.feature`
|
19
|
-
Then the output should contain "# Running features"
|
20
|
-
And the output should contain "> Only: features/single.feature"
|
21
|
-
And the output should contain "Features green."
|
22
|
-
But the output should not contain "parallel"
|
23
|
-
|
24
|
-
|
25
|
-
Scenario: Multiple features are run in parallel
|
26
|
-
Given a file named "features/one.feature" with:
|
27
|
-
"""
|
28
|
-
Feature: One
|
29
|
-
Scenario: One
|
30
|
-
"""
|
31
|
-
And a file named "features/two.feature" with:
|
32
|
-
"""
|
33
|
-
Feature: Two
|
34
|
-
Scenario: Two
|
35
|
-
"""
|
36
|
-
|
37
|
-
When I run `geordi cucumber`
|
38
|
-
Then the output should contain "# Running features"
|
39
|
-
And the output should contain "> All features in features/"
|
40
|
-
And the output should contain "> Using parallel_tests"
|
41
|
-
|
42
|
-
|
43
|
-
Scenario: Rerunning tests until they pass
|
44
|
-
Given a file named "features/step_definitions/test_steps.rb" with:
|
45
|
-
"""
|
46
|
-
Given /^this test fails$/ do
|
47
|
-
raise
|
48
|
-
end
|
49
|
-
"""
|
50
|
-
And a file named "features/failing.feature" with:
|
51
|
-
"""
|
52
|
-
Feature: Failing feature
|
53
|
-
Scenario: Failing scenario
|
54
|
-
And this test fails
|
55
|
-
"""
|
56
|
-
|
57
|
-
When I run `geordi cucumber --rerun=2`
|
58
|
-
Then the output should contain "# Running features"
|
59
|
-
And the output should contain "# Rerun #1 of 2"
|
60
|
-
And the output should contain "# Rerun #2 of 2"
|
61
|
-
And the output should contain "Rerunning failed scenarios"
|
62
|
-
And the output should contain "Using the rerun profile"
|
63
|
-
And the exit status should be 1
|
64
|
-
And the output should contain "Features failed."
|
65
|
-
|
66
|
-
|
67
|
-
Scenario: A rerun should only consider the specified file
|
68
|
-
Note that we need a cucumber.yml to write the rerun.txt and read the rerun.txt for the reruns.
|
69
|
-
|
70
|
-
Given a file named "features/step_definitions/test_steps.rb" with:
|
71
|
-
"""
|
72
|
-
Given /^this test fails$/ do
|
73
|
-
raise
|
74
|
-
end
|
75
|
-
|
76
|
-
Given /^I use puts with text "(.*)"$/ do |ann|
|
77
|
-
puts(ann)
|
78
|
-
end
|
79
|
-
"""
|
80
|
-
And a file named "features/some.feature" with:
|
81
|
-
"""
|
82
|
-
Feature: Failing feature
|
83
|
-
Scenario: Passing scenario
|
84
|
-
And I use puts with text "Running passing Feature"
|
85
|
-
|
86
|
-
Scenario: Failing scenario
|
87
|
-
And I use puts with text "Running failing Feature"
|
88
|
-
And this test fails
|
89
|
-
"""
|
90
|
-
And an empty file named "tmp/rerun.txt"
|
91
|
-
And a file named "cucumber.yml" with:
|
92
|
-
"""
|
93
|
-
<%
|
94
|
-
rerun_log = 'tmp/rerun.txt'
|
95
|
-
rerun_failures = File.file?(rerun_log) ? File.read(rerun_log).gsub("\n", ' ') : ''
|
96
|
-
log_failures = "--format=rerun --out=#{rerun_log}"
|
97
|
-
%>
|
98
|
-
default: features <%= log_failures %>
|
99
|
-
rerun: <%= rerun_failures %> <%= log_failures %>
|
100
|
-
"""
|
101
|
-
|
102
|
-
When I run `geordi cucumber --rerun=1 features/some.feature`
|
103
|
-
Then the output should contain:
|
104
|
-
"""
|
105
|
-
# Rerun #1 of 1
|
106
|
-
> Rerunning failed scenarios
|
107
|
-
> Run `geordi vnc` to view the Selenium test browsers
|
108
|
-
|
109
|
-
Using the rerun profile...
|
110
|
-
|
111
|
-
Running failing Feature
|
112
|
-
.F
|
113
|
-
|
114
|
-
(::) failed steps (::)
|
115
|
-
|
116
|
-
(RuntimeError)
|
117
|
-
features/some.feature:7:in `And this test fails'
|
118
|
-
|
119
|
-
Failing Scenarios:
|
120
|
-
cucumber -p rerun features/some.feature:5 # Scenario: Failing scenario
|
121
|
-
"""
|
122
|
-
|
123
|
-
|
124
|
-
Scenario: Running all features in a given subfolder
|
125
|
-
Given a file named "features/sub/one.feature" with:
|
126
|
-
"""
|
127
|
-
Feature: Testfeature
|
128
|
-
"""
|
129
|
-
And a file named "features/sub/two.feature" with:
|
130
|
-
"""
|
131
|
-
Feature: Testfeature
|
132
|
-
"""
|
133
|
-
|
134
|
-
When I run `geordi cucumber features/sub`
|
135
|
-
Then the output should contain "> Only: features/sub/two.feature, features/sub/one.feature"
|
136
|
-
And the output should contain "> Using parallel_tests"
|
137
|
-
|
138
|
-
|
139
|
-
Scenario: Using the @solo tag
|
140
|
-
|
141
|
-
The cucumber command runs all features without the @solo tag. If any of the
|
142
|
-
specified .feature files contains '@solo', it boots Cucumber a second time
|
143
|
-
and runs only those of the features tagged with @solo.
|
144
|
-
|
145
|
-
Given a file named "features/no_solo.feature" with:
|
146
|
-
"""
|
147
|
-
Feature: Test without solo tag
|
148
|
-
Scenario: This scenario can run in parallel
|
149
|
-
"""
|
150
|
-
And a file named "features/solo.feature" with:
|
151
|
-
"""
|
152
|
-
Feature: Solo test
|
153
|
-
@solo
|
154
|
-
Scenario: This scenario must NOT run in parallel
|
155
|
-
"""
|
156
|
-
|
157
|
-
When I run `geordi cucumber --verbose features`
|
158
|
-
Then the output should contain "# Running @solo features"
|
159
|
-
And the output should match /^> .*cucumber .*--tags @solo/
|
160
|
-
And the output should contain "# Running features"
|
161
|
-
And the output should match /^> .*cucumber .*--tags \"~@solo\"/
|
162
|
-
|
163
|
-
|
164
|
-
Scenario: When there are no scenarios tagged @solo, the extra run is skipped
|
165
|
-
Given a file named "features/no_solo/one.feature" with:
|
166
|
-
"""
|
167
|
-
Feature: Test without solo tag
|
168
|
-
Scenario: This scenario can run in parallel
|
169
|
-
"""
|
170
|
-
And a file named "features/no_solo/two.feature" with:
|
171
|
-
"""
|
172
|
-
Feature: A second test to provoke a parallel run
|
173
|
-
Scenario: Something
|
174
|
-
"""
|
175
|
-
And a file named "features/solo.feature" with:
|
176
|
-
"""
|
177
|
-
Feature: Solo test
|
178
|
-
@solo
|
179
|
-
Scenario: This scenario is not even run during this test
|
180
|
-
"""
|
181
|
-
|
182
|
-
When I run `geordi cucumber features/no_solo --verbose`
|
183
|
-
Then the output should contain "# Running features"
|
184
|
-
And the output should match /^> .*features .*--tags \"~@solo\"/
|
185
|
-
But the output should not contain "# Running @solo features"
|
186
|
-
|
187
|
-
|
188
|
-
Scenario: When called with line numbers, the @solo extra run is skipped
|
189
|
-
|
190
|
-
Note that with line numbers in the passed file names, features are run
|
191
|
-
serially.
|
192
|
-
|
193
|
-
Given a file named "features/example.feature" with:
|
194
|
-
"""
|
195
|
-
Feature: Test without solo tag
|
196
|
-
Scenario: Example scenario
|
197
|
-
Scenario: Other scenario
|
198
|
-
"""
|
199
|
-
|
200
|
-
When I run `geordi cucumber --verbose features/example.feature:2`
|
201
|
-
Then the output should contain "# Running features"
|
202
|
-
But the output should not contain "# Running @solo features"
|
203
|
-
# Regression test, with line numbers grep would fail with:
|
204
|
-
# grep: features/example.feature:2: No such file or directory
|
205
|
-
And the output should not contain "No such file or directory"
|
206
|
-
|
207
|
-
|
208
|
-
Scenario: It does not start the full test run when the @solo run fails
|
209
|
-
Given a file named "features/step_definitions/test_steps.rb" with:
|
210
|
-
"""
|
211
|
-
Given 'this test fails' do
|
212
|
-
raise
|
213
|
-
end
|
214
|
-
"""
|
215
|
-
And a file named "features/failing.feature" with:
|
216
|
-
"""
|
217
|
-
Feature: Failing feature
|
218
|
-
@solo
|
219
|
-
Scenario: Failing scenario
|
220
|
-
And this test fails
|
221
|
-
Scenario: Other scenario
|
222
|
-
"""
|
223
|
-
|
224
|
-
When I run `geordi cucumber`
|
225
|
-
Then the output should contain "# Running @solo features"
|
226
|
-
And the output should contain "Features failed."
|
227
|
-
But the output should not contain "# Running features"
|
228
|
-
|
229
|
-
|
230
|
-
Scenario: Specifying a firefox version to use
|
231
|
-
Given a file named "features/sub/one.feature" with:
|
232
|
-
"""
|
233
|
-
Feature: Testfeature
|
234
|
-
"""
|
235
|
-
And a file named ".firefox-version" with:
|
236
|
-
"""
|
237
|
-
24.0
|
238
|
-
"""
|
239
|
-
|
240
|
-
When I run `geordi cucumber --verbose`
|
241
|
-
Then the output should match /^> PATH=.*24.0:\$PATH.* features/
|
242
|
-
|
243
|
-
|
244
|
-
Scenario: Running all cucumber features matching a given string
|
245
|
-
Given a file named "features/given.feature" with "Feature: given"
|
246
|
-
And a file named "features/other.feature" with "Feature: other"
|
247
|
-
|
248
|
-
When I run `geordi cucumber --containing given`
|
249
|
-
Then the output should contain "Only: features/given.feature"
|
250
|
-
But the output should not contain "other.feature"
|
251
|
-
|
252
|
-
|
253
|
-
Scenario: Passing a format argument will skip the default format for a single run
|
254
|
-
Given a file named "features/single.feature" with:
|
255
|
-
"""
|
256
|
-
Feature: Running a single feature
|
257
|
-
Scenario: A single scenario
|
258
|
-
"""
|
259
|
-
|
260
|
-
When I run `geordi cucumber features/single.feature --format=pretty --verbose`
|
261
|
-
Then the output should contain "b cucumber features/single.feature --format pretty"
|