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.
- data/README.markdown +58 -46
- data/VERSION +1 -1
- data/generator-spec.gemspec +83 -14
- data/lib/generator_spec/helpers/migration_helper.rb +2 -2
- data/lib/generator_spec/main.rb +5 -0
- data/lib/generator_spec/matchers/content/content_matcher.rb +84 -4
- data/lib/generator_spec/matchers/content/have_block.rb +24 -22
- data/lib/generator_spec/matchers/content/have_call.rb +21 -13
- data/lib/generator_spec/matchers/content/have_calls.rb +32 -26
- data/lib/generator_spec/matchers/content/have_class_self.rb +40 -0
- data/lib/generator_spec/matchers/content/have_method.rb +31 -24
- data/lib/generator_spec/matchers/content/have_module.rb +49 -19
- data/lib/generator_spec/matchers/content/have_region.rb +9 -10
- data/lib/generator_spec/matchers/content/have_subclass.rb +9 -15
- data/lib/generator_spec/matchers/content/include_module.rb +9 -10
- data/lib/generator_spec/matchers/content/inherit_from.rb +10 -10
- data/lib/generator_spec/matchers/file/generate_file.rb +4 -11
- data/lib/generator_spec/matchers/file/generate_migration.rb +1 -5
- data/lib/generator_spec/matchers/file/have_file.rb +115 -0
- data/lib/generator_spec/rails_helpers/rails_controller.rb +30 -32
- data/lib/generator_spec/rails_helpers/rails_model.rb +2 -1
- data/lib/generator_spec/rails_helpers/rails_view.rb +19 -3
- data/spec/generator_spec/{controller_generator_spec.rb → generators/controller_generator_spec.rb} +0 -0
- data/spec/generator_spec/{helper_generator_spec.rb → generators/helper_generator_spec.rb} +0 -0
- data/spec/generator_spec/{migration_generator_spec.rb → generators/migration_generator_spec.rb} +0 -0
- data/spec/generator_spec/{model_generator_spec.rb → generators/model_generator_spec.rb} +0 -0
- data/spec/generator_spec/{observer_generator_spec.rb → generators/observer_generator_spec.rb} +0 -0
- data/spec/generator_spec/{view_generator_spec.rb → generators/view_generator_spec.rb} +0 -0
- data/spec/generator_spec/matchers/content/class_self_spec.rb +32 -0
- data/spec/generator_spec/matchers/content/have_block_spec.rb +57 -0
- data/spec/generator_spec/matchers/content/have_call_spec.rb +39 -0
- data/spec/generator_spec/matchers/content/have_calls_spec.rb +50 -0
- data/spec/generator_spec/matchers/content/have_class_spec.rb +34 -0
- data/spec/generator_spec/matchers/content/have_method_spec.rb +52 -0
- data/spec/generator_spec/matchers/content/have_module_spec.rb +34 -0
- data/spec/generator_spec/matchers/content/have_region_spec.rb +56 -0
- data/spec/generator_spec/matchers/content/have_subclass_spec.rb +34 -0
- data/spec/generator_spec/matchers/content/include_module_spec.rb +36 -0
- data/spec/generator_spec/matchers/content/inherit_from_spec.rb +34 -0
- data/spec/generator_spec/matchers/file/directory_spec.rb +0 -0
- data/spec/generator_spec/matchers/file/file_spec.rb +0 -0
- data/spec/generator_spec/matchers/file/migration_spec.rb +0 -0
- data/spec/generator_spec/matchers/migration/have_column_spec.rb +0 -0
- data/spec/generator_spec/matchers/migration/have_index_spec.rb +0 -0
- data/spec/generator_spec/matchers/migration/have_table_spec.rb +0 -0
- data/spec/generator_spec/matchers/migration/have_tbl_column_spec.rb +0 -0
- data/spec/generator_spec/matchers/migration/have_up_down_spec.rb +0 -0
- data/spec/generator_spec/matchers/rails/controller_matcher_spec.rb +26 -0
- data/spec/generator_spec/matchers/rails/helper_matcher_spec.rb +26 -0
- data/spec/generator_spec/matchers/rails/mailer_matcher_spec.rb +24 -0
- data/spec/generator_spec/matchers/rails/model_matcher_spec.rb +31 -0
- data/spec/generator_spec/matchers/rails/observer_matcher_spec.rb +19 -0
- data/spec/generator_spec/matchers/rails/view_matcher_spec.rb +23 -0
- data/spec/generator_spec/rails_helpers/rails_app_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_controller_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_helper_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_mailer_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_migration_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_model_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_observer_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_orm_spec.rb +0 -0
- data/spec/generator_spec/rails_helpers/rails_view_spec.rb +0 -0
- metadata +84 -15
- 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
|
-
-
|
9
|
-
version: 0.4.
|
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/
|
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
|
-
|