multicuke 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/multicuke/runner.rb
CHANGED
@@ -58,6 +58,9 @@ module Multicuke
|
|
58
58
|
# Optional features directories to exclude
|
59
59
|
attr_accessor :excluded_dirs
|
60
60
|
|
61
|
+
# Optional only the features directories to be included
|
62
|
+
attr_accessor :included_only_dirs
|
63
|
+
|
61
64
|
# Full final path where html reports will be generated
|
62
65
|
attr_reader :reports_path
|
63
66
|
|
@@ -71,6 +74,7 @@ module Multicuke
|
|
71
74
|
@output_dir_name = "cucumber_reports" unless output_dir_name
|
72
75
|
@output_path = "" unless output_path
|
73
76
|
@excluded_dirs = [] unless excluded_dirs
|
77
|
+
@included_only_dirs = [] unless included_only_dirs
|
74
78
|
@reports_path = File.join(output_path, output_dir_name)
|
75
79
|
end
|
76
80
|
|
@@ -120,23 +124,31 @@ module Multicuke
|
|
120
124
|
}
|
121
125
|
end
|
122
126
|
|
123
|
-
def match_excluded_dirs(path)
|
124
|
-
path.match(Regexp.new(excluded_dirs.join("|")))
|
125
|
-
end
|
126
|
-
|
127
127
|
def features_dirs
|
128
128
|
@features_dirs ||= resolve_features_dirs_name
|
129
129
|
end
|
130
130
|
|
131
131
|
def resolve_features_dirs_name
|
132
|
-
Dir.glob(File.join(features_root_path, "*", "*.feature")).
|
133
|
-
|
132
|
+
Dir.glob(File.join(features_root_path, "*", "*.feature")).select{ |path|
|
133
|
+
configured_dir?(path)
|
134
134
|
}.map { |feature_path|
|
135
135
|
dir_name = File.basename(File.dirname(feature_path))
|
136
136
|
FeaturesDir.new(dir_name)
|
137
137
|
}
|
138
138
|
end
|
139
139
|
|
140
|
+
def configured_dir?(path)
|
141
|
+
if included_only_dirs.empty?
|
142
|
+
included_dir?(path)
|
143
|
+
else
|
144
|
+
path.match(Regexp.new(included_only_dirs.join("|")))
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def included_dir?(path)
|
149
|
+
excluded_dirs.empty? || (not path.match(Regexp.new(excluded_dirs.join("|"))))
|
150
|
+
end
|
151
|
+
|
140
152
|
end
|
141
153
|
|
142
154
|
end
|
data/lib/multicuke/version.rb
CHANGED
data/spec/dryrun_spec.rb
CHANGED
@@ -8,7 +8,7 @@ module Multicuke
|
|
8
8
|
FileUtils.rm_r(Dir.glob("#{RESULTS_DIR_PATH}/*"), :force => true)
|
9
9
|
end
|
10
10
|
|
11
|
-
it "generates index file
|
11
|
+
it "generates index file with hyperlinks to each feature" do
|
12
12
|
runner = Multicuke::Runner.new do |r|
|
13
13
|
r.features_root_path = File.expand_path("../features", __FILE__)
|
14
14
|
r.output_dir_name = "cuke_reports"
|
@@ -20,13 +20,22 @@ module Multicuke
|
|
20
20
|
|
21
21
|
runner.start
|
22
22
|
|
23
|
-
File.
|
23
|
+
File.open("#{RESULTS_DIR_PATH}/cuke_reports/index.html") { |file|
|
24
|
+
content = file.read
|
25
|
+
content.should match /.*Cucumber reports.*/
|
26
|
+
content.should match /.*<a href="addition.html">Addition<\/a>.*/
|
27
|
+
content.should match /.*<a href="substraction.html">Substraction<\/a>.*/
|
28
|
+
content.should match /.*<a href="division.html">Division<\/a>.*/
|
29
|
+
content.should match /.*<a href="bad_addition.html">Bad addition<\/a>.*/
|
30
|
+
content.should match /.*<a href="multiplication.html">Multiplication<\/a>.*/
|
31
|
+
content.should_not match /.*steps_definition.*/
|
32
|
+
}
|
24
33
|
end
|
25
34
|
|
26
|
-
it "
|
35
|
+
it "do not run on excluded directories and those that do not contains features" do
|
27
36
|
runner = Multicuke::Runner.new do |r|
|
28
37
|
r.features_root_path = File.expand_path("../features", __FILE__)
|
29
|
-
r.excluded_dirs = ["
|
38
|
+
r.excluded_dirs = ["exclude_me_features"]
|
30
39
|
r.dry_run = true
|
31
40
|
r.output_path = RESULTS_DIR_PATH
|
32
41
|
end
|
@@ -35,13 +44,33 @@ module Multicuke
|
|
35
44
|
|
36
45
|
File.open("#{RESULTS_DIR_PATH}/cucumber_reports/index.html") { |file|
|
37
46
|
content = file.read
|
38
|
-
content.
|
39
|
-
content.
|
40
|
-
|
47
|
+
content.should_not match /.*steps_definition.*/
|
48
|
+
content.should_not match /.*excluded_features.*/
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
it "run on included dirs only" do
|
53
|
+
runner = Multicuke::Runner.new do |r|
|
54
|
+
r.features_root_path = File.expand_path("../features", __FILE__)
|
55
|
+
r.included_only_dirs = ["division"]
|
56
|
+
r.dry_run = true
|
57
|
+
r.output_path = RESULTS_DIR_PATH
|
58
|
+
end
|
59
|
+
|
60
|
+
File.should_not exist("#{RESULTS_DIR_PATH}/cuke_reports")
|
61
|
+
|
62
|
+
runner.start
|
63
|
+
|
64
|
+
File.open("#{RESULTS_DIR_PATH}/cucumber_reports/index.html") { |file|
|
65
|
+
content = file.read
|
66
|
+
|
41
67
|
content.should match /.*<a href="division.html">Division<\/a>.*/
|
42
|
-
|
43
|
-
content.
|
68
|
+
|
69
|
+
content.should_not match /.*addition.*/i
|
70
|
+
content.should_not match /.*substraction.*/i
|
71
|
+
content.should_not match /.*multiplication.*/i
|
44
72
|
content.should_not match /.*steps_definition.*/
|
73
|
+
content.should_not match /.*excluded_features.*/
|
45
74
|
}
|
46
75
|
end
|
47
76
|
|
@@ -0,0 +1 @@
|
|
1
|
+
Feature: Any feature really
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multicuke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- spec/features/bad_addition/bad_addition.feature
|
33
33
|
- spec/features/division/divide_numbers.feature
|
34
34
|
- spec/features/empty/empty_file.feature
|
35
|
+
- spec/features/exclude_me_features/non_important.feature
|
35
36
|
- spec/features/multiplication/multiply_numbers.feature
|
36
37
|
- spec/features/random_file.rb
|
37
38
|
- spec/features/steps_definition/step_definitions.rb
|
@@ -70,6 +71,7 @@ test_files:
|
|
70
71
|
- spec/features/bad_addition/bad_addition.feature
|
71
72
|
- spec/features/division/divide_numbers.feature
|
72
73
|
- spec/features/empty/empty_file.feature
|
74
|
+
- spec/features/exclude_me_features/non_important.feature
|
73
75
|
- spec/features/multiplication/multiply_numbers.feature
|
74
76
|
- spec/features/random_file.rb
|
75
77
|
- spec/features/steps_definition/step_definitions.rb
|