guard-cucumber 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/guard/cucumber.rb +22 -31
- data/lib/guard/cucumber/inspector.rb +1 -1
- data/lib/guard/cucumber/notification_formatter.rb +2 -2
- data/lib/guard/cucumber/runner.rb +3 -11
- data/lib/guard/cucumber/templates/Guardfile +1 -1
- data/lib/guard/cucumber/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 361015c52734047fccfc7238133810df2db55514
|
4
|
+
data.tar.gz: ac2cc0cbc96e3d197566389a852f3d79780e4a6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ede278da59d344250d57f24da1a5bf5c987702ea8b7a07688ad17478f8b5ba578b78d0da482f623870f0dc56f765ef689b82c11c27635e3e2a40aa4198ccf02a
|
7
|
+
data.tar.gz: 811749cf80b8acb2eec4a61b533331193f497145a94842c0d9c798c04281992ca534f8c1fb23e6124f84adc2845e1462e6a25edf16953988c5eff9753efc4334
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
Guard::Cucumber allows you to automatically run Cucumber features when files are modified.
|
4
4
|
|
5
|
-
|
5
|
+
Supported Ruby versions are those tested on [Travis CI](https://travis-ci.org/guard/guard-cucumber).
|
6
|
+
(NOTE: Any Ruby version earlier than 2.2.5 is outdated and likely insecure).
|
7
|
+
|
6
8
|
|
7
9
|
If you have any questions please join us on our [Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
|
8
10
|
|
data/lib/guard/cucumber.rb
CHANGED
@@ -11,16 +11,23 @@ module Guard
|
|
11
11
|
class Cucumber < Plugin
|
12
12
|
attr_accessor :last_failed, :failed_path
|
13
13
|
|
14
|
+
KNOWN_OPTIONS = %w(
|
15
|
+
all_after_pass
|
16
|
+
all_on_start
|
17
|
+
keep_failed
|
18
|
+
feature_sets
|
19
|
+
|
20
|
+
run_all
|
21
|
+
focus_on
|
22
|
+
notification
|
23
|
+
).map(&:to_sym)
|
24
|
+
|
14
25
|
# Initialize Guard::Cucumber.
|
15
26
|
#
|
16
27
|
# @param [Array<Guard::Watcher>] watchers the watchers in the Guard block
|
17
28
|
# @param [Hash] options the options for the Guard
|
18
|
-
# @option options [String] :cli any arbitrary Cucumber CLI arguments
|
19
29
|
# @option options [Array<String>] :feature_sets a list of non-standard
|
20
30
|
# feature directory/ies
|
21
|
-
# @option options [Boolean] :bundler use bundler or not
|
22
|
-
# @option options [Array<String>] :rvm a list of rvm version to use for the
|
23
|
-
# test
|
24
31
|
# @option options [Boolean] :notification show notifications
|
25
32
|
# @option options [Boolean] :all_after_pass run all features after changed
|
26
33
|
# features pass
|
@@ -29,8 +36,6 @@ module Guard
|
|
29
36
|
# pass
|
30
37
|
# @option options [Boolean] :run_all run override any option when running
|
31
38
|
# all specs
|
32
|
-
# @option options [Boolean] :change_format use a different cucumber format
|
33
|
-
# when running individual features
|
34
39
|
#
|
35
40
|
def initialize(options = {})
|
36
41
|
super(options)
|
@@ -39,10 +44,16 @@ module Guard
|
|
39
44
|
all_after_pass: true,
|
40
45
|
all_on_start: true,
|
41
46
|
keep_failed: true,
|
42
|
-
|
47
|
+
cmd_additional_args: "",
|
43
48
|
feature_sets: ["features"]
|
44
49
|
}.update(options)
|
45
50
|
|
51
|
+
unknown_options = @options.keys - KNOWN_OPTIONS
|
52
|
+
unknown_options.each do |unknown|
|
53
|
+
msg = "Unknown guard-cucumber option: #{unknown.inspect}"
|
54
|
+
Guard::Compat::UI.warning(msg)
|
55
|
+
end
|
56
|
+
|
46
57
|
@last_failed = false
|
47
58
|
@failed_paths = []
|
48
59
|
end
|
@@ -61,13 +72,13 @@ module Guard
|
|
61
72
|
#
|
62
73
|
def run_all
|
63
74
|
opts = options.merge(options[:run_all] || {})
|
64
|
-
opts
|
75
|
+
opts[:message] = "Running all features"
|
65
76
|
passed = Runner.run(options[:feature_sets], opts)
|
66
77
|
|
67
78
|
if passed
|
68
79
|
@failed_paths = []
|
69
|
-
|
70
|
-
@failed_paths = read_failed_features
|
80
|
+
elsif @options[:keep_failed]
|
81
|
+
@failed_paths = read_failed_features
|
71
82
|
end
|
72
83
|
|
73
84
|
@last_failed = !passed
|
@@ -93,12 +104,9 @@ module Guard
|
|
93
104
|
paths = Inspector.clean(paths, options[:feature_sets])
|
94
105
|
|
95
106
|
options = @options
|
96
|
-
if @options[:change_format]
|
97
|
-
options = change_format(@options[:change_format])
|
98
|
-
end
|
99
107
|
|
100
108
|
msg = "Running all features"
|
101
|
-
options
|
109
|
+
options[:message] = msg if paths.include?("features")
|
102
110
|
|
103
111
|
_run(paths, options)
|
104
112
|
end
|
@@ -121,23 +129,6 @@ module Guard
|
|
121
129
|
failed
|
122
130
|
end
|
123
131
|
|
124
|
-
# Change the `--format` cli option.
|
125
|
-
#
|
126
|
-
# @param [String] format the new format
|
127
|
-
# @return [Hash] the new options
|
128
|
-
#
|
129
|
-
def change_format(format)
|
130
|
-
cli_parts = @options[:cli].split(" ")
|
131
|
-
cli_parts.each_with_index do |part, index|
|
132
|
-
if part == "--format" && cli_parts[index + 2] != "--out"
|
133
|
-
cli_parts[index + 1] = format
|
134
|
-
end
|
135
|
-
end
|
136
|
-
@options.merge(cli: cli_parts.join(" "))
|
137
|
-
end
|
138
|
-
|
139
|
-
private
|
140
|
-
|
141
132
|
def _run(paths, options)
|
142
133
|
if Runner.run(paths, options)
|
143
134
|
# clean failed paths memory
|
@@ -65,7 +65,7 @@ module Guard
|
|
65
65
|
#
|
66
66
|
# @param [Cucumber::Ast::FeatureElement] feature_element
|
67
67
|
#
|
68
|
-
def before_feature_element(
|
68
|
+
def before_feature_element(_feature_element)
|
69
69
|
@rerun = false
|
70
70
|
# TODO: show feature element name instead?
|
71
71
|
# @feature = feature_element.name
|
@@ -96,7 +96,7 @@ module Guard
|
|
96
96
|
return unless [:failed, :pending, :undefined].index(status)
|
97
97
|
|
98
98
|
@rerun = true
|
99
|
-
step_name = step_match.format_args(lambda { |param| "*#{
|
99
|
+
step_name = step_match.format_args(lambda { |param| "*#{param}*" })
|
100
100
|
|
101
101
|
options = { title: @feature.name, image: icon_for(status) }
|
102
102
|
Guard::Compat::UI.notify(step_name, options)
|
@@ -14,11 +14,7 @@ module Guard
|
|
14
14
|
# @param [Hash] options the options for the execution
|
15
15
|
# @option options [Array<String>] :feature_sets a list of non-standard
|
16
16
|
# feature directory/ies
|
17
|
-
# @option options [Boolean] :bundler use bundler or not
|
18
|
-
# @option options [Array<String>] :rvm a list of rvm version to use for
|
19
|
-
# the test
|
20
17
|
# @option options [Boolean] :notification show notifications
|
21
|
-
# @option options [String] :command_prefix allows adding an additional
|
22
18
|
# prefix to the cucumber command. Ideal for running xvfb-run for
|
23
19
|
# terminal only cucumber tests.
|
24
20
|
# @return [Boolean] the status of the execution
|
@@ -48,11 +44,7 @@ module Guard
|
|
48
44
|
#
|
49
45
|
# @param [Array<String>] paths the feature files or directories
|
50
46
|
# @param [Hash] options the options for the execution
|
51
|
-
# @option options [Boolean] :bundler use bundler or not
|
52
|
-
# @option options [Array<String>] :rvm a list of rvm version to use for
|
53
|
-
# the test
|
54
47
|
# @option options [Boolean] :notification show notifications
|
55
|
-
# @option options [String] :command_prefix allows adding an additional
|
56
48
|
# prefix to the cucumber command. Ideal for running xvfb-run for
|
57
49
|
# terminal only cucumber tests.
|
58
50
|
# @return [String] the Cucumber command
|
@@ -82,11 +74,11 @@ module Guard
|
|
82
74
|
formatter_path = File.join(this_dir, "notification_formatter.rb")
|
83
75
|
notification_formatter_path = File.expand_path(formatter_path)
|
84
76
|
|
85
|
-
cmd << "--require #{
|
77
|
+
cmd << "--require #{notification_formatter_path}"
|
86
78
|
cmd << "--format Guard::Cucumber::NotificationFormatter"
|
87
|
-
cmd << "--out #{
|
79
|
+
cmd << "--out #{null_device}"
|
88
80
|
cmd << (options[:feature_sets] || ["features"]).map do |path|
|
89
|
-
"--require #{
|
81
|
+
"--require #{path}"
|
90
82
|
end.join(" ")
|
91
83
|
end
|
92
84
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
guard "cucumber" do
|
2
2
|
watch(%r{^features/.+\.feature$})
|
3
|
-
watch(%r{^features/support/.+$})
|
3
|
+
watch(%r{^features/support/.+$}) { "features" }
|
4
4
|
|
5
5
|
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
|
6
6
|
Dir[File.join("**/#{m[1]}.feature")][0] || "features"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cezary Baginski
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard-compat
|
@@ -103,8 +103,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: 1.3.6
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.5.1
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: Guard plugin for Cucumber
|
110
110
|
test_files: []
|
111
|
+
has_rdoc:
|