shoulda_matchmakers 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +21 -0
- data/lib/controller/action_controller/action_controller_controller_sm_model.rb +53 -0
- data/lib/controller/action_controller/action_controller_controller_sm_model_helper.rb +73 -0
- data/lib/controller/action_controller/matchmakers/callbacks.rb +56 -0
- data/lib/controller/action_controller/matchmakers/filter_param.rb +69 -0
- data/lib/controller/action_controller/matchmakers/permit.rb +510 -0
- data/lib/controller/action_controller/matchmakers/redirect_to.rb +126 -0
- data/lib/controller/action_controller/matchmakers/render_template.rb +198 -0
- data/lib/controller/action_controller/matchmakers/render_with_layout.rb +72 -0
- data/lib/controller/action_controller/matchmakers/rescue_from.rb +96 -0
- data/lib/controller/action_controller/matchmakers/respond_with.rb +71 -0
- data/lib/controller/action_controller/matchmakers/route.rb +586 -0
- data/lib/controller/action_controller/matchmakers/set_flash.rb +136 -0
- data/lib/controller/action_controller/matchmakers/set_session.rb +115 -0
- data/lib/controller/action_controller/permitted_params_definition.rb +60 -0
- data/lib/generators/shoulda_matchmakers/controller_matcher_generator.rb +87 -0
- data/lib/generators/shoulda_matchmakers/controller_matcher_generator_helper.rb +92 -0
- data/lib/generators/shoulda_matchmakers/factory_generator.rb +86 -0
- data/lib/generators/shoulda_matchmakers/install_generator.rb +10 -0
- data/lib/generators/shoulda_matchmakers/model_matcher_generator.rb +87 -0
- data/lib/generators/shoulda_matchmakers/model_matcher_generator_helper.rb +107 -0
- data/lib/model/active_record/active_record_model_sm_model.rb +50 -0
- data/lib/model/active_record/active_record_model_sm_model_helper.rb +206 -0
- data/lib/model/active_record/factory_sm_model.rb +28 -0
- data/lib/model/active_record/factory_sm_model_helper.rb +124 -0
- data/lib/model/active_record/matchmakers/accept_nested_attributes_for.rb +66 -0
- data/lib/model/active_record/matchmakers/allow_value.rb +137 -0
- data/lib/model/active_record/matchmakers/associations.rb +52 -0
- data/lib/model/active_record/matchmakers/define_enum_for.rb +53 -0
- data/lib/model/active_record/matchmakers/delegate_method.rb +101 -0
- data/lib/model/active_record/matchmakers/have_db_column.rb +33 -0
- data/lib/model/active_record/matchmakers/have_db_index.rb +39 -0
- data/lib/model/active_record/matchmakers/have_readonly_attribute.rb +32 -0
- data/lib/model/active_record/matchmakers/have_secure_password.rb +32 -0
- data/lib/model/active_record/matchmakers/serialize.rb +67 -0
- data/lib/model/active_record/matchmakers/validations.rb +169 -0
- data/lib/model/active_record/options_definition.rb +160 -0
- data/lib/shoulda_matchmakers.rb +48 -0
- data/lib/shoulda_matchmakers/version.rb +3 -0
- data/lib/support/command_line_interface.rb +100 -0
- data/lib/support/controller_generator.rb +198 -0
- data/lib/support/indefinite_article.rb +70 -0
- data/lib/support/to_discard/belong_to.rb +94 -0
- data/lib/support/to_discard/have_and_belong_to_many.rb +83 -0
- data/lib/support/to_discard/have_many.rb +96 -0
- data/lib/support/to_discard/have_one.rb +98 -0
- data/lib/support/to_discard/permit_refactor.rb +270 -0
- data/lib/support/to_discard/render_template_new.rb +204 -0
- data/lib/support/to_discard/render_template_reconstruction.rb +188 -0
- data/lib/support/to_discard/use_around_action.rb +20 -0
- data/lib/support/to_discard/use_before_action.rb +20 -0
- data/lib/support/to_discard/validate_absence_of.rb +16 -0
- data/lib/support/to_discard/validate_acceptance_of.rb +16 -0
- data/lib/support/to_discard/validate_confirmation_of.rb +16 -0
- data/lib/support/to_discard/validate_exclusion_of.rb +145 -0
- data/lib/support/to_discard/validate_inclusion_of.rb +94 -0
- data/lib/support/to_discard/validate_length_of.rb +16 -0
- data/lib/support/to_discard/validate_numericality_of.rb +16 -0
- data/lib/support/to_discard/validate_presence_of.rb +16 -0
- data/lib/support/to_discard/validate_uniqueness_of.rb +16 -0
- data/lib/support/to_discard/validation_old.rb +37 -0
- data/lib/support/to_discard/validations.rb +41 -0
- data/lib/support/to_discard/validations_conditional.rb +146 -0
- data/lib/support/trace_debug_lines.txt +319 -0
- data/lib/support/util.rb +15 -0
- data/lib/templates/controller/action_controller/controller_spec_template.haml +146 -0
- data/lib/templates/factory/active_record/factory_template.haml +13 -0
- data/lib/templates/model/active_record/model_spec_template.haml +233 -0
- data/lib/templates/shoulda_matchmakers.rb +112 -0
- metadata +263 -0
@@ -0,0 +1,319 @@
|
|
1
|
+
|
2
|
+
# # TRACE.debug ""
|
3
|
+
# # TRACE.debug "*** vendor/shoulda_matchmakers/lib/model/active_record/active_model_matchers/allow_value.rb (allow_value_matcher_tests)"
|
4
|
+
|
5
|
+
# # TRACE.debug " 1. generate_inclusion_array_matcher_tests - VALIDATOR:"
|
6
|
+
# # TRACE.debug JSON.neat_generate(validator,aligned:true,around_colon:1)
|
7
|
+
# # TRACE.debug " 2. generate_inclusion_array_matcher_tests - VALIDATOR ATTRIBUTES:"
|
8
|
+
# # TRACE.debug JSON.neat_generate(validator.attributes,aligned:true,around_colon:1)
|
9
|
+
# # TRACE.debug " 3. generate_inclusion_array_matcher_tests - VALIDATOR OPTIONS:"
|
10
|
+
# # TRACE.debug JSON.neat_generate(validator.options,aligned:true,around_colon:1)
|
11
|
+
# # TRACE.debug " 4. generate_inclusion_array_matcher_tests - INCLUSION ARRAY: " + inclusion_array.to_s
|
12
|
+
|
13
|
+
# # TRACE.debug " 5. generate_inclusion_array_matcher_tests - ATTRIBUTE: " + attribute.to_s
|
14
|
+
|
15
|
+
|
16
|
+
# # TRACE.debug " 6. allow_value_matcher_tests - FORMAT VALIDATOR TESTS AFTER ALLOWED:"
|
17
|
+
# # TRACE.debug JSON.neat_generate(tests,aligned:true,around_colon:1)
|
18
|
+
|
19
|
+
|
20
|
+
# # TRACE.debug ""
|
21
|
+
# # TRACE.debug "*** vendor/shoulda_matchmakers/lib/model/active_record/active_model_matchers/have_secure_password.rb (have_secure_password_matcher_tests)"
|
22
|
+
# # TRACE.debug " 1. have_secure_password_matcher_tests - CLASS: " + @active_record_model_sm_model.constantize.to_s
|
23
|
+
|
24
|
+
|
25
|
+
# # TRACE.debug ""
|
26
|
+
# # TRACE.debug "*** vendor/shoulda_matchmakers/lib/model/active_record/active_record_matchers/define_enum_for.rb (define_enum_for_matcher_tests)"
|
27
|
+
# # TRACE.debug " 1. define_enum_for_matcher_tests - DEFINED ENUMS:"
|
28
|
+
# # TRACE.debug JSON.neat_generate(@active_record_model_sm_model.constantize.defined_enums,aligned:true,around_colon:1)
|
29
|
+
|
30
|
+
# # TRACE.debug " 2. define_enum_for_matcher_tests - ENUM ATTRIBUTE: " + attribute.to_s
|
31
|
+
# # TRACE.debug " 3. define_enum_for_matcher_tests - ENUM VALUES HASH: " + values_hash.to_s
|
32
|
+
|
33
|
+
# # TRACE.debug " 4. define_enum_for_matcher_tests - ENUM VALUE NAME: " + name.to_s
|
34
|
+
# # TRACE.debug " 5. define_enum_for_matcher_tests - ENUM RESPECTIVE VALUE: " + value.to_s
|
35
|
+
|
36
|
+
# # TRACE.debug ""
|
37
|
+
# # TRACE.debug ""
|
38
|
+
# # TRACE.debug "ATTRIBUTE: " + attribute.to_s
|
39
|
+
# # TRACE.debug "CAST TYPE - INSPECT:"
|
40
|
+
# # TRACE.debug cast_type.inspect
|
41
|
+
#
|
42
|
+
# # TRACE.debug "OBJECT CLASS: " + object_class.to_s
|
43
|
+
#
|
44
|
+
# # TRACE.debug object_class.to_s.upcase + " - AS: " + object_class.to_s
|
45
|
+
#
|
46
|
+
# # TRACE.debug object_class.to_s.upcase + " - AS: " + object_class.to_s
|
47
|
+
#
|
48
|
+
# # TRACE.debug "YAML - AS: YAML"
|
49
|
+
#
|
50
|
+
# # TRACE.debug "JSON - AS: JSON"
|
51
|
+
#
|
52
|
+
# # TRACE.debug "CUSTOM - AS: " + object_class.inspect
|
53
|
+
|
54
|
+
# if @active_record_model_sm_model.constantize.to_s == "SuperAdminUser"
|
55
|
+
# # TRACE.debug ""
|
56
|
+
# # TRACE.debug ""
|
57
|
+
# # TRACE.debug ""
|
58
|
+
# # TRACE.debug "VALIDATOR:"
|
59
|
+
# # TRACE.debug validator.inspect
|
60
|
+
# end
|
61
|
+
validator.attributes.map do |attribute|
|
62
|
+
# if @active_record_model_sm_model.constantize.to_s == "SuperAdminUser"
|
63
|
+
# # TRACE.debug ""
|
64
|
+
# # TRACE.debug ""
|
65
|
+
# # TRACE.debug "ATTRIBUTE: " + attribute.to_s
|
66
|
+
# # TRACE.debug "VALIDATOR OPTIONS:"
|
67
|
+
# # TRACE.debug validator.options.inspect
|
68
|
+
# end
|
69
|
+
|
70
|
+
# if @active_record_model_sm_model.constantize.to_s == "SuperAdminUser"
|
71
|
+
# # TRACE.debug ""
|
72
|
+
# # TRACE.debug "OPTION: " + option.inspect
|
73
|
+
# # TRACE.debug "VALUE: " + option_value.to_s
|
74
|
+
# end
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
# # TRACE.debug ""
|
79
|
+
# # TRACE.debug "MODEL: " + @active_record_model_sm_model.to_s
|
80
|
+
# # TRACE.debug "MODEL - CONSTANTIZE: " + @active_record_model_sm_model.constantize.to_s
|
81
|
+
# # TRACE.debug "MODEL - TABLEIZE: " + @active_record_model_sm_model.tableize.to_s
|
82
|
+
# # TRACE.debug "INDEXES:"
|
83
|
+
|
84
|
+
# # TRACE.debug "INDEX - INSPECT"
|
85
|
+
# # TRACE.debug ndx.inspect
|
86
|
+
|
87
|
+
# # TRACE.debug "INDEX: :" + ndx.columns[0].to_s
|
88
|
+
|
89
|
+
# # TRACE.debug "INDEX: " + (ndx.columns.map { |c| c.to_sym }).to_s
|
90
|
+
# # TRACE.debug "INDEX: [:" + ndx.columns[0].to_s + ", :" + ndx.columns[1].to_s + "]"
|
91
|
+
|
92
|
+
# # TRACE.debug "IS UNIQUE: " + ndx.unique.to_s
|
93
|
+
|
94
|
+
# # TRACE.debug "TEST: " + db_index_test
|
95
|
+
|
96
|
+
# # TRACE.debug "MODEL - TABLEIZED: " + @active_record_model_sm_model.tableize.gsub("/", "_").to_s
|
97
|
+
|
98
|
+
# # TRACE.debug "MODEL TABLE: " + model_table.inspect
|
99
|
+
|
100
|
+
# # TRACE.debug "====> #{ table } <===="
|
101
|
+
|
102
|
+
# # TRACE.debug "----> indexed: " + ndx.inspect
|
103
|
+
# # TRACE.debug "----> indexed_columns: " + ndx.columns.inspect
|
104
|
+
# # TRACE.debug "----> index_unique: " + ndx.unique.to_s
|
105
|
+
# # TRACE.debug "----> #{ ndx.name }"
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
# # TRACE.debug ""
|
110
|
+
# # TRACE.debug "*** vendor/shoulda_matchmakers/lib/generators/shoulda_matchmakers/model_generator.rb (generate_ar_specs)"
|
111
|
+
# # TRACE.debug " 1. generate_ar_specs - MODELS:"
|
112
|
+
|
113
|
+
|
114
|
+
# # TRACE.debug " MODEL:"
|
115
|
+
# # TRACE.debug JSON.neat_generate(model.constantize,aligned:true,around_colon:1)
|
116
|
+
# # TRACE.debug " MODEL ATTRIBUTES:"
|
117
|
+
# # TRACE.debug JSON.neat_generate(model.constantize.attributes,aligned:true,around_colon:1)
|
118
|
+
# # TRACE.debug " MODEL HAS_ONE ASSOCIATIONS:"
|
119
|
+
# # TRACE.debug JSON.neat_generate(model.constantize.reflect_on_all_associations(:has_one),aligned:true,around_colon:1)
|
120
|
+
|
121
|
+
|
122
|
+
# # TRACE.debug " @active_record_model_sm_model MODEL:"
|
123
|
+
# # TRACE.debug JSON.neat_generate(@active_record_model_sm_model.model,aligned:true,around_colon:1)
|
124
|
+
# # TRACE.debug " @active_record_model_sm_model MODEL CONSTANTIZED:"
|
125
|
+
# # TRACE.debug JSON.neat_generate(@active_record_model_sm_model.model.constantize,aligned:true,around_colon:1)
|
126
|
+
|
127
|
+
|
128
|
+
# # TRACE.debug ""
|
129
|
+
# # TRACE.debug "*** vendor/shoulda_matchmakers/lib/model/active_record_model.rb (initialize)"
|
130
|
+
# # TRACE.debug " 1. initialize - MODEL:"
|
131
|
+
# # TRACE.debug JSON.neat_generate(model,aligned:true,around_colon:1)
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
# # TRACE.debug " FACTORY ATTRIBUTES WITH DEFAULTS:"
|
136
|
+
# # TRACE.debug factory_attributes.inspect
|
137
|
+
#
|
138
|
+
# # TRACE.debug " ATTRIBUTES WITH DEFAULTS:"
|
139
|
+
# # TRACE.debug attributes_with_defaults.inspect
|
140
|
+
#
|
141
|
+
# # TRACE.debug " ATTRIBUTE: " + attribute.to_s
|
142
|
+
#
|
143
|
+
# # TRACE.debug " INTERIM FACTORY ATTRIBUTES:"
|
144
|
+
# # TRACE.debug factory_attributes.inspect
|
145
|
+
#
|
146
|
+
# # TRACE.debug " FACTORY ATTRIBUTES WITHOUT DEFAULTS:"
|
147
|
+
# # TRACE.debug factory_attributes.inspect
|
148
|
+
|
149
|
+
|
150
|
+
# # TRACE.debug ""
|
151
|
+
# # TRACE.debug " MODEL: "
|
152
|
+
# # TRACE.debug " " + model.to_s
|
153
|
+
# # TRACE.debug ""
|
154
|
+
# # TRACE.debug " MODEL CONSTANTIZE: "
|
155
|
+
# # TRACE.debug " " + model.constantize.to_s
|
156
|
+
# # TRACE.debug ""
|
157
|
+
# # TRACE.debug " MODEL CONSTANTIZE INSPECT: "
|
158
|
+
# # TRACE.debug " " + model.constantize.inspect
|
159
|
+
# # TRACE.debug ""
|
160
|
+
# # TRACE.debug " MODEL COLUMNS: "
|
161
|
+
# # TRACE.debug " " + model.constantize.columns.inspect
|
162
|
+
# # TRACE.debug ""
|
163
|
+
# # TRACE.debug " MODEL COLUMN DEFAULTS: "
|
164
|
+
# # TRACE.debug " " + model.constantize.column_defaults.to_s
|
165
|
+
|
166
|
+
|
167
|
+
# # TRACE.debug ""
|
168
|
+
# # TRACE.debug " NON-NIL COLUMN DEFAULTS: "
|
169
|
+
# # TRACE.debug " " + non_nil_column_defaults.inspect
|
170
|
+
|
171
|
+
|
172
|
+
# # TRACE.debug ""
|
173
|
+
# # TRACE.debug " ALL REQUIRED ATTRIBUTES:"
|
174
|
+
# # TRACE.debug " " + required_attributes_trimmed.inspect
|
175
|
+
|
176
|
+
|
177
|
+
# # TRACE.debug " WITH ABSENCE ATTRIBUTES:"
|
178
|
+
# # TRACE.debug " " + validation_attributes.inspect
|
179
|
+
#
|
180
|
+
# # TRACE.debug " WITH ACCEPTANCE ATTRIBUTES:"
|
181
|
+
# # TRACE.debug " " + validation_attributes.inspect
|
182
|
+
#
|
183
|
+
# # TRACE.debug " WITH CONFIRMATION ATTRIBUTES:"
|
184
|
+
# # TRACE.debug " " + validation_attributes.inspect
|
185
|
+
#
|
186
|
+
# # TRACE.debug " WITH EXCLUSION ATTRIBUTES:"
|
187
|
+
# # TRACE.debug " " + validation_attributes.inspect
|
188
|
+
#
|
189
|
+
# # TRACE.debug " WITH INCLUSION ATTRIBUTES:"
|
190
|
+
# # TRACE.debug " " + validation_attributes.inspect
|
191
|
+
#
|
192
|
+
# # TRACE.debug " WITH LENGTH ATTRIBUTES:"
|
193
|
+
# # TRACE.debug " " + validation_attributes.inspect
|
194
|
+
#
|
195
|
+
# # TRACE.debug " WITH NUMERICALITY ATTRIBUTES:"
|
196
|
+
# # TRACE.debug " " + validation_attributes.inspect
|
197
|
+
#
|
198
|
+
# # TRACE.debug " WITH PRESENCE ATTRIBUTES:"
|
199
|
+
# # TRACE.debug " " + validation_attributes.inspect
|
200
|
+
#
|
201
|
+
# # TRACE.debug " WITH UNIQUENESS ATTRIBUTES:"
|
202
|
+
# # TRACE.debug " " + validation_attributes.inspect
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
#
|
207
|
+
# # TRACE.debug ""
|
208
|
+
# # TRACE.debug ""
|
209
|
+
# # TRACE.debug ""
|
210
|
+
# # TRACE.debug "MODEL: " + @active_record_model_sm_model.to_s
|
211
|
+
#
|
212
|
+
# # TRACE.debug ""
|
213
|
+
# # TRACE.debug " FACTORY ATTRIBUTES 1:"
|
214
|
+
# # TRACE.debug " " + attributes_for_factory.inspect
|
215
|
+
#
|
216
|
+
# # TRACE.debug ""
|
217
|
+
# # TRACE.debug " REQUIRED ATTRIBUTES:"
|
218
|
+
# # TRACE.debug " " + required_attributes.inspect
|
219
|
+
#
|
220
|
+
# # TRACE.debug ""
|
221
|
+
# # TRACE.debug " FACTORY ATTRIBUTES 2:"
|
222
|
+
# # TRACE.debug " " + attributes_for_factory.inspect
|
223
|
+
#
|
224
|
+
# # TRACE.debug ""
|
225
|
+
# # TRACE.debug " ATTRIBUTES WITH DEFAULTS:"
|
226
|
+
# # TRACE.debug " " + attributes_with_defaults.inspect
|
227
|
+
#
|
228
|
+
# # TRACE.debug ""
|
229
|
+
# # TRACE.debug " FACTORY ATTRIBUTES 3:"
|
230
|
+
# # TRACE.debug " " + attributes_for_factory.inspect
|
231
|
+
#
|
232
|
+
# # TRACE.debug ""
|
233
|
+
# # TRACE.debug " FACTORY ATTRIBUTES 4:"
|
234
|
+
# # TRACE.debug " " + attributes_for_factory.inspect
|
235
|
+
|
236
|
+
|
237
|
+
# # TRACE.debug ""
|
238
|
+
# # TRACE.debug ""
|
239
|
+
# # TRACE.debug " CONTROLLER:" + @action_controller_controller_sm_model.constantize.to_s
|
240
|
+
# # TRACE.debug ""
|
241
|
+
# # TRACE.debug " CONTROLLER METHODS:"
|
242
|
+
# # TRACE.debug " " + JSON.neat_generate(@action_controller_controller_sm_model.constantize.action_methods)
|
243
|
+
# if @action_controller_controller_sm_model.constantize.action_methods.include?("index")
|
244
|
+
# my_controller = @action_controller_controller_sm_model.constantize.new
|
245
|
+
# my_controller.index
|
246
|
+
# # TRACE.debug ""
|
247
|
+
# # TRACE.debug " CONTROLLER INSTANCE VARIABLES:"
|
248
|
+
# # TRACE.debug " " + JSON.neat_generate(my_controller.instance_variables.select { |iv| !iv.to_s.include?("@_") })
|
249
|
+
# end
|
250
|
+
|
251
|
+
|
252
|
+
# # TRACE.debug ""
|
253
|
+
# # TRACE.debug " APP VIEWS PATH: " + app_views_path.to_s
|
254
|
+
# # TRACE.debug " CONTROLLER: " + controller
|
255
|
+
#
|
256
|
+
# # TRACE.debug ""
|
257
|
+
# # TRACE.debug " CONTROLLER VIEWS PATH: " + controller_views_path.to_s
|
258
|
+
#
|
259
|
+
# # TRACE.debug ""
|
260
|
+
# # TRACE.debug " ERB FILE PATH: " + erb_file_path.to_s
|
261
|
+
#
|
262
|
+
# # TRACE.debug ""
|
263
|
+
# # TRACE.debug " ERB RENDER VIEW TYPE: " + render_view_type.to_s
|
264
|
+
# # TRACE.debug " ERB RENDER VIEW PATH: " + render_view_path.to_s
|
265
|
+
#
|
266
|
+
# # TRACE.debug ""
|
267
|
+
# # TRACE.debug " FINAL ERB RENDER VIEW TYPE: " + render_view_type.to_s
|
268
|
+
#
|
269
|
+
# # TRACE.debug ""
|
270
|
+
# # TRACE.debug " ERB VIEW ACTION RENDER OCCURRENCES:"
|
271
|
+
# # TRACE.debug JSON.neat_generate(view_action_render_occurrences)
|
272
|
+
#
|
273
|
+
# # TRACE.debug ""
|
274
|
+
# # TRACE.debug " ERB VIEW ACTION: " + view_action.inspect
|
275
|
+
#
|
276
|
+
# # TRACE.debug ""
|
277
|
+
# # TRACE.debug " ERB VIEW ACTION ROUTE:"
|
278
|
+
# # TRACE.debug JSON.neat_generate(view_action_route)
|
279
|
+
#
|
280
|
+
# # TRACE.debug ""
|
281
|
+
# # TRACE.debug " ERB VIEW ACTION HTTP METHOD: " + view_action_http_method.to_s
|
282
|
+
#
|
283
|
+
# # TRACE.debug ""
|
284
|
+
# # TRACE.debug " ERB RENDER TEMPLATE OCCURRENCES:"
|
285
|
+
# # TRACE.debug JSON.neat_generate(render_template_occurrences)
|
286
|
+
#
|
287
|
+
# # TRACE.debug ""
|
288
|
+
# # TRACE.debug " HAML FILE PATH: " + haml_file_path.to_s
|
289
|
+
#
|
290
|
+
# # TRACE.debug ""
|
291
|
+
# # TRACE.debug " HAML RENDER VIEW TYPE: " + render_view_type.to_s
|
292
|
+
# # TRACE.debug " HAML RENDER VIEW PATH: " + render_view_path.to_s
|
293
|
+
#
|
294
|
+
# # TRACE.debug ""
|
295
|
+
# # TRACE.debug " FINAL HAML RENDER VIEW TYPE: " + render_view_type.to_s
|
296
|
+
#
|
297
|
+
# # TRACE.debug ""
|
298
|
+
# # TRACE.debug " VIEW ACTION RENDER OCCURRENCES:"
|
299
|
+
# # TRACE.debug JSON.neat_generate(view_action_render_occurrences)
|
300
|
+
#
|
301
|
+
# # TRACE.debug ""
|
302
|
+
# # TRACE.debug " HAML VIEW ACTION: " + view_action.inspect
|
303
|
+
#
|
304
|
+
# # TRACE.debug ""
|
305
|
+
# # TRACE.debug " " + view_action + " IS AN ACTION OF CONTROLLER " + controller
|
306
|
+
#
|
307
|
+
# # TRACE.debug ""
|
308
|
+
# # TRACE.debug " ROUTE CONTROLLER: " + route_controller
|
309
|
+
#
|
310
|
+
# # TRACE.debug ""
|
311
|
+
# # TRACE.debug " HAML VIEW ACTION ROUTE:"
|
312
|
+
# # TRACE.debug view_action_route.inspect
|
313
|
+
#
|
314
|
+
# # TRACE.debug ""
|
315
|
+
# # TRACE.debug " HAML VIEW ACTION HTTP METHOD: " + view_action_http_method.to_s
|
316
|
+
#
|
317
|
+
# # TRACE.debug ""
|
318
|
+
# # TRACE.debug " HAML RENDER TEMPLATE OCCURRENCES:"
|
319
|
+
# # TRACE.debug JSON.neat_generate(render_template_occurrences)
|
data/lib/support/util.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module ShouldaMatchmakers
|
2
|
+
module Model
|
3
|
+
module ActiveRecord
|
4
|
+
module Util
|
5
|
+
|
6
|
+
def extract_validators(validator_type)
|
7
|
+
@active_record_model_sm_model.constantize.validators.select do |validator|
|
8
|
+
validator.class.to_s == validator_type.to_s
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
= "require 'rails_helper'"
|
2
|
+
= "\n"
|
3
|
+
= "RSpec.describe " + @action_controller_controller_sm_model.app_controller_name.to_s + ", type: :controller, shoulda_matchmakers: true do"
|
4
|
+
|
5
|
+
- use_before_action_matcher_tests = @action_controller_controller_sm_model.use_action_matcher_tests(:before)
|
6
|
+
- use_after_action_matcher_tests = @action_controller_controller_sm_model.use_action_matcher_tests(:after)
|
7
|
+
- use_around_action_matcher_tests = @action_controller_controller_sm_model.use_action_matcher_tests(:around)
|
8
|
+
|
9
|
+
- if use_before_action_matcher_tests.present? || use_after_action_matcher_tests.present? || |
|
10
|
+
use_around_action_matcher_tests.present? |
|
11
|
+
= "\n"
|
12
|
+
\# ------------------------------------------------------------------------------------------------
|
13
|
+
\# #### Callbacks
|
14
|
+
|
15
|
+
- if use_before_action_matcher_tests.present?
|
16
|
+
\#
|
17
|
+
\# ##### before
|
18
|
+
\#
|
19
|
+
= use_before_action_matcher_tests
|
20
|
+
= "\n"
|
21
|
+
|
22
|
+
- if use_after_action_matcher_tests.present?
|
23
|
+
\#
|
24
|
+
\# ##### after
|
25
|
+
\#
|
26
|
+
= use_after_action_matcher_tests
|
27
|
+
= "\n"
|
28
|
+
|
29
|
+
- if use_around_action_matcher_tests.present?
|
30
|
+
\#
|
31
|
+
\# ##### around
|
32
|
+
\#
|
33
|
+
= use_around_action_matcher_tests
|
34
|
+
= "\n"
|
35
|
+
|
36
|
+
- if @action_controller_controller_sm_model.app_controller_name.to_s == "ApplicationController"
|
37
|
+
- filter_param_matcher_tests = @action_controller_controller_sm_model.filter_param_matcher_tests
|
38
|
+
- else
|
39
|
+
- filter_param_matcher_tests = []
|
40
|
+
- permit_matcher_tests = @action_controller_controller_sm_model.permit_matcher_tests
|
41
|
+
|
42
|
+
- if filter_param_matcher_tests.present? || permit_matcher_tests.present?
|
43
|
+
= "\n"
|
44
|
+
\# ------------------------------------------------------------------------------------------------
|
45
|
+
\# #### Parameters
|
46
|
+
|
47
|
+
- if filter_param_matcher_tests.present?
|
48
|
+
\#
|
49
|
+
\# ##### filter_param
|
50
|
+
\#
|
51
|
+
= filter_param_matcher_tests
|
52
|
+
= "\n"
|
53
|
+
|
54
|
+
- if permit_matcher_tests.present?
|
55
|
+
\#
|
56
|
+
\# ##### permit
|
57
|
+
\#
|
58
|
+
= permit_matcher_tests
|
59
|
+
= "\n"
|
60
|
+
|
61
|
+
|
62
|
+
- route_matcher_tests = @action_controller_controller_sm_model.route_matcher_tests
|
63
|
+
|
64
|
+
- if route_matcher_tests.present?
|
65
|
+
= "\n"
|
66
|
+
\# ------------------------------------------------------------------------------------------------
|
67
|
+
\# #### Routes
|
68
|
+
\#
|
69
|
+
\# ##### route
|
70
|
+
\#
|
71
|
+
= route_matcher_tests
|
72
|
+
= "\n"
|
73
|
+
|
74
|
+
|
75
|
+
- redirect_to_matcher_tests = @action_controller_controller_sm_model.redirect_to_matcher_tests
|
76
|
+
- render_template_matcher_tests = @action_controller_controller_sm_model.render_template_matcher_tests
|
77
|
+
- render_with_layout_matcher_tests = @action_controller_controller_sm_model.render_with_layout_matcher_tests
|
78
|
+
- rescue_from_matcher_tests = @action_controller_controller_sm_model.rescue_from_matcher_tests
|
79
|
+
- respond_with_matcher_tests = @action_controller_controller_sm_model.respond_with_matcher_tests
|
80
|
+
|
81
|
+
- if redirect_to_matcher_tests.present? || render_template_matcher_tests.present? || |
|
82
|
+
render_with_layout_matcher_tests.present? || rescue_from_matcher_tests.present? || |
|
83
|
+
respond_with_matcher_tests.present? |
|
84
|
+
|
85
|
+
= "\n"
|
86
|
+
\# ------------------------------------------------------------------------------------------------
|
87
|
+
\# #### Redirect/Render/Rescue/Respond
|
88
|
+
|
89
|
+
- if redirect_to_matcher_tests.present?
|
90
|
+
\#
|
91
|
+
\# ##### redirect_to
|
92
|
+
\#
|
93
|
+
= redirect_to_matcher_tests
|
94
|
+
= "\n"
|
95
|
+
|
96
|
+
- if render_template_matcher_tests.present?
|
97
|
+
\#
|
98
|
+
\# ##### render_template
|
99
|
+
\#
|
100
|
+
= render_template_matcher_tests
|
101
|
+
= "\n"
|
102
|
+
|
103
|
+
- if render_with_layout_matcher_tests.present?
|
104
|
+
\#
|
105
|
+
\# ##### render_with_layout
|
106
|
+
\#
|
107
|
+
= render_with_layout_matcher_tests
|
108
|
+
= "\n"
|
109
|
+
|
110
|
+
- if rescue_from_matcher_tests.present?
|
111
|
+
\#
|
112
|
+
\# ##### rescue_from
|
113
|
+
\#
|
114
|
+
= rescue_from_matcher_tests
|
115
|
+
= "\n"
|
116
|
+
|
117
|
+
- if respond_with_matcher_tests.present?
|
118
|
+
\#
|
119
|
+
\# ##### respond_with
|
120
|
+
\#
|
121
|
+
= respond_with_matcher_tests
|
122
|
+
= "\n"
|
123
|
+
|
124
|
+
- set_flash_matcher_tests = @action_controller_controller_sm_model.set_flash_matcher_tests
|
125
|
+
- set_session_matcher_tests = @action_controller_controller_sm_model.set_session_matcher_tests
|
126
|
+
|
127
|
+
- if set_flash_matcher_tests.present? || set_session_matcher_tests.present?
|
128
|
+
= "\n"
|
129
|
+
\# ------------------------------------------------------------------------------------------------
|
130
|
+
\# #### Set
|
131
|
+
|
132
|
+
- if set_flash_matcher_tests.present?
|
133
|
+
\#
|
134
|
+
\# ##### set_flash
|
135
|
+
\#
|
136
|
+
= set_flash_matcher_tests
|
137
|
+
= "\n"
|
138
|
+
|
139
|
+
- if set_session_matcher_tests.present?
|
140
|
+
\#
|
141
|
+
\# ##### set_session
|
142
|
+
\#
|
143
|
+
= set_session_matcher_tests
|
144
|
+
= "\n"
|
145
|
+
|
146
|
+
= "end"
|