cuke_cataloger 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,85 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'UniqueTestCaseTagger, Integration' do
4
+
5
+ clazz = CukeCataloger::UniqueTestCaseTagger
6
+
7
+ before(:each) do
8
+ @tagger = clazz.new
9
+ end
10
+
11
+ describe 'test tagging' do
12
+
13
+ # Bug fix - The #object_id of an object is used to track whether or not an id is already known or not for a
14
+ # particular test. Some ids may already have been stored from previous method calls and, if the memory from those
15
+ # previous calls is reassigned to new objects, this could result in test ids being associated with tests that don't
16
+ # have them.
17
+
18
+ it 'clears its known ids when it tags tests' do
19
+ # Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
20
+ @tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
21
+
22
+ @tagger.tag_tests(@default_file_directory, '')
23
+
24
+ expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
25
+ expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
26
+ end
27
+
28
+ end
29
+
30
+ describe 'data validation' do
31
+
32
+ # Bug fix - The #object_id of an object is used to track whether or not an id is already known or not for a
33
+ # particular test. Some ids may already have been stored from previous method calls and, if the memory from those
34
+ # previous calls is reassigned to new objects, this could result in test ids being associated with tests that don't
35
+ # have them.
36
+
37
+ it 'clears its known ids when it validates test ids' do
38
+ # Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
39
+ @tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
40
+
41
+ @tagger.validate_test_ids(@default_file_directory, '')
42
+
43
+ expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
44
+ expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
45
+ end
46
+
47
+ end
48
+
49
+ describe 'test scanning' do
50
+
51
+ # Bug fix - The #object_id of an object is used to track whether or not an id is already known or not for a
52
+ # particular test. Some ids may already have been stored from previous method calls and, if the memory from those
53
+ # previous calls is reassigned to new objects, this could result in test ids being associated with tests that don't
54
+ # have them.
55
+
56
+ it 'clears its known ids when it scans for tagged tests' do
57
+ # Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
58
+ @tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
59
+
60
+ @tagger.scan_for_tagged_tests(@default_file_directory, '')
61
+
62
+ expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
63
+ expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
64
+ end
65
+ end
66
+
67
+ describe 'tag indexing' do
68
+
69
+ # Bug fix - The #object_id of an object is used to track whether or not an id is already known or not for a
70
+ # particular test. Some ids may already have been stored from previous method calls and, if the memory from those
71
+ # previous calls is reassigned to new objects, this could result in test ids being associated with tests that don't
72
+ # have them.
73
+
74
+ it 'clears its known ids when it determines known test ids' do
75
+ # Using ids that are not used for memory allocation by Ruby since they are used for predefined constants.
76
+ @tagger.instance_variable_set(:@known_id_tags, {0 => '123', 2 => '456'})
77
+
78
+ @tagger.determine_known_ids(@default_file_directory, '')
79
+
80
+ expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(0)
81
+ expect(@tagger.instance_variable_get(:@known_id_tags)).to_not include(1)
82
+ end
83
+ end
84
+
85
+ end
@@ -0,0 +1,74 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'UniqueTestCaseTagger, Unit' do
4
+
5
+ clazz = CukeCataloger::UniqueTestCaseTagger
6
+
7
+ before(:each) do
8
+ @tagger = clazz.new
9
+ end
10
+
11
+ describe 'test tagging' do
12
+ it "can tag a suite's tests" do
13
+ expect(@tagger).to respond_to(:tag_tests)
14
+ end
15
+
16
+ it 'takes a directory, tag prefix, and an optional start index' do
17
+ expect(@tagger.method(:tag_tests).arity).to eq(-3)
18
+ end
19
+ end
20
+
21
+ describe 'data validation' do
22
+ it "can check the validity of a suite's test ids" do
23
+ expect(@tagger).to respond_to(:validate_test_ids)
24
+ end
25
+
26
+ it 'requires a directory and tag prefix when validating' do
27
+ expect(@tagger.method(:validate_test_ids).arity).to eq(2)
28
+ end
29
+
30
+ it 'returns validation results' do
31
+ expect(@tagger.validate_test_ids(@default_file_directory, '')).to be_a_kind_of(Array)
32
+ end
33
+ end
34
+
35
+ describe 'test scanning' do
36
+ it "can scan for tagged tests" do
37
+ expect(@tagger).to respond_to(:scan_for_tagged_tests)
38
+ end
39
+
40
+ it 'requires a directory and tag prefix when validating' do
41
+ expect(@tagger.method(:scan_for_tagged_tests).arity).to eq(2)
42
+ end
43
+
44
+ it 'returns scanning results' do
45
+ expect(@tagger.scan_for_tagged_tests(@default_file_directory, '')).to be_a_kind_of(Array)
46
+ end
47
+ end
48
+
49
+ describe 'tag indexing' do
50
+ it "can determine used test case indexes" do
51
+ expect(@tagger).to respond_to(:determine_known_ids)
52
+ end
53
+
54
+ it 'requires a directory and tag prefix when determining used indexes' do
55
+ expect(@tagger.method(:determine_known_ids).arity).to eq(2)
56
+ end
57
+ end
58
+
59
+ describe 'formatting' do
60
+ it 'has a tag location' do
61
+ expect(@tagger).to respond_to(:tag_location)
62
+ end
63
+
64
+ it 'can change its tag location' do
65
+ expect(@tagger).to respond_to(:tag_location=)
66
+
67
+ @tagger.tag_location = :some_flag_value
68
+ expect(@tagger.tag_location).to eq(:some_flag_value)
69
+ @tagger.tag_location = :some_other_flag_value
70
+ expect(@tagger.tag_location).to eq(:some_other_flag_value)
71
+ end
72
+ end
73
+
74
+ end
metadata ADDED
@@ -0,0 +1,255 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cuke_cataloger
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Eric Kessler
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-10-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: cuke_modeler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: cql
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.0'
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.1
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: '1.0'
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: 1.0.1
52
+ - !ruby/object:Gem::Dependency
53
+ name: rake
54
+ requirement: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: bundler
70
+ requirement: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '1.5'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: '1.5'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rake
86
+ requirement: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ - !ruby/object:Gem::Dependency
101
+ name: cucumber
102
+ requirement: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ - !ruby/object:Gem::Dependency
117
+ name: rspec
118
+ requirement: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ - !ruby/object:Gem::Dependency
133
+ name: racatt
134
+ requirement: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ type: :development
141
+ prerelease: false
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ none: false
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ - !ruby/object:Gem::Dependency
149
+ name: simplecov
150
+ requirement: !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ none: false
160
+ requirements:
161
+ - - ! '>='
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ - !ruby/object:Gem::Dependency
165
+ name: coveralls
166
+ requirement: !ruby/object:Gem::Requirement
167
+ none: false
168
+ requirements:
169
+ - - ! '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ type: :development
173
+ prerelease: false
174
+ version_requirements: !ruby/object:Gem::Requirement
175
+ none: false
176
+ requirements:
177
+ - - ! '>='
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ description: Scans existing Cucumber tests and updates them to include an id tag that
181
+ is unique for the test suite.
182
+ email:
183
+ - morrow748@gmail.com
184
+ executables: []
185
+ extensions: []
186
+ extra_rdoc_files: []
187
+ files:
188
+ - .gitignore
189
+ - .simplecov
190
+ - .travis.yml
191
+ - Gemfile
192
+ - History.md
193
+ - LICENSE.txt
194
+ - README.md
195
+ - Rakefile
196
+ - cuke_cataloger.gemspec
197
+ - features/formatting.feature
198
+ - features/step_definitions/action_steps.rb
199
+ - features/step_definitions/setup_steps.rb
200
+ - features/step_definitions/verification_steps.rb
201
+ - features/support/env.rb
202
+ - features/support/transforms.rb
203
+ - features/tag_indexing.feature
204
+ - features/test_case_scanning.feature
205
+ - features/test_case_scanning_payload.feature
206
+ - features/test_case_tagging.feature
207
+ - features/test_case_validation.feature
208
+ - lib/cuke_cataloger.rb
209
+ - lib/cuke_cataloger/unique_test_case_tagger.rb
210
+ - lib/cuke_cataloger/version.rb
211
+ - lib/extensions/cucumber_analytics_extensions.rb
212
+ - spec/spec_helper.rb
213
+ - spec/unique_test_case_tagger_integration_spec.rb
214
+ - spec/unique_test_case_tagger_unit_spec.rb
215
+ homepage: https://github.com/enkessler/cuke_cataloger
216
+ licenses:
217
+ - MIT
218
+ post_install_message:
219
+ rdoc_options: []
220
+ require_paths:
221
+ - lib
222
+ required_ruby_version: !ruby/object:Gem::Requirement
223
+ none: false
224
+ requirements:
225
+ - - ! '>='
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ required_rubygems_version: !ruby/object:Gem::Requirement
229
+ none: false
230
+ requirements:
231
+ - - ! '>='
232
+ - !ruby/object:Gem::Version
233
+ version: '0'
234
+ requirements: []
235
+ rubyforge_project:
236
+ rubygems_version: 1.8.29
237
+ signing_key:
238
+ specification_version: 3
239
+ summary: A tool to give every Cucumber test a unique id
240
+ test_files:
241
+ - features/formatting.feature
242
+ - features/step_definitions/action_steps.rb
243
+ - features/step_definitions/setup_steps.rb
244
+ - features/step_definitions/verification_steps.rb
245
+ - features/support/env.rb
246
+ - features/support/transforms.rb
247
+ - features/tag_indexing.feature
248
+ - features/test_case_scanning.feature
249
+ - features/test_case_scanning_payload.feature
250
+ - features/test_case_tagging.feature
251
+ - features/test_case_validation.feature
252
+ - spec/spec_helper.rb
253
+ - spec/unique_test_case_tagger_integration_spec.rb
254
+ - spec/unique_test_case_tagger_unit_spec.rb
255
+ has_rdoc: