generator-spec 0.4.5 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/README.markdown +58 -46
  2. data/VERSION +1 -1
  3. data/generator-spec.gemspec +83 -14
  4. data/lib/generator_spec/helpers/migration_helper.rb +2 -2
  5. data/lib/generator_spec/main.rb +5 -0
  6. data/lib/generator_spec/matchers/content/content_matcher.rb +84 -4
  7. data/lib/generator_spec/matchers/content/have_block.rb +24 -22
  8. data/lib/generator_spec/matchers/content/have_call.rb +21 -13
  9. data/lib/generator_spec/matchers/content/have_calls.rb +32 -26
  10. data/lib/generator_spec/matchers/content/have_class_self.rb +40 -0
  11. data/lib/generator_spec/matchers/content/have_method.rb +31 -24
  12. data/lib/generator_spec/matchers/content/have_module.rb +49 -19
  13. data/lib/generator_spec/matchers/content/have_region.rb +9 -10
  14. data/lib/generator_spec/matchers/content/have_subclass.rb +9 -15
  15. data/lib/generator_spec/matchers/content/include_module.rb +9 -10
  16. data/lib/generator_spec/matchers/content/inherit_from.rb +10 -10
  17. data/lib/generator_spec/matchers/file/generate_file.rb +4 -11
  18. data/lib/generator_spec/matchers/file/generate_migration.rb +1 -5
  19. data/lib/generator_spec/matchers/file/have_file.rb +115 -0
  20. data/lib/generator_spec/rails_helpers/rails_controller.rb +30 -32
  21. data/lib/generator_spec/rails_helpers/rails_model.rb +2 -1
  22. data/lib/generator_spec/rails_helpers/rails_view.rb +19 -3
  23. data/spec/generator_spec/{controller_generator_spec.rb → generators/controller_generator_spec.rb} +0 -0
  24. data/spec/generator_spec/{helper_generator_spec.rb → generators/helper_generator_spec.rb} +0 -0
  25. data/spec/generator_spec/{migration_generator_spec.rb → generators/migration_generator_spec.rb} +0 -0
  26. data/spec/generator_spec/{model_generator_spec.rb → generators/model_generator_spec.rb} +0 -0
  27. data/spec/generator_spec/{observer_generator_spec.rb → generators/observer_generator_spec.rb} +0 -0
  28. data/spec/generator_spec/{view_generator_spec.rb → generators/view_generator_spec.rb} +0 -0
  29. data/spec/generator_spec/matchers/content/class_self_spec.rb +32 -0
  30. data/spec/generator_spec/matchers/content/have_block_spec.rb +57 -0
  31. data/spec/generator_spec/matchers/content/have_call_spec.rb +39 -0
  32. data/spec/generator_spec/matchers/content/have_calls_spec.rb +50 -0
  33. data/spec/generator_spec/matchers/content/have_class_spec.rb +34 -0
  34. data/spec/generator_spec/matchers/content/have_method_spec.rb +52 -0
  35. data/spec/generator_spec/matchers/content/have_module_spec.rb +34 -0
  36. data/spec/generator_spec/matchers/content/have_region_spec.rb +56 -0
  37. data/spec/generator_spec/matchers/content/have_subclass_spec.rb +34 -0
  38. data/spec/generator_spec/matchers/content/include_module_spec.rb +36 -0
  39. data/spec/generator_spec/matchers/content/inherit_from_spec.rb +34 -0
  40. data/spec/generator_spec/matchers/file/directory_spec.rb +0 -0
  41. data/spec/generator_spec/matchers/file/file_spec.rb +0 -0
  42. data/spec/generator_spec/matchers/file/migration_spec.rb +0 -0
  43. data/spec/generator_spec/matchers/migration/have_column_spec.rb +0 -0
  44. data/spec/generator_spec/matchers/migration/have_index_spec.rb +0 -0
  45. data/spec/generator_spec/matchers/migration/have_table_spec.rb +0 -0
  46. data/spec/generator_spec/matchers/migration/have_tbl_column_spec.rb +0 -0
  47. data/spec/generator_spec/matchers/migration/have_up_down_spec.rb +0 -0
  48. data/spec/generator_spec/matchers/rails/controller_matcher_spec.rb +26 -0
  49. data/spec/generator_spec/matchers/rails/helper_matcher_spec.rb +26 -0
  50. data/spec/generator_spec/matchers/rails/mailer_matcher_spec.rb +24 -0
  51. data/spec/generator_spec/matchers/rails/model_matcher_spec.rb +31 -0
  52. data/spec/generator_spec/matchers/rails/observer_matcher_spec.rb +19 -0
  53. data/spec/generator_spec/matchers/rails/view_matcher_spec.rb +23 -0
  54. data/spec/generator_spec/rails_helpers/rails_app_spec.rb +0 -0
  55. data/spec/generator_spec/rails_helpers/rails_controller_spec.rb +0 -0
  56. data/spec/generator_spec/rails_helpers/rails_helper_spec.rb +0 -0
  57. data/spec/generator_spec/rails_helpers/rails_mailer_spec.rb +0 -0
  58. data/spec/generator_spec/rails_helpers/rails_migration_spec.rb +0 -0
  59. data/spec/generator_spec/rails_helpers/rails_model_spec.rb +0 -0
  60. data/spec/generator_spec/rails_helpers/rails_observer_spec.rb +0 -0
  61. data/spec/generator_spec/rails_helpers/rails_orm_spec.rb +0 -0
  62. data/spec/generator_spec/rails_helpers/rails_view_spec.rb +0 -0
  63. metadata +84 -15
  64. data/lib/generator_spec/matchers/content/have_class.rb +0 -53
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 5
9
- version: 0.4.5
8
+ - 7
9
+ version: 0.4.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup
@@ -139,7 +139,7 @@ files:
139
139
  - lib/generator_spec/matchers/content/have_block.rb
140
140
  - lib/generator_spec/matchers/content/have_call.rb
141
141
  - lib/generator_spec/matchers/content/have_calls.rb
142
- - lib/generator_spec/matchers/content/have_class.rb
142
+ - lib/generator_spec/matchers/content/have_class_self.rb
143
143
  - lib/generator_spec/matchers/content/have_method.rb
144
144
  - lib/generator_spec/matchers/content/have_module.rb
145
145
  - lib/generator_spec/matchers/content/have_region.rb
@@ -149,6 +149,7 @@ files:
149
149
  - lib/generator_spec/matchers/file/generate_directory.rb
150
150
  - lib/generator_spec/matchers/file/generate_file.rb
151
151
  - lib/generator_spec/matchers/file/generate_migration.rb
152
+ - lib/generator_spec/matchers/file/have_file.rb
152
153
  - lib/generator_spec/matchers/helpers/content.rb
153
154
  - lib/generator_spec/matchers/helpers/file.rb
154
155
  - lib/generator_spec/matchers/helpers/migration.rb
@@ -179,12 +180,46 @@ files:
179
180
  - lib/generators/observer/observer_generator.rb
180
181
  - lib/generators/view/view_generator.rb
181
182
  - rspec_for_generators.gemspec
182
- - spec/generator_spec/controller_generator_spec.rb
183
- - spec/generator_spec/helper_generator_spec.rb
184
- - spec/generator_spec/migration_generator_spec.rb
185
- - spec/generator_spec/model_generator_spec.rb
186
- - spec/generator_spec/observer_generator_spec.rb
187
- - spec/generator_spec/view_generator_spec.rb
183
+ - spec/generator_spec/generators/controller_generator_spec.rb
184
+ - spec/generator_spec/generators/helper_generator_spec.rb
185
+ - spec/generator_spec/generators/migration_generator_spec.rb
186
+ - spec/generator_spec/generators/model_generator_spec.rb
187
+ - spec/generator_spec/generators/observer_generator_spec.rb
188
+ - spec/generator_spec/generators/view_generator_spec.rb
189
+ - spec/generator_spec/matchers/content/class_self_spec.rb
190
+ - spec/generator_spec/matchers/content/have_block_spec.rb
191
+ - spec/generator_spec/matchers/content/have_call_spec.rb
192
+ - spec/generator_spec/matchers/content/have_calls_spec.rb
193
+ - spec/generator_spec/matchers/content/have_class_spec.rb
194
+ - spec/generator_spec/matchers/content/have_method_spec.rb
195
+ - spec/generator_spec/matchers/content/have_module_spec.rb
196
+ - spec/generator_spec/matchers/content/have_region_spec.rb
197
+ - spec/generator_spec/matchers/content/have_subclass_spec.rb
198
+ - spec/generator_spec/matchers/content/include_module_spec.rb
199
+ - spec/generator_spec/matchers/content/inherit_from_spec.rb
200
+ - spec/generator_spec/matchers/file/directory_spec.rb
201
+ - spec/generator_spec/matchers/file/file_spec.rb
202
+ - spec/generator_spec/matchers/file/migration_spec.rb
203
+ - spec/generator_spec/matchers/migration/have_column_spec.rb
204
+ - spec/generator_spec/matchers/migration/have_index_spec.rb
205
+ - spec/generator_spec/matchers/migration/have_table_spec.rb
206
+ - spec/generator_spec/matchers/migration/have_tbl_column_spec.rb
207
+ - spec/generator_spec/matchers/migration/have_up_down_spec.rb
208
+ - spec/generator_spec/matchers/rails/controller_matcher_spec.rb
209
+ - spec/generator_spec/matchers/rails/helper_matcher_spec.rb
210
+ - spec/generator_spec/matchers/rails/mailer_matcher_spec.rb
211
+ - spec/generator_spec/matchers/rails/model_matcher_spec.rb
212
+ - spec/generator_spec/matchers/rails/observer_matcher_spec.rb
213
+ - spec/generator_spec/matchers/rails/view_matcher_spec.rb
214
+ - spec/generator_spec/rails_helpers/rails_app_spec.rb
215
+ - spec/generator_spec/rails_helpers/rails_controller_spec.rb
216
+ - spec/generator_spec/rails_helpers/rails_helper_spec.rb
217
+ - spec/generator_spec/rails_helpers/rails_mailer_spec.rb
218
+ - spec/generator_spec/rails_helpers/rails_migration_spec.rb
219
+ - spec/generator_spec/rails_helpers/rails_model_spec.rb
220
+ - spec/generator_spec/rails_helpers/rails_observer_spec.rb
221
+ - spec/generator_spec/rails_helpers/rails_orm_spec.rb
222
+ - spec/generator_spec/rails_helpers/rails_view_spec.rb
188
223
  - spec/spec_helper.rb
189
224
  - wiki/Custom Rails 3 Generators.textile
190
225
  - wiki/content_matchers.textile
@@ -224,10 +259,44 @@ signing_key:
224
259
  specification_version: 3
225
260
  summary: RSpec 2 library for writing generator specs
226
261
  test_files:
227
- - spec/generator_spec/controller_generator_spec.rb
228
- - spec/generator_spec/helper_generator_spec.rb
229
- - spec/generator_spec/migration_generator_spec.rb
230
- - spec/generator_spec/model_generator_spec.rb
231
- - spec/generator_spec/observer_generator_spec.rb
232
- - spec/generator_spec/view_generator_spec.rb
262
+ - spec/generator_spec/generators/controller_generator_spec.rb
263
+ - spec/generator_spec/generators/helper_generator_spec.rb
264
+ - spec/generator_spec/generators/migration_generator_spec.rb
265
+ - spec/generator_spec/generators/model_generator_spec.rb
266
+ - spec/generator_spec/generators/observer_generator_spec.rb
267
+ - spec/generator_spec/generators/view_generator_spec.rb
268
+ - spec/generator_spec/matchers/content/class_self_spec.rb
269
+ - spec/generator_spec/matchers/content/have_block_spec.rb
270
+ - spec/generator_spec/matchers/content/have_call_spec.rb
271
+ - spec/generator_spec/matchers/content/have_calls_spec.rb
272
+ - spec/generator_spec/matchers/content/have_class_spec.rb
273
+ - spec/generator_spec/matchers/content/have_method_spec.rb
274
+ - spec/generator_spec/matchers/content/have_module_spec.rb
275
+ - spec/generator_spec/matchers/content/have_region_spec.rb
276
+ - spec/generator_spec/matchers/content/have_subclass_spec.rb
277
+ - spec/generator_spec/matchers/content/include_module_spec.rb
278
+ - spec/generator_spec/matchers/content/inherit_from_spec.rb
279
+ - spec/generator_spec/matchers/file/directory_spec.rb
280
+ - spec/generator_spec/matchers/file/file_spec.rb
281
+ - spec/generator_spec/matchers/file/migration_spec.rb
282
+ - spec/generator_spec/matchers/migration/have_column_spec.rb
283
+ - spec/generator_spec/matchers/migration/have_index_spec.rb
284
+ - spec/generator_spec/matchers/migration/have_table_spec.rb
285
+ - spec/generator_spec/matchers/migration/have_tbl_column_spec.rb
286
+ - spec/generator_spec/matchers/migration/have_up_down_spec.rb
287
+ - spec/generator_spec/matchers/rails/controller_matcher_spec.rb
288
+ - spec/generator_spec/matchers/rails/helper_matcher_spec.rb
289
+ - spec/generator_spec/matchers/rails/mailer_matcher_spec.rb
290
+ - spec/generator_spec/matchers/rails/model_matcher_spec.rb
291
+ - spec/generator_spec/matchers/rails/observer_matcher_spec.rb
292
+ - spec/generator_spec/matchers/rails/view_matcher_spec.rb
293
+ - spec/generator_spec/rails_helpers/rails_app_spec.rb
294
+ - spec/generator_spec/rails_helpers/rails_controller_spec.rb
295
+ - spec/generator_spec/rails_helpers/rails_helper_spec.rb
296
+ - spec/generator_spec/rails_helpers/rails_mailer_spec.rb
297
+ - spec/generator_spec/rails_helpers/rails_migration_spec.rb
298
+ - spec/generator_spec/rails_helpers/rails_model_spec.rb
299
+ - spec/generator_spec/rails_helpers/rails_observer_spec.rb
300
+ - spec/generator_spec/rails_helpers/rails_orm_spec.rb
301
+ - spec/generator_spec/rails_helpers/rails_view_spec.rb
233
302
  - spec/spec_helper.rb
@@ -1,53 +0,0 @@
1
- module RSpec::RubyContentMatchers
2
- class HaveClass < RSpec::RubyContentMatcher
3
- attr_reader :klass, :type
4
-
5
- def initialize(klass, type=nil)
6
- @klass = klass.to_s.camelize
7
- @type = type.to_s.camelize if type
8
- end
9
-
10
- def matches?(content)
11
- super
12
- match_res = (content =~ /class\s+#{klass}#{type}\s+(.*)#{end_expr}/m)
13
- if block_given? && $1
14
- ruby_content = $1.strip.extend(RSpec::RubyContent::Helpers)
15
- yield ruby_content
16
- end
17
- match_res
18
- end
19
-
20
- def failure_message
21
- super
22
- "Expected there to be the class #{klass}"
23
- end
24
-
25
- def negative_failure_message
26
- super
27
- "Did no expected there to be the class #{klass}"
28
- end
29
-
30
- def end_expr
31
- "(end|# #{klass})"
32
- end
33
-
34
- end
35
-
36
- def have_class(klass, type = nil)
37
- HaveClass.new(klass, type)
38
- end
39
- alias_method :be_class, :have_class
40
-
41
- def have_helper_class(klass)
42
- HaveClass.new(klass, :helper)
43
- end
44
- alias_method :be_helper_class, :have_helper_class
45
-
46
-
47
- def have_controller_class(klass)
48
- HaveClass.new(klass, :controller)
49
- end
50
- alias_method :be_controller_class, :have_controller_class
51
- end
52
-
53
-