cuke_cataloger 1.4.1 → 1.5.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7105dd4739cfcf77b2b055b427aa21584899e4e9
4
- data.tar.gz: f05a36d1ab015534957dfcd679fd2385bdbe4793
2
+ SHA256:
3
+ metadata.gz: ac272590c9348e48e1b7d77649a6666af6447daeeb6208f3aa90b4126f9ec64d
4
+ data.tar.gz: ae28c6e4f97f0aaa7bfe8dda9ce0afa367e793fb4e0b5767b2af1039d3631dd9
5
5
  SHA512:
6
- metadata.gz: 6269a07d0f33bbb791d1b6ea77e26b0aa8366370b84cf26ba0b97e32a2979018680697cf1ff3ad60c4445bb1281f8ba1bab647769be3897b0643045ffe7252e2
7
- data.tar.gz: 05f2f4163333b9ae0e548324edeb6e648a145979289c8135dfce8334afba7ed2bb407d1ba43e830de1481741c6d29f55111b235cbb6b5776ee488949baf847b2
6
+ metadata.gz: 8c0b6a70fccf3255a894d8a99f91f3bfde639e7925b2c0ceafdfaf2de658c8b909f24a8845cfad1c5034ebab7b20d67faf1affde5c2cc4def39ffb0058cafda5
7
+ data.tar.gz: ef61f6c3463e7a8c7c650006c41a67bb2374e48ecf8817e9d7fdb9e512c31abafaf11bc6825d96b53b9d9823ac262495c237bf0ca5d884fd381b2925ca3dd6e7
@@ -14,6 +14,9 @@ matrix:
14
14
  exclude:
15
15
  # Travis does not provide 1.8.7 on OSX
16
16
  - rvm: 1.8.7
17
+ os: osx
18
+ # Travis does not provide 1.9.3 on OSX
19
+ - rvm: 1.9.3
17
20
  os: osx
18
21
  # Rake 11.x does not support Ruby 1.8.7
19
22
  - rvm: 1.8.7
data/History.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Release history
2
2
 
3
+ ### Version 1.5.0 / 2017-09-09
4
+
5
+ - The default cataloging prefix used by the Rake tasks is now also the default prefix used by the various object based methods.
6
+
7
+
3
8
  ### Version 1.4.1 / 2017-07-09
4
9
 
5
10
  - Improved documentation
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2017 Eric Kessler
1
+ Copyright (c) 2014-2018 Eric Kessler
2
2
 
3
3
  MIT License
4
4
 
@@ -21,7 +21,7 @@ module CukeCataloger
21
21
  end
22
22
 
23
23
  # Adds id tags based on *tag_prefix* to the tests found in *feature_directory*
24
- def tag_tests(feature_directory, tag_prefix, explicit_indexes = {}, tag_rows = true, id_column_name = 'test_case_id')
24
+ def tag_tests(feature_directory, tag_prefix = '@test_case_', explicit_indexes = {}, tag_rows = true, id_column_name = 'test_case_id')
25
25
  warn("This script will potentially rewrite all of your feature files. Please be patient and remember to tip your source control system.")
26
26
 
27
27
  @known_id_tags = {}
@@ -46,7 +46,7 @@ module CukeCataloger
46
46
  end
47
47
 
48
48
  # Finds existing id tags and their associated tests in *feature_directory* based on *tag_prefix*
49
- def scan_for_tagged_tests(feature_directory, tag_prefix, id_column_name = 'test_case_id')
49
+ def scan_for_tagged_tests(feature_directory, tag_prefix = '@test_case_', id_column_name = 'test_case_id')
50
50
  @results = []
51
51
  @known_id_tags = {}
52
52
 
@@ -71,7 +71,7 @@ module CukeCataloger
71
71
  end
72
72
 
73
73
  # Checks for cataloging problems in *feature_directory* based on *tag_prefix*
74
- def validate_test_ids(feature_directory, tag_prefix, tag_rows = true, id_column_name = 'test_case_id')
74
+ def validate_test_ids(feature_directory, tag_prefix = '@test_case_', tag_rows = true, id_column_name = 'test_case_id')
75
75
  @results = []
76
76
  @known_id_tags = {}
77
77
 
@@ -85,7 +85,7 @@ module CukeCataloger
85
85
  end
86
86
 
87
87
  # Finds existing id tags in *feature_directory* based on *tag_prefix*
88
- def determine_known_ids(feature_directory, tag_prefix, id_column_name = 'test_case_id')
88
+ def determine_known_ids(feature_directory, tag_prefix = '@test_case_', id_column_name = 'test_case_id')
89
89
  known_ids = []
90
90
 
91
91
  found_tagged_objects = scan_for_tagged_tests(feature_directory, tag_prefix, id_column_name).collect { |result| result[:object] }
@@ -1,4 +1,4 @@
1
1
  module CukeCataloger
2
2
  # The current version of the gem
3
- VERSION = '1.4.1'
3
+ VERSION = '1.5.0'
4
4
  end
@@ -4,9 +4,6 @@ Feature: Tagging formatting
4
4
  source code as well as possible.
5
5
 
6
6
 
7
- Background:
8
- And a tag prefix of "@test_case_"
9
-
10
7
  Scenario: Test level tags have the same indentation as the test itself
11
8
  Given the following feature file:
12
9
  """
@@ -8,9 +8,9 @@ Feature: Tag indexing
8
8
 
9
9
  An analogous principle is used for outlines.
10
10
 
11
+ *Note*: When indexing, a tag prefix of '@test_case_' and a column id of 'test_case_id' will be used unless different
12
+ values are specified
11
13
 
12
- Background:
13
- * a tag prefix of "@test_case_"
14
14
 
15
15
  Scenario: Used indexes can be determined
16
16
  Given the following feature file "file1.feature":
@@ -40,7 +40,7 @@ Feature: Tag indexing
40
40
  | param 1 |
41
41
  | value 1 |
42
42
 
43
- #Missing the parent tag but the sub-tags still count
43
+ # Missing the parent tag but the sub-tags still count
44
44
  Scenario Outline:
45
45
  * a step
46
46
  Examples: with rows
@@ -11,7 +11,6 @@ Feature: Scan results return useful information
11
11
  Scenario:
12
12
  * a step
13
13
  """
14
- And a tag prefix of "@test_case_"
15
14
  When the files are scanned
16
15
  Then the payload is a model object
17
16
 
@@ -27,6 +26,5 @@ Feature: Scan results return useful information
27
26
  | test_case_id | param 1 |
28
27
  | 7-1 | value 1 |
29
28
  """
30
- And a tag prefix of "@test_case_"
31
29
  When the files are scanned
32
30
  Then the payload has a test and a test row
@@ -3,8 +3,8 @@ Feature: Tagging test cases for uniqueness
3
3
  Tests are tagged based on a simple <prefix><unique_id> pattern. Every test gets a tag at the test level and, in the case outlines, a sub-id for each of its example rows. Any test which has already been given an id tag or other id information will not have that information modified by the tagging process.
4
4
 
5
5
 
6
- Background:
7
- * a tag prefix of "@test_case_"
6
+ *Note*: When tagging, a tag prefix of '@test_case_' and a column id of 'test_case_id' will be used unless different
7
+ values are specified
8
8
 
9
9
 
10
10
  Scenario: Tagging tests that don't have id tags
@@ -5,6 +5,9 @@ Feature: Checking existing tags for correctness
5
5
  Therefore, the tool provides such a means.
6
6
 
7
7
 
8
+ *Note*: When validating, a tag prefix of '@test_case_' and a column id of 'test_case_id' will be used unless different
9
+ values are specified
10
+
8
11
  Scenario: Detection of missing test ids when not present
9
12
  Given the following feature file "has_untagged_tests.feature":
10
13
  """
@@ -13,7 +16,6 @@ Feature: Checking existing tags for correctness
13
16
  Scenario:
14
17
  * a step
15
18
  """
16
- And a tag prefix of "@test_case_"
17
19
  When the ids in the test suite are validated
18
20
  Then the following tests are found to be missing ids:
19
21
  | path/to/has_untagged_tests.feature:3 |
@@ -27,7 +29,6 @@ Feature: Checking existing tags for correctness
27
29
  Scenario:
28
30
  * a step
29
31
  """
30
- And a tag prefix of "@test_case_"
31
32
  When the ids in the test suite are validated
32
33
  Then no tests are found to be missing ids
33
34
 
@@ -44,7 +45,6 @@ Feature: Checking existing tags for correctness
44
45
  | | 123 |
45
46
  | bad_id | 456 |
46
47
  """
47
- And a tag prefix of "@test_case_"
48
48
  When the ids in the test suite are validated
49
49
  Then the following tests rows are found to be missing sub ids:
50
50
  | path/to/has_untagged_rows.feature:8 |
@@ -62,7 +62,6 @@ Feature: Checking existing tags for correctness
62
62
  | 4-1 | 123 |
63
63
  | 4-2 | 456 |
64
64
  """
65
- And a tag prefix of "@test_case_"
66
65
  When the ids in the test suite are validated
67
66
  Then no tests rows are found to be missing sub ids
68
67
 
@@ -78,7 +77,6 @@ Feature: Checking existing tags for correctness
78
77
  | param |
79
78
  | 123 |
80
79
  """
81
- And a tag prefix of "@test_case_"
82
80
  When the ids in the test suite are validated
83
81
  Then the following tests examples are found to be missing a parameter for sub ids:
84
82
  | path/to/has_missing_id_param.feature:6 |
@@ -95,7 +93,6 @@ Feature: Checking existing tags for correctness
95
93
  | test_case_id | param |
96
94
  | 4-1 | 123 |
97
95
  """
98
- And a tag prefix of "@test_case_"
99
96
  When the ids in the test suite are validated
100
97
  Then no test examples are found to be missing id parameters
101
98
 
@@ -112,7 +109,6 @@ Feature: Checking existing tags for correctness
112
109
  Scenario:
113
110
  * a step
114
111
  """
115
- And a tag prefix of "@test_case_"
116
112
  When the ids in the test suite are validated
117
113
  Then the following tests are found to have a duplicated id:
118
114
  | path/to/has_duplicated_tag.feature:4 |
@@ -131,7 +127,6 @@ Feature: Checking existing tags for correctness
131
127
  Scenario:
132
128
  * a step
133
129
  """
134
- And a tag prefix of "@test_case_"
135
130
  When the ids in the test suite are validated
136
131
  Then no tests are found to have duplicated ids
137
132
 
@@ -152,7 +147,6 @@ Feature: Checking existing tags for correctness
152
147
  | 2-1 | 123 |
153
148
  | 2-1 | 123 |
154
149
  """
155
- And a tag prefix of "@test_case_"
156
150
  When the ids in the test suite are validated
157
151
  Then the following tests example rows are found to have duplicated sub ids:
158
152
  | path/to/has_duplicated_id.feature:8 |
@@ -176,7 +170,6 @@ Feature: Checking existing tags for correctness
176
170
  | 2-3 | 123 |
177
171
  | 2-4 | 123 |
178
172
  """
179
- And a tag prefix of "@test_case_"
180
173
  When the ids in the test suite are validated
181
174
  Then no test example rows are found to have duplicated sub ids
182
175
 
@@ -213,7 +206,6 @@ Feature: Checking existing tags for correctness
213
206
  | test_case_id | param |
214
207
  | | 123 |
215
208
  """
216
- And a tag prefix of "@test_case_"
217
209
  When the ids in the test suite are validated
218
210
  Then the following tests example rows are found to have mismatched sub ids:
219
211
  | path/to/has_mismatched_id.feature:8 |
@@ -231,7 +223,6 @@ Feature: Checking existing tags for correctness
231
223
  | test_case_id | param |
232
224
  | 4-1 | 123 |
233
225
  """
234
- And a tag prefix of "@test_case_"
235
226
  When the ids in the test suite are validated
236
227
  Then no test example rows are found to have mismatched ids
237
228
 
@@ -245,7 +236,6 @@ Feature: Checking existing tags for correctness
245
236
  Scenario:
246
237
  * a step
247
238
  """
248
- And a tag prefix of "@test_case_"
249
239
  When the ids in the test suite are validated
250
240
  Then the following tests are found to have multiple test ids:
251
241
  | path/to/has_multiple_test_ids.feature:5 |
@@ -259,7 +249,6 @@ Feature: Checking existing tags for correctness
259
249
  Scenario:
260
250
  * a step
261
251
  """
262
- And a tag prefix of "@test_case_"
263
252
  When the ids in the test suite are validated
264
253
  Then no tests are found to have multiple test ids
265
254
 
@@ -277,7 +266,6 @@ Feature: Checking existing tags for correctness
277
266
  | | |
278
267
  | trash | 123 |
279
268
  """
280
- And a tag prefix of "@test_case_"
281
269
  When the ids in the test suite are validated
282
270
  Then the following tests example rows are found to have malformed sub ids:
283
271
  | path/to/has_mismatched_id.feature:8 |
@@ -295,7 +283,6 @@ Feature: Checking existing tags for correctness
295
283
  | test_case_id | param |
296
284
  | 4-1 | 123 |
297
285
  """
298
- And a tag prefix of "@test_case_"
299
286
  When the ids in the test suite are validated
300
287
  Then no test example rows are found to have malformed sub ids
301
288
 
@@ -313,7 +300,6 @@ Feature: Checking existing tags for correctness
313
300
  Scenario:
314
301
  * a step
315
302
  """
316
- And a tag prefix of "@test_case_"
317
303
  When the ids in the test suite are validated
318
304
  Then the following feature is found to have a test case tag:
319
305
  | path/to/has_a_feature_level_test_tag.feature:2 |
@@ -327,7 +313,6 @@ Feature: Checking existing tags for correctness
327
313
  Scenario:
328
314
  * a step
329
315
  """
330
- And a tag prefix of "@test_case_"
331
316
  When the ids in the test suite are validated
332
317
  Then no feature is found to have a test case tag
333
318
 
@@ -340,7 +325,6 @@ Feature: Checking existing tags for correctness
340
325
  Scenario:
341
326
  * a step
342
327
  """
343
- And a tag prefix of "@test_case_"
344
328
  When the ids in the test suite are validated
345
329
  Then no tests are found to be missing ids
346
330
 
@@ -361,7 +345,6 @@ Feature: Checking existing tags for correctness
361
345
  Examples:
362
346
  | param |
363
347
  """
364
- And a tag prefix of "@test_case_"
365
348
  When the ids in the test suite are validated
366
349
  Then the following tests are found to be missing ids:
367
350
  | path/to/has_untagged_tests.feature:3 |
@@ -1,5 +1,6 @@
1
1
  When(/^the files? (?:is|are) processed$/) do
2
2
  @start_index ||= {}
3
+ @tag_prefix ||= '@test_case_'
3
4
  @directory = CukeModeler::Directory.new(@test_directory)
4
5
 
5
6
  tagger = CukeCataloger::UniqueTestCaseTagger.new
@@ -11,7 +12,10 @@ end
11
12
  When(/^the ids in the test suite are validated$/) do
12
13
  @directory = CukeModeler::Directory.new(@test_directory)
13
14
 
14
- @test_results = CukeCataloger::UniqueTestCaseTagger.new.validate_test_ids(@directory.path, @tag_prefix)
15
+ args = [@directory.path]
16
+ args << @tag_prefix if @tag_prefix
17
+
18
+ @test_results = CukeCataloger::UniqueTestCaseTagger.new.validate_test_ids(*args)
15
19
  end
16
20
 
17
21
  When(/^the files are scanned$/) do
@@ -24,7 +28,9 @@ end
24
28
  When(/^the existing ids are determined$/) do
25
29
  @directory = CukeModeler::Directory.new(@test_directory)
26
30
 
27
- @ids_found = CukeCataloger::UniqueTestCaseTagger.new.determine_known_ids(@directory.path, @tag_prefix)
31
+ args = [@directory.path]
32
+ args << @tag_prefix if @tag_prefix
33
+ @ids_found = CukeCataloger::UniqueTestCaseTagger.new.determine_known_ids(*args)
28
34
  end
29
35
 
30
36
  When(/^the following command is executed:$/) do |command|
@@ -139,7 +139,7 @@ Then(/^the resulting first file is:$/) do |expected_text|
139
139
  begin
140
140
  expect(actual_text).to eq(expected_text)
141
141
  rescue RSpec::Expectations::ExpectationNotMetError => e
142
- if RUBY_PLATFORM =~ /linux/
142
+ if RUBY_PLATFORM =~ /(?:linux|java)/
143
143
  expected_text.sub!('test_case_1', 'test_case_2')
144
144
  expect(actual_text).to eq(expected_text)
145
145
  @switched = true
@@ -16,7 +16,7 @@ Before do
16
16
  begin
17
17
  @root_test_directory = CukeCataloger::FileHelper.create_directory
18
18
  rescue => e
19
- puts "Error caught in before hook!"
19
+ puts "Error caught in Before hook!"
20
20
  puts "Type: #{e.class}"
21
21
  puts "Message: #{e.message}"
22
22
  end
@@ -26,7 +26,7 @@ After do
26
26
  begin
27
27
  `git checkout HEAD -- #{FIXTURE_DIRECTORY}`
28
28
  rescue => e
29
- puts "Error caught in before hook!"
29
+ puts "Error caught in After hook!"
30
30
  puts "Type: #{e.class}"
31
31
  puts "Message: #{e.message}"
32
32
  end
@@ -1,3 +1,6 @@
1
+ require 'tmpdir'
2
+
3
+
1
4
  module CukeCataloger
2
5
  module FileHelper
3
6
 
@@ -20,12 +20,69 @@ describe 'UniqueTestCaseTagger, Integration' do
20
20
  # Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
21
21
  @tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
22
22
 
23
- Dir.mktmpdir { |path| @tagger.tag_tests(path, '') }
23
+ path = CukeCataloger::FileHelper.create_directory
24
+ @tagger.tag_tests(path, '')
24
25
 
25
26
  expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
26
27
  expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
27
28
  end
28
29
 
30
+ it 'uses a default tag prefix' do
31
+ test_directory = CukeCataloger::FileHelper.create_directory
32
+
33
+ starting_text = 'Feature:
34
+
35
+ Scenario:
36
+ * a step'
37
+
38
+ test_file = CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => starting_text)
39
+
40
+
41
+ @tagger.tag_tests(test_directory)
42
+
43
+ expected_text = 'Feature:
44
+
45
+ @test_case_1
46
+ Scenario:
47
+ * a step'
48
+
49
+ tagged_text = File.read(test_file)
50
+
51
+
52
+ expect(tagged_text).to eq(expected_text)
53
+ end
54
+
55
+ it 'uses a default id column name' do
56
+ test_directory = CukeCataloger::FileHelper.create_directory
57
+
58
+ starting_text = 'Feature:
59
+
60
+ Scenario Outline:
61
+ * a step
62
+ Examples:
63
+ | param |
64
+ | value |'
65
+
66
+ test_file = CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => starting_text)
67
+
68
+
69
+ @tagger.tag_tests(test_directory)
70
+
71
+ expected_text = 'Feature:
72
+
73
+ @test_case_1
74
+ Scenario Outline:
75
+ * a step
76
+ Examples:
77
+ | param | test_case_id |
78
+ | value | 1-1 |'
79
+
80
+ tagged_text = File.read(test_file)
81
+
82
+
83
+ expect(tagged_text).to eq(expected_text)
84
+ end
85
+
29
86
  end
30
87
 
31
88
  describe 'data validation' do
@@ -39,12 +96,49 @@ describe 'UniqueTestCaseTagger, Integration' do
39
96
  # Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
40
97
  @tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
41
98
 
42
- Dir.mktmpdir { |path| @tagger.validate_test_ids(path, '') }
99
+ path = CukeCataloger::FileHelper.create_directory
100
+ @tagger.validate_test_ids(path, '')
43
101
 
44
102
  expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
45
103
  expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
46
104
  end
47
105
 
106
+ it 'uses a default tag prefix' do
107
+ test_directory = CukeCataloger::FileHelper.create_directory
108
+
109
+ gherkin_text = 'Feature:
110
+
111
+ @test_case_1
112
+ Scenario:
113
+ * a step'
114
+
115
+ CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => gherkin_text)
116
+
117
+
118
+ results = @tagger.validate_test_ids(test_directory)
119
+
120
+ expect(results).to be_empty
121
+ end
122
+
123
+ it 'uses a default id column name' do
124
+ test_directory = CukeCataloger::FileHelper.create_directory
125
+
126
+ gherkin_text = 'Feature:
127
+
128
+ @test_case_1
129
+ Scenario Outline:
130
+ * a step
131
+ Examples:
132
+ | param | test_case_id |
133
+ | value 1 | 1-1 |'
134
+
135
+ CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => gherkin_text)
136
+
137
+
138
+ results = @tagger.validate_test_ids(test_directory)
139
+
140
+ expect(results).to be_empty
141
+ end
48
142
  end
49
143
 
50
144
  describe 'test scanning' do
@@ -58,11 +152,52 @@ describe 'UniqueTestCaseTagger, Integration' do
58
152
  # Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
59
153
  @tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
60
154
 
61
- Dir.mktmpdir { |path| @tagger.scan_for_tagged_tests(path, '') }
155
+ path = CukeCataloger::FileHelper.create_directory
156
+ @tagger.scan_for_tagged_tests(path, '')
62
157
 
63
158
  expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
64
159
  expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
65
160
  end
161
+
162
+ it 'uses a default tag prefix' do
163
+ test_directory = CukeCataloger::FileHelper.create_directory
164
+
165
+ gherkin_text = 'Feature:
166
+
167
+ @test_case_1
168
+ Scenario:
169
+ * a step'
170
+
171
+ test_file = CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => gherkin_text)
172
+
173
+
174
+ results = @tagger.scan_for_tagged_tests(test_directory)
175
+
176
+
177
+ expect(results.collect { |result| result[:test] }).to eq(["#{test_file}:4"])
178
+ end
179
+
180
+ it 'uses a default id column name' do
181
+ test_directory = CukeCataloger::FileHelper.create_directory
182
+
183
+ gherkin_text = 'Feature:
184
+
185
+ @test_case_1
186
+ Scenario Outline:
187
+ * a step
188
+ Examples:
189
+ | param | test_case_id |
190
+ | value 1 | 1-1 |'
191
+
192
+ test_file = CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => gherkin_text)
193
+
194
+
195
+ results = @tagger.scan_for_tagged_tests(test_directory)
196
+
197
+ expect(results.collect { |result| result[:test] }).to eq(["#{test_file}:4",
198
+ "#{test_file}:8"])
199
+ end
200
+
66
201
  end
67
202
 
68
203
  describe 'tag indexing' do
@@ -76,7 +211,8 @@ describe 'UniqueTestCaseTagger, Integration' do
76
211
  # Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
77
212
  @tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
78
213
 
79
- Dir.mktmpdir { |path| @tagger.determine_known_ids(path, '') }
214
+ path = CukeCataloger::FileHelper.create_directory
215
+ @tagger.determine_known_ids(path, '')
80
216
 
81
217
  expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
82
218
  expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
@@ -115,6 +251,45 @@ describe 'UniqueTestCaseTagger, Integration' do
115
251
  expect(result).to_not include('2-1', '2-2', '2-3')
116
252
  end
117
253
 
254
+ it 'uses a default tag prefix' do
255
+ test_directory = CukeCataloger::FileHelper.create_directory
256
+
257
+ text = 'Feature:
258
+
259
+ @test_case_1
260
+ Scenario:
261
+ * a step'
262
+
263
+ CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => text)
264
+
265
+
266
+ result = @tagger.determine_known_ids(test_directory)
267
+
268
+
269
+ expect(result).to eq(['1'])
270
+ end
271
+
272
+ it 'uses a default id column name' do
273
+ test_directory = CukeCataloger::FileHelper.create_directory
274
+
275
+ text = 'Feature:
276
+
277
+ @test_case_1
278
+ Scenario Outline:
279
+ * a step
280
+ Examples:
281
+ | param | test_case_id |
282
+ | value | 1-1 |'
283
+
284
+ CukeCataloger::FileHelper.create_feature_file(:directory => test_directory, :text => text)
285
+
286
+
287
+ result = @tagger.determine_known_ids(test_directory)
288
+
289
+
290
+ expect(result).to eq(['1', '1-1'])
291
+ end
292
+
118
293
  end
119
294
 
120
295
  end
@@ -14,8 +14,8 @@ describe 'UniqueTestCaseTagger, Unit' do
14
14
  expect(@tagger).to respond_to(:tag_tests)
15
15
  end
16
16
 
17
- it 'takes a directory, tag prefix, and an optional start index' do
18
- expect(@tagger.method(:tag_tests).arity).to eq(-3)
17
+ it 'takes a directory, optional tag prefix, and an optional start index' do
18
+ expect(@tagger.method(:tag_tests).arity).to eq(-2)
19
19
  end
20
20
  end
21
21
 
@@ -24,12 +24,13 @@ describe 'UniqueTestCaseTagger, Unit' do
24
24
  expect(@tagger).to respond_to(:validate_test_ids)
25
25
  end
26
26
 
27
- it 'validates based on a directory, tag prefix, and optional row tagging flag' do
28
- expect(@tagger.method(:validate_test_ids).arity).to eq(-3)
27
+ it 'validates based on a directory, optional tag prefix, and optional row tagging flag' do
28
+ expect(@tagger.method(:validate_test_ids).arity).to eq(-2)
29
29
  end
30
30
 
31
31
  it 'returns validation results' do
32
- results = Dir.mktmpdir { |path| @tagger.validate_test_ids(path, '') }
32
+ path = CukeCataloger::FileHelper.create_directory
33
+ results = @tagger.validate_test_ids(path, '')
33
34
 
34
35
  expect(results).to be_a_kind_of(Array)
35
36
  end
@@ -40,12 +41,13 @@ describe 'UniqueTestCaseTagger, Unit' do
40
41
  expect(@tagger).to respond_to(:scan_for_tagged_tests)
41
42
  end
42
43
 
43
- it 'validates based on a directory, tag prefix, and optional column name' do
44
- expect(@tagger.method(:scan_for_tagged_tests).arity).to eq(-3)
44
+ it 'validates based on a directory, optional tag prefix, and optional column name' do
45
+ expect(@tagger.method(:scan_for_tagged_tests).arity).to eq(-2)
45
46
  end
46
47
 
47
48
  it 'returns scanning results' do
48
- results = Dir.mktmpdir { |path| @tagger.scan_for_tagged_tests(path, '') }
49
+ path = CukeCataloger::FileHelper.create_directory
50
+ results = @tagger.scan_for_tagged_tests(path, '')
49
51
 
50
52
  expect(results).to be_a_kind_of(Array)
51
53
  end
@@ -56,8 +58,8 @@ describe 'UniqueTestCaseTagger, Unit' do
56
58
  expect(@tagger).to respond_to(:determine_known_ids)
57
59
  end
58
60
 
59
- it 'determines used indexes based on a directory, tag prefix, and optional column name' do
60
- expect(@tagger.method(:determine_known_ids).arity).to eq(-3)
61
+ it 'determines used indexes based on a directory, optional tag prefix, and optional column name' do
62
+ expect(@tagger.method(:determine_known_ids).arity).to eq(-2)
61
63
  end
62
64
  end
63
65
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuke_cataloger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kessler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-10 00:00:00.000000000 Z
11
+ date: 2018-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cuke_modeler
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  version: '0'
234
234
  requirements: []
235
235
  rubyforge_project:
236
- rubygems_version: 2.5.2
236
+ rubygems_version: 2.7.6
237
237
  signing_key:
238
238
  specification_version: 4
239
239
  summary: A tool to give every Cucumber test a unique id