rails_admin 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. data/Gemfile +18 -20
  2. data/README.md +8 -1
  3. data/app/assets/javascripts/rails_admin/ra.widgets.coffee +5 -4
  4. data/app/assets/stylesheets/rails_admin/base/theming.css.scss +4 -4
  5. data/app/controllers/rails_admin/main_controller.rb +11 -2
  6. data/app/helpers/rails_admin/application_helper.rb +1 -1
  7. data/app/helpers/rails_admin/form_builder.rb +3 -3
  8. data/app/views/rails_admin/main/_form_filtering_multiselect.html.haml +4 -4
  9. data/app/views/rails_admin/main/_form_filtering_select.html.haml +2 -2
  10. data/app/views/rails_admin/main/_form_nested_one.html.haml +1 -1
  11. data/app/views/rails_admin/main/_form_text.html.haml +2 -1
  12. data/app/views/rails_admin/main/export.html.haml +2 -2
  13. data/app/views/rails_admin/main/index.html.haml +5 -5
  14. data/app/views/rails_admin/main/show.html.haml +1 -1
  15. data/lib/generators/rails_admin/templates/initializer.erb +5 -5
  16. data/lib/rails_admin/abstract_model.rb +1 -0
  17. data/lib/rails_admin/config.rb +1 -1
  18. data/lib/rails_admin/config/actions/base.rb +1 -1
  19. data/lib/rails_admin/config/actions/edit.rb +5 -4
  20. data/lib/rails_admin/config/actions/new.rb +5 -4
  21. data/lib/rails_admin/config/fields/association.rb +10 -10
  22. data/lib/rails_admin/config/fields/base.rb +10 -4
  23. data/lib/rails_admin/config/fields/types/belongs_to_association.rb +2 -2
  24. data/lib/rails_admin/config/fields/types/boolean.rb +4 -4
  25. data/lib/rails_admin/config/fields/types/bson_object_id.rb +4 -4
  26. data/lib/rails_admin/config/fields/types/carrierwave.rb +3 -3
  27. data/lib/rails_admin/config/fields/types/datetime.rb +5 -5
  28. data/lib/rails_admin/config/fields/types/enum.rb +5 -5
  29. data/lib/rails_admin/config/fields/types/file_upload.rb +10 -6
  30. data/lib/rails_admin/config/fields/types/has_many_association.rb +1 -1
  31. data/lib/rails_admin/config/fields/types/has_one_association.rb +3 -3
  32. data/lib/rails_admin/config/fields/types/integer.rb +1 -1
  33. data/lib/rails_admin/config/fields/types/paperclip.rb +2 -2
  34. data/lib/rails_admin/config/fields/types/polymorphic_association.rb +8 -4
  35. data/lib/rails_admin/config/fields/types/serialized.rb +2 -2
  36. data/lib/rails_admin/config/fields/types/string.rb +3 -3
  37. data/lib/rails_admin/config/fields/types/text.rb +22 -15
  38. data/lib/rails_admin/config/fields/types/time.rb +1 -1
  39. data/lib/rails_admin/config/hideable.rb +1 -1
  40. data/lib/rails_admin/config/model.rb +4 -0
  41. data/lib/rails_admin/config/sections/modal.rb +1 -1
  42. data/lib/rails_admin/engine.rb +1 -1
  43. data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +2 -1
  44. data/lib/rails_admin/support/csv_converter.rb +1 -1
  45. data/lib/rails_admin/version.rb +2 -2
  46. data/lib/rails_admin/version.rbc +582 -0
  47. data/lib/tasks/rails_admin.rake +2 -2
  48. data/spec/controllers/main_controller_spec.rb +113 -45
  49. data/spec/dummy_app/Gemfile +11 -25
  50. data/spec/dummy_app/Gemfile.lock +214 -0
  51. data/spec/dummy_app/app/active_record/comment.rb +1 -1
  52. data/spec/dummy_app/app/active_record/field_test.rb +0 -1
  53. data/spec/dummy_app/config/initializers/strong_parameters.rb +2 -0
  54. data/spec/dummy_app/db/test.sqlite3 +0 -0
  55. data/spec/dummy_app/log/test.log +97612 -0
  56. data/spec/helpers/application_helper_spec.rb +24 -24
  57. data/spec/helpers/form_builder_spec.rb +4 -4
  58. data/spec/integration/authorization/cancan_spec.rb +3 -3
  59. data/spec/integration/basic/bulk_action/rails_admin_basic_bulk_action_spec.rb +2 -2
  60. data/spec/integration/basic/bulk_destroy/rails_admin_basic_bulk_destroy_spec.rb +2 -2
  61. data/spec/integration/basic/create/rails_admin_basic_create_spec.rb +9 -9
  62. data/spec/integration/basic/create/rails_admin_namespaced_model_create_spec.rb +1 -1
  63. data/spec/integration/basic/delete/rails_admin_basic_delete_spec.rb +4 -4
  64. data/spec/integration/basic/destroy/rails_admin_basic_destroy_spec.rb +9 -9
  65. data/spec/integration/basic/edit/rails_admin_basic_edit_spec.rb +10 -10
  66. data/spec/integration/basic/export/rails_admin_basic_export_spec.rb +5 -5
  67. data/spec/integration/basic/list/rails_admin_basic_list_spec.rb +32 -25
  68. data/spec/integration/basic/new/rails_admin_basic_new_spec.rb +8 -8
  69. data/spec/integration/basic/new/rails_admin_namespaced_model_new_spec.rb +3 -3
  70. data/spec/integration/basic/show/rails_admin_basic_show_spec.rb +6 -6
  71. data/spec/integration/basic/update/rails_admin_basic_update_spec.rb +13 -13
  72. data/spec/integration/config/edit/rails_admin_config_edit_spec.rb +97 -76
  73. data/spec/integration/config/list/rails_admin_config_list_spec.rb +32 -32
  74. data/spec/integration/config/show/rails_admin_config_show_spec.rb +23 -23
  75. data/spec/integration/history/rails_admin_history_spec.rb +6 -6
  76. data/spec/integration/rails_admin_spec.rb +17 -17
  77. data/spec/integration/relation_spec.rb +7 -7
  78. data/spec/unit/abstract_model_spec.rb +11 -5
  79. data/spec/unit/active_record_extension_spec.rb +2 -2
  80. data/spec/unit/adapters/active_record/abstract_object_spec.rb +8 -8
  81. data/spec/unit/adapters/active_record_spec.rb +6 -6
  82. data/spec/unit/adapters/mongoid/abstract_object_spec.rb +1 -1
  83. data/spec/unit/adapters/mongoid_spec.rb +12 -12
  84. data/spec/unit/config/actions/base_spec.rb +2 -2
  85. data/spec/unit/config/actions_spec.rb +16 -16
  86. data/spec/unit/config/fields/base_spec.rb +61 -49
  87. data/spec/unit/config/fields/date_spec.rb +4 -4
  88. data/spec/unit/config/fields/datetime_spec.rb +4 -4
  89. data/spec/unit/config/fields/file_upload_spec.rb +21 -0
  90. data/spec/unit/config/fields/time_spec.rb +3 -3
  91. data/spec/unit/config/fields/timestamp_spec.rb +1 -1
  92. data/spec/unit/config/model_spec.rb +10 -10
  93. data/spec/unit/config/sections_spec.rb +4 -4
  94. data/spec/unit/config_spec.rb +9 -9
  95. metadata +17 -218
@@ -8,7 +8,7 @@ describe "RailsAdmin Config DSL Edit Section" do
8
8
 
9
9
  describe " a field with 'format' as a name (Kernel function)" do
10
10
 
11
- it "should be updatable without any error" do
11
+ it "is updatable without any error" do
12
12
  RailsAdmin.config FieldTest do
13
13
  edit do
14
14
  field :format
@@ -24,7 +24,7 @@ describe "RailsAdmin Config DSL Edit Section" do
24
24
 
25
25
  describe "default_value" do
26
26
 
27
- it "should be set for all types of input fields" do
27
+ it "is set for all types of input fields" do
28
28
  RailsAdmin.config do |config|
29
29
  config.excluded_models = []
30
30
  config.model(FieldTest) do
@@ -55,7 +55,7 @@ describe "RailsAdmin Config DSL Edit Section" do
55
55
  expect(has_checked_field?('field_test[boolean_field]')).to be_true
56
56
  end
57
57
 
58
- it "should set default value for selects" do
58
+ it "sets default value for selects" do
59
59
  RailsAdmin.config(Team) do
60
60
  field :color, :enum do
61
61
  default_value 'black'
@@ -72,7 +72,7 @@ describe "RailsAdmin Config DSL Edit Section" do
72
72
  describe "attr_accessible" do
73
73
 
74
74
 
75
- it "should be configurable in the controller scope" do
75
+ it "is configurable in the controller scope" do
76
76
 
77
77
  RailsAdmin.config do |config|
78
78
  config.excluded_models = []
@@ -101,7 +101,7 @@ describe "RailsAdmin Config DSL Edit Section" do
101
101
  end
102
102
 
103
103
  describe "css hooks" do
104
- it "should be present" do
104
+ it "is present" do
105
105
  visit new_path(:model_name => "team")
106
106
  should have_selector("#team_division_id_field.belongs_to_association_type.division_field")
107
107
  end
@@ -109,7 +109,7 @@ describe "RailsAdmin Config DSL Edit Section" do
109
109
 
110
110
  describe "field groupings" do
111
111
 
112
- it "should be hideable" do
112
+ it "is hideable" do
113
113
  RailsAdmin.config Team do
114
114
  edit do
115
115
  group :default do
@@ -135,7 +135,7 @@ describe "RailsAdmin Config DSL Edit Section" do
135
135
  should have_no_selector("input#team_revenue")
136
136
  end
137
137
 
138
- it "should hide association groupings" do
138
+ it "hides association groupings" do
139
139
  RailsAdmin.config Team do
140
140
  edit do
141
141
  group :players do
@@ -152,7 +152,7 @@ describe "RailsAdmin Config DSL Edit Section" do
152
152
  should have_no_selector("select#team_player_ids")
153
153
  end
154
154
 
155
- it "should be renameable" do
155
+ it "is renameable" do
156
156
  RailsAdmin.config Team do
157
157
  edit do
158
158
  group :default do
@@ -180,24 +180,24 @@ describe "RailsAdmin Config DSL Edit Section" do
180
180
  end
181
181
 
182
182
  context "using mongoid", :skip_active_record => true do
183
- it "should use the db column size for the maximum length" do
183
+ it "uses the db column size for the maximum length" do
184
184
  visit new_path(:model_name => "help_test")
185
185
  expect(find("#help_test_name_field .help-block")).to have_content("Length up to 255.")
186
186
  end
187
187
 
188
- it "should return nil for the maximum length" do
188
+ it "returns nil for the maximum length" do
189
189
  visit new_path(:model_name => "team")
190
190
  expect(find("#team_custom_field_field .help-block")).not_to have_content("Length")
191
191
  end
192
192
  end
193
193
 
194
194
  context "using active_record", :skip_mongoid => true do
195
- it "should use the db column size for the maximum length" do
195
+ it "uses the db column size for the maximum length" do
196
196
  visit new_path(:model_name => "help_test")
197
197
  expect(find("#help_test_name_field .help-block")).to have_content("Length up to 50.")
198
198
  end
199
199
 
200
- it "should use the :minimum setting from the validation" do
200
+ it "uses the :minimum setting from the validation" do
201
201
  HelpTest.class_eval do
202
202
  validates_length_of :name, :minimum => 1
203
203
  end
@@ -205,7 +205,7 @@ describe "RailsAdmin Config DSL Edit Section" do
205
205
  expect(find("#help_test_name_field .help-block")).to have_content("Length of 1-50.")
206
206
  end
207
207
 
208
- it "should use the minimum of db column size or :maximum setting from the validation" do
208
+ it "uses the minimum of db column size or :maximum setting from the validation" do
209
209
  HelpTest.class_eval do
210
210
  validates_length_of :name, :maximum => 51
211
211
  end
@@ -214,7 +214,7 @@ describe "RailsAdmin Config DSL Edit Section" do
214
214
  end
215
215
  end
216
216
 
217
- it "should show help section if present" do
217
+ it "shows help section if present" do
218
218
  RailsAdmin.config HelpTest do
219
219
  edit do
220
220
  group :default do
@@ -226,7 +226,7 @@ describe "RailsAdmin Config DSL Edit Section" do
226
226
  should have_selector('fieldset>p', :text => "help paragraph to display")
227
227
  end
228
228
 
229
- it "should not show help if not present" do
229
+ it "does not show help if not present" do
230
230
  RailsAdmin.config HelpTest do
231
231
  edit do
232
232
  group :default do
@@ -238,7 +238,7 @@ describe "RailsAdmin Config DSL Edit Section" do
238
238
  should_not have_selector('fieldset>p')
239
239
  end
240
240
 
241
- it "should be able to display multiple help if there are multiple sections" do
241
+ it "is able to display multiple help if there are multiple sections" do
242
242
  RailsAdmin.config HelpTest do
243
243
  edit do
244
244
  group :default do
@@ -258,7 +258,7 @@ describe "RailsAdmin Config DSL Edit Section" do
258
258
  should have_selector("fieldset>p", :count => 2)
259
259
  end
260
260
 
261
- it "should use the :is setting from the validation" do
261
+ it "uses the :is setting from the validation" do
262
262
  HelpTest.class_eval do
263
263
  validates_length_of :name, :is => 3
264
264
  end
@@ -266,7 +266,7 @@ describe "RailsAdmin Config DSL Edit Section" do
266
266
  expect(find("#help_test_name_field .help-block")).to have_content("Length of 3.")
267
267
  end
268
268
 
269
- it "should use the :maximum setting from the validation" do
269
+ it "uses the :maximum setting from the validation" do
270
270
  HelpTest.class_eval do
271
271
  validates_length_of :name, :maximum => 49
272
272
  end
@@ -274,7 +274,7 @@ describe "RailsAdmin Config DSL Edit Section" do
274
274
  expect(find("#help_test_name_field .help-block")).to have_content("Length up to 49.")
275
275
  end
276
276
 
277
- it "should use the :minimum and :maximum from the validation" do
277
+ it "uses the :minimum and :maximum from the validation" do
278
278
  HelpTest.class_eval do
279
279
  validates_length_of :name, :minimum => 1, :maximum => 49
280
280
  end
@@ -282,7 +282,7 @@ describe "RailsAdmin Config DSL Edit Section" do
282
282
  expect(find("#help_test_name_field .help-block")).to have_content("Length of 1-49.")
283
283
  end
284
284
 
285
- it "should use the range from the validation" do
285
+ it "uses the range from the validation" do
286
286
  HelpTest.class_eval do
287
287
  validates_length_of :name, :in => 1..49
288
288
  end
@@ -292,7 +292,7 @@ describe "RailsAdmin Config DSL Edit Section" do
292
292
 
293
293
  end
294
294
 
295
- it "should have accessor for its fields" do
295
+ it "has accessor for its fields" do
296
296
  RailsAdmin.config Team do
297
297
  edit do
298
298
  group :default do
@@ -322,7 +322,7 @@ describe "RailsAdmin Config DSL Edit Section" do
322
322
  should have_selector(".control-group", :count => 4)
323
323
  end
324
324
 
325
- it "should have accessor for its fields by type" do
325
+ it "has accessor for its fields by type" do
326
326
  RailsAdmin.config Team do
327
327
  edit do
328
328
  group :default do
@@ -350,7 +350,7 @@ describe "RailsAdmin Config DSL Edit Section" do
350
350
 
351
351
  describe "items' fields" do
352
352
 
353
- it "should show all by default" do
353
+ it "shows all by default" do
354
354
  visit new_path(:model_name => "team")
355
355
  should have_selector("select#team_division_id")
356
356
  should have_selector("input#team_name")
@@ -367,7 +367,7 @@ describe "RailsAdmin Config DSL Edit Section" do
367
367
  should have_selector("select#team_fan_ids")
368
368
  end
369
369
 
370
- it "should appear in order defined" do
370
+ it "appears in order defined" do
371
371
  RailsAdmin.config Team do
372
372
  edit do
373
373
  field :manager
@@ -381,7 +381,7 @@ describe "RailsAdmin Config DSL Edit Section" do
381
381
  should have_selector(:xpath, "//*[contains(@class, 'field')][3]//*[@id='team_name']")
382
382
  end
383
383
 
384
- it "should only show the defined fields if some fields are defined" do
384
+ it "only shows the defined fields if some fields are defined" do
385
385
  RailsAdmin.config Team do
386
386
  edit do
387
387
  field :division
@@ -394,24 +394,29 @@ describe "RailsAdmin Config DSL Edit Section" do
394
394
  should have_selector(".control-group", :count => 2)
395
395
  end
396
396
 
397
- it "should delegates the label option to the ActiveModel API and memoize I18n awarly" do
398
- RailsAdmin.config Team do
399
- edit do
400
- field :manager
401
- field :fans
397
+ describe "I18n awarly" do
398
+ after :each do
399
+ I18n.locale = :en
400
+ end
401
+
402
+ it "delegates the label option to the ActiveModel API and memoizes it" do
403
+ RailsAdmin.config Team do
404
+ edit do
405
+ field :manager
406
+ field :fans
407
+ end
402
408
  end
409
+ visit new_path(:model_name => "team")
410
+ should have_selector("label", :text => "Team Manager")
411
+ should have_selector("label", :text => "Some Fans")
412
+ I18n.locale = :fr
413
+ visit new_path(:model_name => "team")
414
+ should have_selector("label", :text => "Manager de l'équipe")
415
+ should have_selector("label", :text => "Quelques fans")
403
416
  end
404
- visit new_path(:model_name => "team")
405
- should have_selector("label", :text => "Team Manager")
406
- should have_selector("label", :text => "Some Fans")
407
- I18n.locale = :fr
408
- visit new_path(:model_name => "team")
409
- should have_selector("label", :text => "Manager de l'équipe")
410
- should have_selector("label", :text => "Quelques fans")
411
- I18n.locale = :en
412
417
  end
413
418
 
414
- it "should be renameable" do
419
+ it "is renameable" do
415
420
  RailsAdmin.config Team do
416
421
  edit do
417
422
  field :manager do
@@ -427,7 +432,7 @@ describe "RailsAdmin Config DSL Edit Section" do
427
432
  should have_selector("label", :text => "Name")
428
433
  end
429
434
 
430
- it "should be renameable by type" do
435
+ it "is renameable by type" do
431
436
  RailsAdmin.config Team do
432
437
  edit do
433
438
  fields_of_type :string do
@@ -451,8 +456,8 @@ describe "RailsAdmin Config DSL Edit Section" do
451
456
  should have_selector("label", :text => "Fans")
452
457
  end
453
458
 
454
- it "should be globally renameable by type" do
455
- RailsAdmin.config 'Team' do
459
+ it "is globally renameable by type" do
460
+ RailsAdmin.config Team do
456
461
  edit do
457
462
  fields_of_type :string do
458
463
  label { "#{label} (STRING)" }
@@ -475,7 +480,7 @@ describe "RailsAdmin Config DSL Edit Section" do
475
480
  should have_selector("label", :text => "Fans")
476
481
  end
477
482
 
478
- it "should be flaggable as read only and be configurable with formatted_value" do
483
+ it "is flaggable as read only and be configurable with formatted_value" do
479
484
  RailsAdmin.config Team do
480
485
  edit do
481
486
  field :name do
@@ -490,7 +495,7 @@ describe "RailsAdmin Config DSL Edit Section" do
490
495
  should have_content("I'm outputed in the form")
491
496
  end
492
497
 
493
- it "should be hideable" do
498
+ it "is hideable" do
494
499
  RailsAdmin.config Team do
495
500
  edit do
496
501
  field :manager do
@@ -506,7 +511,7 @@ describe "RailsAdmin Config DSL Edit Section" do
506
511
  should have_selector("#team_name")
507
512
  end
508
513
 
509
- it "should be hideable by type" do
514
+ it "is hideable by type" do
510
515
  RailsAdmin.config Team do
511
516
  edit do
512
517
  fields_of_type :string do
@@ -530,8 +535,8 @@ describe "RailsAdmin Config DSL Edit Section" do
530
535
  should have_selector("label", :text => "Fans")
531
536
  end
532
537
 
533
- it "should be globally hideable by type" do
534
- RailsAdmin.config 'Team' do
538
+ it "is globally hideable by type" do
539
+ RailsAdmin.config Team do
535
540
  edit do
536
541
  fields_of_type :string do
537
542
  hide
@@ -554,7 +559,7 @@ describe "RailsAdmin Config DSL Edit Section" do
554
559
  should have_selector("label", :text => "Fans")
555
560
  end
556
561
 
557
- it "should have option to customize the help text" do
562
+ it "has option to customize the help text" do
558
563
  RailsAdmin.config Team do
559
564
  edit do
560
565
  field :manager do
@@ -570,7 +575,7 @@ describe "RailsAdmin Config DSL Edit Section" do
570
575
  expect(find("#team_name_field .help-block")).not_to have_content("Additional help text")
571
576
  end
572
577
 
573
- it "should have option to override required status" do
578
+ it "has option to override required status" do
574
579
  RailsAdmin.config Team do
575
580
  edit do
576
581
  field :manager do
@@ -591,8 +596,8 @@ describe "RailsAdmin Config DSL Edit Section" do
591
596
  end
592
597
  end
593
598
 
594
- describe 'bindings' do
595
- it 'should be present at creation time' do
599
+ describe "bindings" do
600
+ it "is present at creation time" do
596
601
  RailsAdmin.config do |config|
597
602
  config.excluded_models = []
598
603
  end
@@ -614,8 +619,8 @@ describe "RailsAdmin Config DSL Edit Section" do
614
619
  end
615
620
  end
616
621
 
617
- describe 'nested form' do
618
- it 'should work' do
622
+ describe "nested form" do
623
+ it "works" do
619
624
  @record = FactoryGirl.create :field_test
620
625
  @record.nested_field_tests = [NestedFieldTest.create!(:title => 'title 1'), NestedFieldTest.create!(:title => 'title 2')]
621
626
  visit edit_path(:model_name => "field_test", :id => @record.id)
@@ -629,7 +634,7 @@ describe "RailsAdmin Config DSL Edit Section" do
629
634
  expect(@record.nested_field_tests[0].title).to eq('nested field test title 1 edited')
630
635
  end
631
636
 
632
- it 'should set bindings[:object] to nested object' do
637
+ it "sets bindings[:object] to nested object" do
633
638
  RailsAdmin.config(NestedFieldTest) do
634
639
  nested do
635
640
  field :title do
@@ -645,7 +650,7 @@ describe "RailsAdmin Config DSL Edit Section" do
645
650
  expect(find('#field_test_nested_field_tests_attributes_0_title_field')).to have_content('NestedFieldTest')
646
651
  end
647
652
 
648
- it 'should be desactivable' do
653
+ it "is desactivable" do
649
654
  visit new_path(:model_name => "field_test")
650
655
  should have_selector('#field_test_nested_field_tests_attributes_field .add_nested_fields')
651
656
  RailsAdmin.config(FieldTest) do
@@ -663,7 +668,7 @@ describe "RailsAdmin Config DSL Edit Section" do
663
668
  and_return({:allow_destroy=>true, :update_only=>false})
664
669
  end
665
670
 
666
- it 'should not show add button when :update_only is true' do
671
+ it "does not show add button when :update_only is true" do
667
672
  FieldTest.nested_attributes_options.stub(:[]).with(:nested_field_tests).
668
673
  and_return({:allow_destroy=>true, :update_only=>true})
669
674
  visit new_path(:model_name => "field_test")
@@ -671,7 +676,7 @@ describe "RailsAdmin Config DSL Edit Section" do
671
676
  should_not have_selector('#field_test_nested_field_tests_attributes_field .add_nested_fields')
672
677
  end
673
678
 
674
- it 'should not show destroy button except for newly created when :allow_destroy is false' do
679
+ it "does not show destroy button except for newly created when :allow_destroy is false" do
675
680
  @record = FieldTest.create
676
681
  @record.nested_field_tests << NestedFieldTest.create!(:title => 'nested title 1')
677
682
  FieldTest.nested_attributes_options.stub(:[]).with(:nested_field_tests).
@@ -684,7 +689,7 @@ describe "RailsAdmin Config DSL Edit Section" do
684
689
  end
685
690
 
686
691
  describe "when a field which have the same name of nested_in field's" do
687
- it "should not hide fields which is not associated with nesting parent field's model" do
692
+ it "does not hide fields which is not associated with nesting parent field's model" do
688
693
  visit new_path(:model_name => "field_test")
689
694
  should_not have_selector('select#field_test_nested_field_tests_attributes_new_nested_field_tests_field_test_id')
690
695
  should have_selector('select#field_test_nested_field_tests_attributes_new_nested_field_tests_another_field_test_id')
@@ -692,8 +697,8 @@ describe "RailsAdmin Config DSL Edit Section" do
692
697
  end
693
698
  end
694
699
 
695
- describe 'embedded model', :mongoid => true do
696
- it 'should work' do
700
+ describe "embedded model", :mongoid => true do
701
+ it "works" do
697
702
  @record = FactoryGirl.create :field_test
698
703
  2.times.each{|i| @record.embeds.create :name => "embed #{i}"}
699
704
  visit edit_path(:model_name => "field_test", :id => @record.id)
@@ -709,7 +714,7 @@ describe "RailsAdmin Config DSL Edit Section" do
709
714
 
710
715
  describe "fields which are nullable and have AR validations", :active_record => true do
711
716
 
712
- it "should be required" do
717
+ it "is required" do
713
718
  # draft.notes is nullable and has no validation
714
719
  field = RailsAdmin::config("Draft").edit.fields.find{|f| f.name == :notes}
715
720
  expect(field.properties[:nullable?]).to be_true
@@ -737,12 +742,12 @@ describe "RailsAdmin Config DSL Edit Section" do
737
742
 
738
743
  describe "CKEditor Support" do
739
744
 
740
- it "should start with CKEditor disabled" do
745
+ it "starts with CKEditor disabled" do
741
746
  field = RailsAdmin::config("Draft").edit.fields.find{|f| f.name == :notes}
742
747
  expect(field.ckeditor).to be_false
743
748
  end
744
749
 
745
- it "should add Javascript to enable CKEditor" do
750
+ it "adds Javascript to enable CKEditor" do
746
751
  RailsAdmin.config Draft do
747
752
  edit do
748
753
  field :notes do
@@ -757,12 +762,12 @@ describe "RailsAdmin Config DSL Edit Section" do
757
762
 
758
763
  describe "CodeMirror Support" do
759
764
 
760
- it "should start with CodeMirror disabled" do
765
+ it "starts with CodeMirror disabled" do
761
766
  field = RailsAdmin::config("Draft").edit.fields.find{|f| f.name == :notes}
762
767
  expect(field.codemirror).to be_false
763
768
  end
764
769
 
765
- it "should add Javascript to enable CodeMirror" do
770
+ it "adds Javascript to enable CodeMirror" do
766
771
  RailsAdmin.config Draft do
767
772
  edit do
768
773
  field :notes do
@@ -777,12 +782,12 @@ describe "RailsAdmin Config DSL Edit Section" do
777
782
 
778
783
  describe "bootstrap_wysihtml5 Support" do
779
784
 
780
- it "should start with bootstrap_wysihtml5 disabled" do
785
+ it "starts with bootstrap_wysihtml5 disabled" do
781
786
  field = RailsAdmin::config("Draft").edit.fields.find{|f| f.name == :notes}
782
787
  expect(field.bootstrap_wysihtml5).to be_false
783
788
  end
784
789
 
785
- it "should add Javascript to enable bootstrap_wysihtml5" do
790
+ it "adds Javascript to enable bootstrap_wysihtml5" do
786
791
  RailsAdmin.config Draft do
787
792
  edit do
788
793
  field :notes do
@@ -793,11 +798,27 @@ describe "RailsAdmin Config DSL Edit Section" do
793
798
  visit new_path(:model_name => "draft")
794
799
  should have_selector('textarea#draft_notes[data-richtext="bootstrap-wysihtml5"]')
795
800
  end
801
+
802
+ it "should include custom wysihtml5 configuration" do
803
+ RailsAdmin.config Draft do
804
+ edit do
805
+ field :notes do
806
+ bootstrap_wysihtml5 true
807
+ bootstrap_wysihtml5_config_options :image => false
808
+ bootstrap_wysihtml5_css_location 'stub_css.css'
809
+ bootstrap_wysihtml5_js_location 'stub_js.js'
810
+ end
811
+ end
812
+ end
813
+
814
+ visit new_path(:model_name => "draft")
815
+ should have_selector("textarea#draft_notes[data-richtext=\"bootstrap-wysihtml5\"][data-options]")
816
+ end
796
817
  end
797
818
 
798
819
  describe "Paperclip Support" do
799
820
 
800
- it "should show a file upload field" do
821
+ it "shows a file upload field" do
801
822
  RailsAdmin.config User do
802
823
  edit do
803
824
  field :avatar
@@ -828,7 +849,7 @@ describe "RailsAdmin Config DSL Edit Section" do
828
849
  Team.send(:remove_method, :color_enum)
829
850
  end
830
851
 
831
- it "should auto-detect enumeration" do
852
+ it "auto-detects enumeration" do
832
853
  should have_selector(".enum_type select")
833
854
  should_not have_selector(".enum_type select[multiple]")
834
855
  should have_content("green")
@@ -854,7 +875,7 @@ describe "RailsAdmin Config DSL Edit Section" do
854
875
  Team.instance_eval { undef :color_enum }
855
876
  end
856
877
 
857
- it "should auto-detect enumeration" do
878
+ it "auto-detects enumeration" do
858
879
  should have_selector(".enum_type select")
859
880
  should have_content("green")
860
881
  end
@@ -881,7 +902,7 @@ describe "RailsAdmin Config DSL Edit Section" do
881
902
  Team.send(:remove_method, :color_list)
882
903
  end
883
904
 
884
- it "should allow configuration" do
905
+ it "allows configuration" do
885
906
  should have_selector(".enum_type select")
886
907
  should have_content("green")
887
908
  end
@@ -908,7 +929,7 @@ describe "RailsAdmin Config DSL Edit Section" do
908
929
  Team.instance_eval { undef :color_list }
909
930
  end
910
931
 
911
- it "should allow configuration" do
932
+ it "allows configuration" do
912
933
  should have_selector(".enum_type select")
913
934
  should have_content("green")
914
935
  end
@@ -938,7 +959,7 @@ describe "RailsAdmin Config DSL Edit Section" do
938
959
  Team.send(:remove_method, :color_list)
939
960
  end
940
961
 
941
- it "should allow direct listing of enumeration options and override enum method" do
962
+ it "allows direct listing of enumeration options and override enum method" do
942
963
  should have_selector(".enum_type select")
943
964
  should have_no_content("green")
944
965
  should have_content("yellow")
@@ -961,7 +982,7 @@ describe "RailsAdmin Config DSL Edit Section" do
961
982
  Team.instance_eval { undef :color_enum }
962
983
  end
963
984
 
964
- it "should make enumeration multi-selectable" do
985
+ it "makes enumeration multi-selectable" do
965
986
  should have_selector(".enum_type select[multiple]")
966
987
  end
967
988
  end
@@ -984,14 +1005,14 @@ describe "RailsAdmin Config DSL Edit Section" do
984
1005
  end
985
1006
  end
986
1007
 
987
- it "should make enumeration multi-selectable" do
1008
+ it "makes enumeration multi-selectable" do
988
1009
  should have_selector(".enum_type select[multiple]")
989
1010
  end
990
1011
  end
991
1012
  end
992
1013
 
993
1014
  describe "ColorPicker Support" do
994
- it "should show input with class color" do
1015
+ it "shows input with class color" do
995
1016
  RailsAdmin.config Team do
996
1017
  edit do
997
1018
  field :color, :color