spreewald 1.5.5 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +113 -97
  3. data/Rakefile +3 -3
  4. data/bin/spreewald +64 -23
  5. data/features/binary.feature +246 -0
  6. data/features/support/aruba.rb +1 -0
  7. data/lib/spreewald/web_steps.rb +1 -3
  8. data/lib/spreewald_support/version.rb +1 -1
  9. data/spreewald.gemspec +10 -0
  10. data/support/parser.rb +25 -0
  11. data/support/paths_manager.rb +35 -0
  12. data/support/step_definition.rb +46 -0
  13. data/support/step_definition_file.rb +50 -0
  14. data/support/step_manager.rb +32 -0
  15. data/tests/rails-2.3/app +1 -0
  16. data/tests/rails-2.3/config/cucumber.yml +1 -0
  17. data/tests/rails-2.3/config/database.yml +1 -0
  18. data/tests/rails-2.3/db +1 -0
  19. data/tests/rails-2.3/features/shared +1 -0
  20. data/tests/rails-2.3/features/support/paths.rb +1 -0
  21. data/tests/rails-2.3/features/support/selectors.rb +1 -0
  22. data/tests/rails-2.3/public +1 -0
  23. data/tests/rails-3.2/capybara-1/app +1 -0
  24. data/tests/rails-3.2/capybara-1/config/cucumber.yml +1 -0
  25. data/tests/rails-3.2/capybara-1/config/database.yml +1 -0
  26. data/tests/rails-3.2/capybara-1/db +1 -0
  27. data/tests/rails-3.2/capybara-1/features/shared +1 -0
  28. data/tests/rails-3.2/capybara-1/features/support/paths.rb +1 -0
  29. data/tests/rails-3.2/capybara-1/features/support/selectors.rb +1 -0
  30. data/tests/rails-3.2/capybara-1/public +1 -0
  31. data/tests/rails-3.2/capybara-2/Rakefile +1 -0
  32. data/tests/rails-3.2/capybara-2/app +1 -0
  33. data/tests/rails-3.2/capybara-2/config +1 -0
  34. data/tests/rails-3.2/capybara-2/db +1 -0
  35. data/tests/rails-3.2/capybara-2/features +1 -0
  36. data/tests/rails-3.2/capybara-2/public +1 -0
  37. metadata +165 -67
  38. data/support/documentation_generator.rb +0 -119
  39. data/tests/rails-2.3/config/cucumber.yml +0 -2
  40. data/tests/rails-2.3/config/database.yml +0 -3
  41. data/tests/rails-2.3/features/support/paths.rb +0 -16
  42. data/tests/rails-2.3/features/support/selectors.rb +0 -43
  43. data/tests/rails-3.2/capybara-1/config/cucumber.yml +0 -2
  44. data/tests/rails-3.2/capybara-1/config/database.yml +0 -3
  45. data/tests/rails-3.2/capybara-1/features/support/paths.rb +0 -16
  46. data/tests/rails-3.2/capybara-1/features/support/selectors.rb +0 -43
  47. data/tests/rails-3.2/capybara-2/Rakefile +0 -18
@@ -0,0 +1,46 @@
1
+ require File.expand_path('../parser', __FILE__)
2
+
3
+ class StepDefinition
4
+
5
+ attr_accessor :kind, :step, :comment
6
+
7
+ def self.new_from_raw(raw_step)
8
+ raw_step =~ /^\s*(When|Then|Given|AfterStep)(.*)do/
9
+ kind, step = $1, $2
10
+ return unless step
11
+
12
+ comment = Parser.format_comment(raw_step)
13
+ return if comment =~ /\bnodoc\b/
14
+
15
+ new(kind, step, comment)
16
+ end
17
+
18
+ def initialize(kind, step, comment = nil)
19
+ self.kind = kind
20
+ self.step = step.strip
21
+ self.comment = comment
22
+ end
23
+
24
+ def to_markdown
25
+ <<-TEXT
26
+ * **#{kind} #{pretty_step}**
27
+
28
+ #{ comment.gsub /^/, ' ' }
29
+ TEXT
30
+ end
31
+
32
+ def to_s
33
+ "#{kind} #{pretty_step}"
34
+ end
35
+
36
+ private
37
+
38
+ def pretty_step
39
+ if kind == 'AfterStep'
40
+ step[/@\w+/]
41
+ else
42
+ Parser.human_regex(step)
43
+ end
44
+ end
45
+
46
+ end
@@ -0,0 +1,50 @@
1
+ require File.expand_path('../step_definition', __FILE__)
2
+ require File.expand_path('../parser', __FILE__)
3
+
4
+ class StepDefinitionFile
5
+
6
+ FILE_COMMENT_END = 'FILE_COMMENT_END'
7
+
8
+ attr_accessor :steps
9
+
10
+ def initialize(filename)
11
+ @filename = filename
12
+ @code = File.read(filename)
13
+ self.steps = []
14
+ extract_comment
15
+ add_steps
16
+ end
17
+
18
+ def to_markdown
19
+ <<-TEXT
20
+ ### #{ @filename.split('/').last }
21
+
22
+ #{@comment}
23
+
24
+ #{ steps.collect(&:to_markdown).join("\n\n") }
25
+ TEXT
26
+ end
27
+
28
+ def real_steps
29
+ steps.select do |definition|
30
+ StepManager::STEP_KINDS.include? definition.kind
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def extract_comment
37
+ if @code.include?(FILE_COMMENT_END)
38
+ file_comment = @code.split(FILE_COMMENT_END).first
39
+ @comment = Parser.format_comment(file_comment)
40
+ end
41
+ end
42
+
43
+ def add_steps
44
+ @code.split("\n\n").each do |block|
45
+ step = StepDefinition.new_from_raw(block)
46
+ steps << step if step
47
+ end
48
+ end
49
+
50
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path('../step_definition_file', __FILE__)
2
+
3
+ class StepManager
4
+ STEP_KINDS = %w[Given When Then]
5
+
6
+ attr_accessor :directories, :step_files
7
+
8
+ def initialize(*directories)
9
+ self.directories = directories
10
+ self.step_files = directories.map(&method(:collect_files)).flatten.compact
11
+ end
12
+
13
+ def to_markdown
14
+ step_files.collect(&:to_markdown).join "\n\n"
15
+ end
16
+
17
+ def steps(search = nil)
18
+ step_files.collect(&:real_steps).flatten.
19
+ sort_by { |step| [STEP_KINDS.index(step.kind), step.to_s.downcase] }.
20
+ select { |definition| search.nil? or definition.step =~ Regexp.new(search) }
21
+ end
22
+
23
+ private
24
+
25
+ def collect_files(directory)
26
+ Dir["#{directory}/**/*_steps.rb"].to_a.sort.map do |filename|
27
+ next if filename.include? 'spreewald/all_steps'
28
+ StepDefinitionFile.new(filename)
29
+ end.compact
30
+ end
31
+
32
+ end
@@ -0,0 +1 @@
1
+ ../shared/app
@@ -0,0 +1 @@
1
+ ../../shared/config/cucumber.yml
@@ -0,0 +1 @@
1
+ ../../shared/config/database.yml
@@ -0,0 +1 @@
1
+ ../shared/db
@@ -0,0 +1 @@
1
+ ../../shared/features/shared
@@ -0,0 +1 @@
1
+ ../../../shared/features/support/paths.rb
@@ -0,0 +1 @@
1
+ ../../../shared/features/support/selectors.rb
@@ -0,0 +1 @@
1
+ ../shared/public/
@@ -0,0 +1 @@
1
+ ../../shared/app
@@ -0,0 +1 @@
1
+ ../../../shared/config/cucumber.yml
@@ -0,0 +1 @@
1
+ ../../../shared/config/database.yml
@@ -0,0 +1 @@
1
+ ../../shared/db
@@ -0,0 +1 @@
1
+ ../../../shared/features/shared
@@ -0,0 +1 @@
1
+ ../../../../shared/features/support/paths.rb
@@ -0,0 +1 @@
1
+ ../../../../shared/features/support/selectors.rb
@@ -0,0 +1 @@
1
+ ../../shared/public/
@@ -0,0 +1 @@
1
+ ../capybara-1/Rakefile
@@ -0,0 +1 @@
1
+ ../capybara-1/app
@@ -0,0 +1 @@
1
+ ../capybara-1/config
@@ -0,0 +1 @@
1
+ ../capybara-1/db
@@ -0,0 +1 @@
1
+ ../capybara-1/features
@@ -0,0 +1 @@
1
+ ../../shared/public/
metadata CHANGED
@@ -1,67 +1,145 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: spreewald
3
- version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease:
6
- segments:
7
- - 1
8
- - 5
9
- - 5
10
- version: 1.5.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.6.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Tobias Kraze
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2016-09-20 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2016-12-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: cucumber
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
26
17
  - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
32
20
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: cucumber_priority
36
21
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
40
24
  - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cucumber_priority
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
46
34
  type: :runtime
47
- version_requirements: *id002
48
- description: A collection of cucumber steps we use in our projects, including steps to check HTML, tables, emails and some utility methods.
49
- email:
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: aruba
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.10.2
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.10.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-cucumber
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 3.4.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 3.4.0
125
+ description: A collection of cucumber steps we use in our projects, including steps
126
+ to check HTML, tables, emails and some utility methods.
127
+ email:
50
128
  - tobias@kraze.eu
51
- executables:
129
+ executables:
52
130
  - spreewald
53
131
  extensions: []
54
-
55
132
  extra_rdoc_files: []
56
-
57
- files:
58
- - .gitignore
133
+ files:
134
+ - ".gitignore"
59
135
  - LICENSE
60
136
  - README.md
61
137
  - Rakefile
62
138
  - bin/spreewald
63
139
  - examples/paths.rb
64
140
  - examples/selectors.rb
141
+ - features/binary.feature
142
+ - features/support/aruba.rb
65
143
  - lib/spreewald.rb
66
144
  - lib/spreewald/all_steps.rb
67
145
  - lib/spreewald/development_steps.rb
@@ -79,12 +157,17 @@ files:
79
157
  - lib/spreewald_support/version.rb
80
158
  - lib/spreewald_support/web_steps_helpers.rb
81
159
  - spreewald.gemspec
82
- - support/documentation_generator.rb
160
+ - support/parser.rb
161
+ - support/paths_manager.rb
162
+ - support/step_definition.rb
163
+ - support/step_definition_file.rb
164
+ - support/step_manager.rb
83
165
  - tests/rails-2.3/.firefox-version
84
166
  - tests/rails-2.3/.ruby-version
85
167
  - tests/rails-2.3/Gemfile
86
168
  - tests/rails-2.3/Gemfile.lock
87
169
  - tests/rails-2.3/Rakefile
170
+ - tests/rails-2.3/app
88
171
  - tests/rails-2.3/config/boot.rb
89
172
  - tests/rails-2.3/config/cucumber.yml
90
173
  - tests/rails-2.3/config/database.yml
@@ -98,9 +181,12 @@ files:
98
181
  - tests/rails-2.3/config/initializers/session_store.rb
99
182
  - tests/rails-2.3/config/preinitializer.rb
100
183
  - tests/rails-2.3/config/routes.rb
184
+ - tests/rails-2.3/db
185
+ - tests/rails-2.3/features/shared
101
186
  - tests/rails-2.3/features/support/env.rb
102
187
  - tests/rails-2.3/features/support/paths.rb
103
188
  - tests/rails-2.3/features/support/selectors.rb
189
+ - tests/rails-2.3/public
104
190
  - tests/rails-2.3/scripts/generate
105
191
  - tests/rails-3.2/.DS_Store
106
192
  - tests/rails-3.2/capybara-1/.firefox-version
@@ -108,6 +194,7 @@ files:
108
194
  - tests/rails-3.2/capybara-1/Gemfile
109
195
  - tests/rails-3.2/capybara-1/Gemfile.lock
110
196
  - tests/rails-3.2/capybara-1/Rakefile
197
+ - tests/rails-3.2/capybara-1/app
111
198
  - tests/rails-3.2/capybara-1/config/application.rb
112
199
  - tests/rails-3.2/capybara-1/config/boot.rb
113
200
  - tests/rails-3.2/capybara-1/config/cucumber.yml
@@ -119,15 +206,23 @@ files:
119
206
  - tests/rails-3.2/capybara-1/config/initializers/secret_token.rb
120
207
  - tests/rails-3.2/capybara-1/config/initializers/session_store.rb
121
208
  - tests/rails-3.2/capybara-1/config/routes.rb
209
+ - tests/rails-3.2/capybara-1/db
210
+ - tests/rails-3.2/capybara-1/features/shared
122
211
  - tests/rails-3.2/capybara-1/features/support/env.rb
123
212
  - tests/rails-3.2/capybara-1/features/support/paths.rb
124
213
  - tests/rails-3.2/capybara-1/features/support/selectors.rb
214
+ - tests/rails-3.2/capybara-1/public
125
215
  - tests/rails-3.2/capybara-2/.firefox-version
126
216
  - tests/rails-3.2/capybara-2/.ruby-version
127
217
  - tests/rails-3.2/capybara-2/Gemfile
128
218
  - tests/rails-3.2/capybara-2/Gemfile.lock
129
219
  - tests/rails-3.2/capybara-2/Rakefile
220
+ - tests/rails-3.2/capybara-2/app
221
+ - tests/rails-3.2/capybara-2/config
130
222
  - tests/rails-3.2/capybara-2/config.ru
223
+ - tests/rails-3.2/capybara-2/db
224
+ - tests/rails-3.2/capybara-2/features
225
+ - tests/rails-3.2/capybara-2/public
131
226
  - tests/rails-3.2/capybara-2/script/cucumber
132
227
  - tests/rails-3.2/capybara-2/script/rails
133
228
  - tests/shared/app/controllers/application_controller.rb
@@ -165,44 +260,36 @@ files:
165
260
  - tests/shared/public/favicon.ico
166
261
  - tests/shared/public/javascripts/jquery-1.7.2.min.js
167
262
  homepage: https://github.com/makandra/spreewald
168
- licenses:
263
+ licenses:
169
264
  - MIT
265
+ metadata: {}
170
266
  post_install_message:
171
267
  rdoc_options: []
172
-
173
- require_paths:
268
+ require_paths:
174
269
  - lib
175
- required_ruby_version: !ruby/object:Gem::Requirement
176
- none: false
177
- requirements:
270
+ required_ruby_version: !ruby/object:Gem::Requirement
271
+ requirements:
178
272
  - - ">="
179
- - !ruby/object:Gem::Version
180
- hash: 3
181
- segments:
182
- - 0
183
- version: "0"
184
- required_rubygems_version: !ruby/object:Gem::Requirement
185
- none: false
186
- requirements:
273
+ - !ruby/object:Gem::Version
274
+ version: '0'
275
+ required_rubygems_version: !ruby/object:Gem::Requirement
276
+ requirements:
187
277
  - - ">="
188
- - !ruby/object:Gem::Version
189
- hash: 3
190
- segments:
191
- - 0
192
- version: "0"
278
+ - !ruby/object:Gem::Version
279
+ version: '0'
193
280
  requirements: []
194
-
195
281
  rubyforge_project:
196
- rubygems_version: 1.8.29
282
+ rubygems_version: 2.5.1
197
283
  signing_key:
198
- specification_version: 3
284
+ specification_version: 4
199
285
  summary: Collection of useful cucumber steps.
200
- test_files:
286
+ test_files:
201
287
  - tests/rails-2.3/.firefox-version
202
288
  - tests/rails-2.3/.ruby-version
203
289
  - tests/rails-2.3/Gemfile
204
290
  - tests/rails-2.3/Gemfile.lock
205
291
  - tests/rails-2.3/Rakefile
292
+ - tests/rails-2.3/app
206
293
  - tests/rails-2.3/config/boot.rb
207
294
  - tests/rails-2.3/config/cucumber.yml
208
295
  - tests/rails-2.3/config/database.yml
@@ -216,9 +303,12 @@ test_files:
216
303
  - tests/rails-2.3/config/initializers/session_store.rb
217
304
  - tests/rails-2.3/config/preinitializer.rb
218
305
  - tests/rails-2.3/config/routes.rb
306
+ - tests/rails-2.3/db
307
+ - tests/rails-2.3/features/shared
219
308
  - tests/rails-2.3/features/support/env.rb
220
309
  - tests/rails-2.3/features/support/paths.rb
221
310
  - tests/rails-2.3/features/support/selectors.rb
311
+ - tests/rails-2.3/public
222
312
  - tests/rails-2.3/scripts/generate
223
313
  - tests/rails-3.2/.DS_Store
224
314
  - tests/rails-3.2/capybara-1/.firefox-version
@@ -226,6 +316,7 @@ test_files:
226
316
  - tests/rails-3.2/capybara-1/Gemfile
227
317
  - tests/rails-3.2/capybara-1/Gemfile.lock
228
318
  - tests/rails-3.2/capybara-1/Rakefile
319
+ - tests/rails-3.2/capybara-1/app
229
320
  - tests/rails-3.2/capybara-1/config/application.rb
230
321
  - tests/rails-3.2/capybara-1/config/boot.rb
231
322
  - tests/rails-3.2/capybara-1/config/cucumber.yml
@@ -237,15 +328,23 @@ test_files:
237
328
  - tests/rails-3.2/capybara-1/config/initializers/secret_token.rb
238
329
  - tests/rails-3.2/capybara-1/config/initializers/session_store.rb
239
330
  - tests/rails-3.2/capybara-1/config/routes.rb
331
+ - tests/rails-3.2/capybara-1/db
332
+ - tests/rails-3.2/capybara-1/features/shared
240
333
  - tests/rails-3.2/capybara-1/features/support/env.rb
241
334
  - tests/rails-3.2/capybara-1/features/support/paths.rb
242
335
  - tests/rails-3.2/capybara-1/features/support/selectors.rb
336
+ - tests/rails-3.2/capybara-1/public
243
337
  - tests/rails-3.2/capybara-2/.firefox-version
244
338
  - tests/rails-3.2/capybara-2/.ruby-version
245
339
  - tests/rails-3.2/capybara-2/Gemfile
246
340
  - tests/rails-3.2/capybara-2/Gemfile.lock
247
341
  - tests/rails-3.2/capybara-2/Rakefile
342
+ - tests/rails-3.2/capybara-2/app
343
+ - tests/rails-3.2/capybara-2/config
248
344
  - tests/rails-3.2/capybara-2/config.ru
345
+ - tests/rails-3.2/capybara-2/db
346
+ - tests/rails-3.2/capybara-2/features
347
+ - tests/rails-3.2/capybara-2/public
249
348
  - tests/rails-3.2/capybara-2/script/cucumber
250
349
  - tests/rails-3.2/capybara-2/script/rails
251
350
  - tests/shared/app/controllers/application_controller.rb
@@ -282,4 +381,3 @@ test_files:
282
381
  - tests/shared/features/support/selectors.rb
283
382
  - tests/shared/public/favicon.ico
284
383
  - tests/shared/public/javascripts/jquery-1.7.2.min.js
285
- has_rdoc: