easy_admin_ui 0.5.9 → 0.5.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/VERSION +1 -1
  2. data/{vendor/plugins/make_resourceful/init.rb → config/initializers/make_resourceful.rb} +0 -0
  3. data/easy_admin_ui.gemspec +14 -60
  4. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/base.rb +0 -0
  5. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/builder.rb +0 -0
  6. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/default/accessors.rb +0 -0
  7. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/default/actions.rb +0 -0
  8. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/default/callbacks.rb +0 -0
  9. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/default/responses.rb +0 -0
  10. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/default/urls.rb +0 -0
  11. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/maker.rb +0 -0
  12. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/response.rb +0 -0
  13. data/{vendor/plugins/make_resourceful/lib → lib}/resourceful/serialize.rb +0 -0
  14. metadata +17 -63
  15. data/vendor/plugins/make_resourceful/.gitignore +0 -1
  16. data/vendor/plugins/make_resourceful/DEFAULTS +0 -148
  17. data/vendor/plugins/make_resourceful/LICENSE +0 -7
  18. data/vendor/plugins/make_resourceful/README.rdoc +0 -239
  19. data/vendor/plugins/make_resourceful/Rakefile +0 -31
  20. data/vendor/plugins/make_resourceful/VERSION +0 -1
  21. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/resourceful_scaffold_generator.rb +0 -87
  22. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/controller.rb +0 -5
  23. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/fixtures.yml +0 -10
  24. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/functional_test.rb +0 -50
  25. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/helper.rb +0 -2
  26. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/migration.rb +0 -13
  27. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/model.rb +0 -2
  28. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/unit_test.rb +0 -7
  29. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view__form.haml +0 -5
  30. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_edit.haml +0 -11
  31. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_index.haml +0 -5
  32. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_new.haml +0 -9
  33. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_partial.haml +0 -12
  34. data/vendor/plugins/make_resourceful/generators/resourceful_scaffold/templates/view_show.haml +0 -14
  35. data/vendor/plugins/make_resourceful/spec/accessors_spec.rb +0 -474
  36. data/vendor/plugins/make_resourceful/spec/actions_spec.rb +0 -310
  37. data/vendor/plugins/make_resourceful/spec/base_spec.rb +0 -12
  38. data/vendor/plugins/make_resourceful/spec/builder_spec.rb +0 -332
  39. data/vendor/plugins/make_resourceful/spec/callbacks_spec.rb +0 -71
  40. data/vendor/plugins/make_resourceful/spec/integration_spec.rb +0 -394
  41. data/vendor/plugins/make_resourceful/spec/maker_spec.rb +0 -91
  42. data/vendor/plugins/make_resourceful/spec/response_spec.rb +0 -37
  43. data/vendor/plugins/make_resourceful/spec/responses_spec.rb +0 -314
  44. data/vendor/plugins/make_resourceful/spec/rspec-rails/LICENSE +0 -37
  45. data/vendor/plugins/make_resourceful/spec/rspec-rails/redirect_to.rb +0 -113
  46. data/vendor/plugins/make_resourceful/spec/rspec-rails/render_template.rb +0 -90
  47. data/vendor/plugins/make_resourceful/spec/serialize_spec.rb +0 -133
  48. data/vendor/plugins/make_resourceful/spec/spec_helper.rb +0 -319
  49. data/vendor/plugins/make_resourceful/spec/urls_spec.rb +0 -282
  50. data/vendor/plugins/make_resourceful/spec/views/things/create.rjs +0 -1
  51. data/vendor/plugins/make_resourceful/spec/views/things/destroy.rjs +0 -1
  52. data/vendor/plugins/make_resourceful/spec/views/things/edit.html.erb +0 -4
  53. data/vendor/plugins/make_resourceful/spec/views/things/edit.rjs +0 -1
  54. data/vendor/plugins/make_resourceful/spec/views/things/index.html.erb +0 -4
  55. data/vendor/plugins/make_resourceful/spec/views/things/index.rjs +0 -1
  56. data/vendor/plugins/make_resourceful/spec/views/things/new.html.erb +0 -4
  57. data/vendor/plugins/make_resourceful/spec/views/things/new.rjs +0 -1
  58. data/vendor/plugins/make_resourceful/spec/views/things/show.html.erb +0 -4
  59. data/vendor/plugins/make_resourceful/spec/views/things/show.rjs +0 -1
  60. data/vendor/plugins/make_resourceful/spec/views/things/update.rjs +0 -1
@@ -1,71 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
2
-
3
- describe Resourceful::Default::Callbacks, " with a few callbacks" do
4
- include ControllerMocks
5
- before :each do
6
- mock_controller Resourceful::Default::Callbacks
7
- end
8
-
9
- it "should fire the :before callback with the given name when #before is called" do
10
- callbacks[:before] = { :create => [ should_be_called ] }
11
- @controller.before(:create)
12
- end
13
-
14
- it "should fire the :after callback with the given name when #after is called" do
15
- callbacks[:after] = { :index => [ should_be_called ] }
16
- @controller.after("index")
17
- end
18
- end
19
-
20
- describe Resourceful::Default::Callbacks, " with a few responses" do
21
- include ControllerMocks
22
- before :each do
23
- mock_controller Resourceful::Default::Callbacks
24
- responses[:create_failed] = [[:html, nil], [:js, nil]]
25
- responses[:create] = [[:html, proc { "create html" }], [:xml, proc { @xml }]]
26
- @controller.instance_variable_set('@xml', 'create XML')
27
- @response = Resourceful::Response.new
28
- end
29
-
30
- it "should respond to each format with a call to the given block when #response_for is called" do
31
- @controller.expects(:respond_to).yields(@response)
32
- @controller.response_for(:create_failed)
33
- @response.formats[0][0].should == :html
34
- @response.formats[0][1].call.should be_nil
35
-
36
- @response.formats[1][0].should == :js
37
- @response.formats[1][1].call.should be_nil
38
- end
39
-
40
- it "should properly scope blocks when #response_for is called" do
41
- @controller.expects(:respond_to).yields(@response)
42
- @controller.response_for(:create)
43
- @response.formats[0][0].should == :html
44
- @response.formats[0][1].call.should == "create html"
45
-
46
- @response.formats[1][0].should == :xml
47
-
48
- # This value comes from the instance variable in @controller.
49
- # Having it be "create XML" ensures that the block was properly scoped.
50
- @response.formats[1][1].call.should == "create XML"
51
- end
52
- end
53
-
54
- describe Resourceful::Default::Callbacks, "#scope" do
55
- include ControllerMocks
56
- before(:each) { mock_controller Resourceful::Default::Callbacks }
57
-
58
- it "should re-bind the block to the controller's context" do
59
- block = proc { @var }
60
- @controller.instance_variable_set('@var', 'value')
61
-
62
- block.call.should == nil
63
- @controller.scope(block).call.should == 'value'
64
- end
65
-
66
- it "should make the block empty if it's passed in as nil" do
67
- @controller.scope(nil).call.should == nil
68
- end
69
- end
70
-
71
-
@@ -1,394 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
2
-
3
- describe "ThingsController", "with all the resourceful actions" do
4
-
5
- before :each do
6
- mock_resourceful do
7
- actions :all
8
- end
9
- @objects = stub_list(5, 'Thing') do |t|
10
- [:destroy, :save, :update_attributes].each { |m| t.stubs(m).returns(true) }
11
- t.stubs(:to_param).returns('12')
12
- end
13
- @object = @objects.first
14
- Thing.stubs(:find).returns(@object)
15
- Thing.stubs(:new).returns(@object)
16
- end
17
-
18
- ## Default responses
19
-
20
- (Resourceful::ACTIONS - Resourceful::MODIFYING_ACTIONS).each(&method(:should_render_html))
21
- Resourceful::ACTIONS.each(&method(:should_render_js))
22
- Resourceful::ACTIONS.each(&method(:shouldnt_render_xml))
23
-
24
- ## Specs for #index
25
-
26
- it "should find all records on GET /things" do
27
- Thing.expects(:find).with(:all).returns(@objects)
28
- get :index
29
- end
30
-
31
- it "should return a list of objects for #current_objects after GET /things" do
32
- Thing.stubs(:find).returns(@objects)
33
- get :index
34
- current_objects.should == @objects
35
- end
36
-
37
- it "should assign @things to a list of objects for GET /things" do
38
- Thing.stubs(:find).returns(@objects)
39
- get :index
40
- assigns(:things).should == @objects
41
- end
42
-
43
- ## Specs for #show
44
-
45
- it "should find the record with id 12 on GET /things/12" do
46
- Thing.expects(:find).with('12').returns(@object)
47
- get :show, :id => 12
48
- end
49
-
50
- it "should return an object for #current_object after GET /things/12" do
51
- Thing.stubs(:find).returns(@object)
52
- get :show, :id => 12
53
- current_object.should == @object
54
- end
55
-
56
- it "should assign @thing to an object for GET /things/12" do
57
- Thing.stubs(:find).returns(@object)
58
- get :show, :id => 12
59
- assigns(:thing).should == @object
60
- end
61
-
62
- ## Specs for #edit
63
-
64
- it "should find the record with id 12 on GET /things/12/edit" do
65
- Thing.expects(:find).with('12').returns(@object)
66
- get :edit, :id => 12
67
- end
68
-
69
- it "should return an object for #current_object after GET /things/12/edit" do
70
- Thing.stubs(:find).returns(@object)
71
- get :edit, :id => 12
72
- current_object.should == @object
73
- end
74
-
75
- it "should assign @thing to an object for GET /things/12/edit" do
76
- Thing.stubs(:find).returns(@object)
77
- get :edit, :id => 12
78
- assigns(:thing).should == @object
79
- end
80
-
81
- ## Specs for #new
82
-
83
- it "should create a new object from params[:thing] for GET /things/new" do
84
- Thing.expects(:new).with('name' => "Herbert the thing").returns(@object)
85
- get :new, :thing => {:name => "Herbert the thing"}
86
- end
87
-
88
- it "should create a new object even if there aren't any params for GET /things/new" do
89
- Thing.expects(:new).with(nil).returns(@object)
90
- get :new
91
- end
92
-
93
- it "should return the new object for #current_object after GET /things/new" do
94
- Thing.stubs(:new).returns(@object)
95
- get :new
96
- current_object.should == @object
97
- end
98
-
99
- it "should assign @thing to the new object for GET /things/new" do
100
- Thing.stubs(:new).returns(@object)
101
- get :new
102
- assigns(:thing).should == @object
103
- end
104
-
105
- ## Specs for #create
106
-
107
- it "should create a new object from params[:thing] for POST /things" do
108
- Thing.expects(:new).with('name' => "Herbert the thing").returns(@object)
109
- post :create, :thing => {:name => "Herbert the thing"}
110
- end
111
-
112
- it "should create a new object even if there aren't any params for POST /things" do
113
- Thing.expects(:new).with(nil).returns(@object)
114
- post :create
115
- end
116
-
117
- it "should return the new object for #current_object after POST /things" do
118
- Thing.stubs(:new).returns(@object)
119
- post :create
120
- current_object.should == @object
121
- end
122
-
123
- it "should assign @thing to the new object for POST /things" do
124
- Thing.stubs(:new).returns(@object)
125
- post :create
126
- assigns(:thing).should == @object
127
- end
128
-
129
- it "should save the new object for POST /things" do
130
- Thing.stubs(:new).returns(@object)
131
- @object.expects(:save)
132
- post :create
133
- end
134
-
135
- it "should set an appropriate flash notice for a successful POST /things" do
136
- Thing.stubs(:new).returns(@object)
137
- post :create
138
- flash[:notice].should == "Create successful!"
139
- end
140
-
141
- it "should redirect to the new object for a successful POST /things" do
142
- Thing.stubs(:new).returns(@object)
143
- post :create
144
- response.should redirect_to('/things/12')
145
- end
146
-
147
- it "should set an appropriate flash error for an unsuccessful POST /things" do
148
- Thing.stubs(:new).returns(@object)
149
- @object.stubs(:save).returns(false)
150
- post :create
151
- flash[:error].should == "There was a problem!"
152
- end
153
-
154
- it "should give a failing response for an unsuccessful POST /things" do
155
- Thing.stubs(:new).returns(@object)
156
- @object.stubs(:save).returns(false)
157
- post :create
158
- response.should_not be_success
159
- response.code.should == '422'
160
- end
161
-
162
- it "should render the #new template for an unsuccessful POST /things" do
163
- Thing.stubs(:new).returns(@object)
164
- @object.stubs(:save).returns(false)
165
- post :create
166
- response.body.should include('New object')
167
- end
168
-
169
- ## Specs for #update
170
-
171
- it "should find the record with id 12 on PUT /things/12" do
172
- Thing.expects(:find).with('12').returns(@object)
173
- put :update, :id => 12
174
- end
175
-
176
- it "should return an object for #current_object after PUT /things/12" do
177
- Thing.stubs(:find).returns(@object)
178
- put :update, :id => 12
179
- current_object.should == @object
180
- end
181
-
182
- it "should assign @thing to an object for PUT /things/12" do
183
- Thing.stubs(:find).returns(@object)
184
- put :update, :id => 12
185
- assigns(:thing).should == @object
186
- end
187
-
188
- it "should update the new object for PUT /things/12" do
189
- Thing.stubs(:find).returns(@object)
190
- @object.expects(:update_attributes).with('name' => "Jorje")
191
- put :update, :id => 12, :thing => {:name => "Jorje"}
192
- end
193
-
194
- it "should set an appropriate flash notice for a successful PUT /things/12" do
195
- Thing.stubs(:find).returns(@object)
196
- put :update, :id => 12
197
- flash[:notice].should == "Save successful!"
198
- end
199
-
200
- it "should redirect to the updated object for a successful PUT /things/12" do
201
- Thing.stubs(:find).returns(@object)
202
- put :update, :id => 12
203
- response.should redirect_to('/things/12')
204
- end
205
-
206
- it "should set an appropriate flash error for an unsuccessful PUT /things/12" do
207
- Thing.stubs(:find).returns(@object)
208
- @object.stubs(:update_attributes).returns(false)
209
- put :update, :id => 12
210
- flash[:error].should == "There was a problem saving!"
211
- end
212
-
213
- it "should give a failing response for an unsuccessful PUT /things/12" do
214
- Thing.stubs(:find).returns(@object)
215
- @object.stubs(:update_attributes).returns(false)
216
- put :update, :id => 12
217
- response.should_not be_success
218
- response.code.should == '422'
219
- end
220
-
221
- it "should render the #edit template for an unsuccessful PUT /things/12" do
222
- Thing.stubs(:find).returns(@object)
223
- @object.stubs(:update_attributes).returns(false)
224
- put :update, :id => 12
225
- response.body.should include('Editting object')
226
- end
227
-
228
- ## Specs for #destroy
229
-
230
- it "should find the record with id 12 on DELETE /things/12" do
231
- Thing.expects(:find).with('12').returns(@object)
232
- delete :destroy, :id => 12
233
- end
234
-
235
- it "should return an object for #current_object after DELETE /things/12" do
236
- Thing.stubs(:find).returns(@object)
237
- delete :destroy, :id => 12
238
- current_object.should == @object
239
- end
240
-
241
- it "should assign @thing to an object for DELETE /things/12" do
242
- Thing.stubs(:find).returns(@object)
243
- delete :destroy, :id => 12
244
- assigns(:thing).should == @object
245
- end
246
-
247
- it "should destroy the new object for DELETE /things/12" do
248
- Thing.stubs(:find).returns(@object)
249
- @object.expects(:destroy)
250
- delete :destroy, :id => 12
251
- end
252
-
253
- it "should set an appropriate flash notice for a successful DELETE /things/12" do
254
- Thing.stubs(:find).returns(@object)
255
- delete :destroy, :id => 12
256
- flash[:notice].should == "Record deleted!"
257
- end
258
-
259
- it "should redirect to the object list for a successful DELETE /things/12" do
260
- Thing.stubs(:find).returns(@object)
261
- delete :destroy, :id => 12
262
- response.should redirect_to('/things')
263
- end
264
-
265
- it "should set an appropriate flash error for an unsuccessful DELETE /things/12" do
266
- Thing.stubs(:find).returns(@object)
267
- @object.stubs(:destroy).returns(false)
268
- delete :destroy, :id => 12
269
- flash[:error].should == "There was a problem deleting!"
270
- end
271
-
272
- it "should give a failing response for an unsuccessful DELETE /things/12" do
273
- Thing.stubs(:find).returns(@object)
274
- @object.stubs(:destroy).returns(false)
275
- delete :destroy, :id => 12
276
- response.should_not be_success
277
- end
278
-
279
- it "should redirect to the previous page for an unsuccessful DELETE /things/12" do
280
- Thing.stubs(:find).returns(@object)
281
- @object.stubs(:destroy).returns(false)
282
- delete :destroy, :id => 12
283
- response.should redirect_to(:back)
284
- end
285
- end
286
-
287
- describe "ThingsController", "with several parent objects", :type => :integration do
288
- before :each do
289
- mock_resourceful do
290
- actions :all
291
- belongs_to :person, :category
292
- end
293
- stub_const 'Person'
294
- stub_const 'Category'
295
-
296
- @objects = stub_list(5, 'Thing') do |t|
297
- t.stubs(:save).returns(true)
298
- end
299
- @object = @objects.first
300
- @person = stub('Person')
301
- @category = stub('Category')
302
- @fake_model = stub('parent_object.things')
303
- end
304
-
305
- ## No parent ids
306
-
307
- it "should find all things on GET /things" do
308
- Thing.expects(:find).with(:all).returns(@objects)
309
- get :index
310
- current_objects.should == @objects
311
- end
312
-
313
- it "should find the thing with id 12 regardless of scoping on GET /things/12" do
314
- Thing.expects(:find).with('12').returns(@object)
315
- get :show, :id => 12
316
- current_object.should == @object
317
- end
318
-
319
- it "should create a new thing without a person on POST /things" do
320
- Thing.expects(:new).with('name' => "Lamp").returns(@object)
321
- post :create, :thing => {:name => "Lamp"}
322
- current_object.should == @object
323
- end
324
-
325
- ## Person ids
326
-
327
- it "should assign the proper parent variables and accessors to the person with id 4 for GET /people/4/things" do
328
- Person.stubs(:find).returns(@person)
329
- @person.stubs(:things).returns(@fake_model)
330
- @fake_model.stubs(:find).with(:all).returns(@objects)
331
- get :index, :person_id => 4
332
- controller.instance_eval("parent_object").should == @person
333
- assigns(:person).should == @person
334
- end
335
-
336
- it "should find all the things belonging to the person with id 4 on GET /people/4/things" do
337
- Person.expects(:find).with('4').returns(@person)
338
- @person.expects(:things).at_least_once.returns(@fake_model)
339
- @fake_model.expects(:find).with(:all).returns(@objects)
340
- get :index, :person_id => 4
341
- current_objects.should == @objects
342
- end
343
-
344
- it "should find the thing with id 12 if it belongs to the person with id 4 on GET /person/4/things/12" do
345
- Person.expects(:find).with('4').returns(@person)
346
- @person.expects(:things).at_least_once.returns(@fake_model)
347
- @fake_model.expects(:find).with('12').returns(@object)
348
- get :show, :person_id => 4, :id => 12
349
- current_object.should == @object
350
- end
351
-
352
- it "should create a new thing belonging to the person with id 4 on POST /person/4/things" do
353
- Person.expects(:find).with('4').returns(@person)
354
- @person.expects(:things).at_least_once.returns(@fake_model)
355
- @fake_model.expects(:build).with('name' => 'Lamp').returns(@object)
356
- post :create, :person_id => 4, :thing => {:name => "Lamp"}
357
- current_object.should == @object
358
- end
359
-
360
- ## Category ids
361
-
362
- it "should assign the proper parent variables and accessors to the category with id 4 for GET /people/4/things" do
363
- Category.stubs(:find).returns(@category)
364
- @category.stubs(:things).returns(@fake_model)
365
- @fake_model.stubs(:find).with(:all).returns(@objects)
366
- get :index, :category_id => 4
367
- controller.instance_eval("parent_object").should == @category
368
- assigns(:category).should == @category
369
- end
370
-
371
- it "should find all the things belonging to the category with id 4 on GET /people/4/things" do
372
- Category.expects(:find).with('4').returns(@category)
373
- @category.expects(:things).at_least_once.returns(@fake_model)
374
- @fake_model.expects(:find).with(:all).returns(@objects)
375
- get :index, :category_id => 4
376
- current_objects.should == @objects
377
- end
378
-
379
- it "should find the thing with id 12 if it belongs to the category with id 4 on GET /category/4/things/12" do
380
- Category.expects(:find).with('4').returns(@category)
381
- @category.expects(:things).at_least_once.returns(@fake_model)
382
- @fake_model.expects(:find).with('12').returns(@object)
383
- get :show, :category_id => 4, :id => 12
384
- current_object.should == @object
385
- end
386
-
387
- it "should create a new thing belonging to the category with id 4 on POST /category/4/things" do
388
- Category.expects(:find).with('4').returns(@category)
389
- @category.expects(:things).at_least_once.returns(@fake_model)
390
- @fake_model.expects(:build).with('name' => 'Lamp').returns(@object)
391
- post :create, :category_id => 4, :thing => {:name => "Lamp"}
392
- current_object.should == @object
393
- end
394
- end