rails_admin 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails_admin might be problematic. Click here for more details.

Files changed (55) hide show
  1. data/README.md +8 -57
  2. data/app/assets/stylesheets/rails_admin/base/{README → README.txt} +1 -1
  3. data/app/assets/stylesheets/rails_admin/imports.css.scss.erb +4 -2
  4. data/app/assets/stylesheets/rails_admin/themes/cerulean/theming.css.scss +2 -2
  5. data/app/helpers/rails_admin/application_helper.rb +22 -28
  6. data/app/views/rails_admin/main/_form_filtering_multiselect.html.haml +1 -1
  7. data/app/views/rails_admin/main/_form_filtering_select.html.haml +1 -1
  8. data/lib/generators/rails_admin/install_generator.rb +4 -3
  9. data/lib/rails_admin/adapters/mongoid.rb +2 -1
  10. data/lib/rails_admin/engine.rb +1 -0
  11. data/lib/rails_admin/version.rb +1 -1
  12. data/spec/controllers/application_controller_spec.rb +4 -4
  13. data/spec/controllers/main_controller_spec.rb +26 -26
  14. data/spec/dummy_app/config/routes.rb +1 -1
  15. data/spec/dummy_app/db/test.sqlite3 +0 -0
  16. data/spec/dummy_app/log/test.log +161818 -0
  17. data/spec/helpers/application_helper_spec.rb +46 -46
  18. data/spec/helpers/form_builder_spec.rb +2 -2
  19. data/spec/integration/authorization/cancan_spec.rb +22 -22
  20. data/spec/integration/basic/bulk_destroy/rails_admin_basic_bulk_destroy_spec.rb +6 -6
  21. data/spec/integration/basic/create/rails_admin_basic_create_spec.rb +16 -16
  22. data/spec/integration/basic/delete/rails_admin_basic_delete_spec.rb +1 -1
  23. data/spec/integration/basic/destroy/rails_admin_basic_destroy_spec.rb +6 -6
  24. data/spec/integration/basic/edit/rails_admin_basic_edit_spec.rb +8 -8
  25. data/spec/integration/basic/export/rails_admin_basic_export_spec.rb +10 -10
  26. data/spec/integration/basic/list/rails_admin_basic_list_spec.rb +16 -16
  27. data/spec/integration/basic/new/rails_admin_basic_new_spec.rb +3 -3
  28. data/spec/integration/basic/new/rails_admin_namespaced_model_new_spec.rb +2 -2
  29. data/spec/integration/basic/show/rails_admin_basic_show_spec.rb +1 -2
  30. data/spec/integration/basic/update/rails_admin_basic_update_spec.rb +27 -27
  31. data/spec/integration/config/edit/rails_admin_config_edit_spec.rb +45 -45
  32. data/spec/integration/config/list/rails_admin_config_list_spec.rb +35 -38
  33. data/spec/integration/config/show/rails_admin_config_show_spec.rb +2 -2
  34. data/spec/integration/history/rails_admin_history_spec.rb +9 -9
  35. data/spec/integration/rails_admin_spec.rb +4 -4
  36. data/spec/integration/relation_spec.rb +3 -3
  37. data/spec/spec_helper.rb +3 -1
  38. data/spec/unit/abstract_model_spec.rb +10 -10
  39. data/spec/unit/active_record_extension_spec.rb +1 -1
  40. data/spec/unit/adapters/active_record/abstract_object_spec.rb +24 -24
  41. data/spec/unit/adapters/active_record_spec.rb +131 -132
  42. data/spec/unit/adapters/mongoid/abstract_object_spec.rb +5 -5
  43. data/spec/unit/adapters/mongoid_spec.rb +180 -180
  44. data/spec/unit/config/actions/base_spec.rb +6 -6
  45. data/spec/unit/config/actions_spec.rb +31 -32
  46. data/spec/unit/config/fields/base_spec.rb +69 -70
  47. data/spec/unit/config/fields/date_spec.rb +5 -5
  48. data/spec/unit/config/fields/datetime_spec.rb +4 -4
  49. data/spec/unit/config/fields/time_spec.rb +3 -3
  50. data/spec/unit/config/fields/timestamp_spec.rb +1 -1
  51. data/spec/unit/config/model_spec.rb +12 -12
  52. data/spec/unit/config/sections_spec.rb +17 -17
  53. data/spec/unit/config_spec.rb +23 -24
  54. data/spec/unit/support/csv_converter_spec.rb +2 -2
  55. metadata +19 -3
@@ -23,7 +23,7 @@ describe "RailsAdmin Basic Delete" do
23
23
  end
24
24
 
25
25
  it "should raise NotFound" do
26
- page.driver.status_code.should eql(404)
26
+ expect(page.driver.status_code).to eq(404)
27
27
  end
28
28
  end
29
29
 
@@ -13,7 +13,7 @@ describe "RailsAdmin Basic Destroy" do
13
13
  end
14
14
 
15
15
  it "should destroy an object" do
16
- @player.should be_nil
16
+ expect(@player).to be_nil
17
17
  end
18
18
 
19
19
  it "should show success message" do
@@ -30,7 +30,7 @@ describe "RailsAdmin Basic Destroy" do
30
30
  end
31
31
 
32
32
  it "should not destroy an object" do
33
- @player.reload.should be
33
+ expect(@player.reload).to be
34
34
  end
35
35
 
36
36
  it "should show error message" do
@@ -47,7 +47,7 @@ describe "RailsAdmin Basic Destroy" do
47
47
  end
48
48
 
49
49
  it "should not destroy an object" do
50
- @player.should be
50
+ expect(@player).to be
51
51
  end
52
52
  end
53
53
 
@@ -57,7 +57,7 @@ describe "RailsAdmin Basic Destroy" do
57
57
  end
58
58
 
59
59
  it "should raise NotFound" do
60
- page.driver.status_code.should eql(404)
60
+ expect(page.driver.status_code).to eq(404)
61
61
  end
62
62
  end
63
63
 
@@ -68,7 +68,7 @@ describe "RailsAdmin Basic Destroy" do
68
68
  visit delete_path(:model_name => "player", :id => @player.id)
69
69
  click_button "Yes, I'm sure"
70
70
 
71
- URI.parse(page.current_url).path.should ==(index_path(:model_name => 'player'))
71
+ expect(URI.parse(page.current_url).path).to eq(index_path(:model_name => 'player'))
72
72
  end
73
73
 
74
74
  it 'should redirect back to the object on error' do
@@ -78,7 +78,7 @@ describe "RailsAdmin Basic Destroy" do
78
78
  visit delete_path(:model_name => "player", :id => @player.id)
79
79
  click_button "Yes, I'm sure"
80
80
 
81
- URI.parse(page.current_url).path.should ==(show_path(:model_name => 'player', :id => @player.id))
81
+ expect(URI.parse(page.current_url).path).to eq(show_path(:model_name => 'player', :id => @player.id))
82
82
  end
83
83
  end
84
84
  end
@@ -20,9 +20,9 @@ describe "RailsAdmin Basic Edit" do
20
20
  end
21
21
 
22
22
  it "should show non-required fields as \"Optional\"" do
23
- find("#player_position_field .help-block").should have_content("Optional")
24
- find("#player_born_on_field .help-block").should have_content("Optional")
25
- find("#player_notes_field .help-block").should have_content("Optional")
23
+ expect(find("#player_position_field .help-block")).to have_content("Optional")
24
+ expect(find("#player_born_on_field .help-block")).to have_content("Optional")
25
+ expect(find("#player_notes_field .help-block")).to have_content("Optional")
26
26
  end
27
27
  end
28
28
 
@@ -59,9 +59,9 @@ describe "RailsAdmin Basic Edit" do
59
59
 
60
60
  it "should show associated objects" do
61
61
  should have_selector "#fan_team_ids" do |select|
62
- select[0].should have_selector 'option[selected="selected"]'
63
- select[1].should_not have_selector 'option[selected="selected"]'
64
- select[2].should_not have_selector 'option[selected="selected"]'
62
+ expect(select[0]).to have_selector 'option[selected="selected"]'
63
+ expect(select[1]).not_to have_selector 'option[selected="selected"]'
64
+ expect(select[2]).not_to have_selector 'option[selected="selected"]'
65
65
  end
66
66
  end
67
67
  end
@@ -72,7 +72,7 @@ describe "RailsAdmin Basic Edit" do
72
72
  end
73
73
 
74
74
  it "should raise NotFound" do
75
- page.driver.status_code.should eql(404)
75
+ expect(page.driver.status_code).to eq(404)
76
76
  end
77
77
  end
78
78
 
@@ -103,7 +103,7 @@ describe "RailsAdmin Basic Edit" do
103
103
  visit '/admin/ball?sort=color'
104
104
  click_link 'Edit'
105
105
  click_button 'Cancel'
106
- page.current_url.should == 'http://www.example.com/admin/ball?sort=color'
106
+ expect(page.current_url).to eq('http://www.example.com/admin/ball?sort=color')
107
107
  end
108
108
  end
109
109
  end
@@ -47,7 +47,7 @@ describe "RailsAdmin Export" do
47
47
  select "<comma> ','", :from => "csv_options_generator_col_sep"
48
48
  click_button 'Export to csv'
49
49
  csv = CSV.parse find('body').text
50
- csv[0].should =~ ["Id", "Created at", "Updated at", "Deleted at", "Name", "Position",
50
+ expect(csv[0]).to match_array ["Id", "Created at", "Updated at", "Deleted at", "Name", "Position",
51
51
  "Number", "Retired", "Injured", "Born on", "Notes", "Suspended", "Id [Team]", "Created at [Team]",
52
52
  "Updated at [Team]", "Name [Team]", "Logo url [Team]", "Team Manager [Team]", "Ballpark [Team]",
53
53
  "Mascot [Team]", "Founded [Team]", "Wins [Team]", "Losses [Team]", "Win percentage [Team]",
@@ -55,12 +55,12 @@ describe "RailsAdmin Export" do
55
55
  "Updated at [Draft]", "Date [Draft]", "Round [Draft]", "Pick [Draft]", "Overall [Draft]",
56
56
  "College [Draft]", "Notes [Draft]", "Id [Comments]", "Content [Comments]", "Created at [Comments]",
57
57
  "Updated at [Comments]"]
58
- csv.flatten.should include(@player.name + " exported")
59
- csv.flatten.should include(@player.team.name)
60
- csv.flatten.should include(@player.draft.college)
58
+ expect(csv.flatten).to include(@player.name + " exported")
59
+ expect(csv.flatten).to include(@player.team.name)
60
+ expect(csv.flatten).to include(@player.draft.college)
61
61
 
62
- csv.flatten.join(' ').should include(@player.comments.first.content.split("\n").first.strip)
63
- csv.flatten.join(' ').should include(@player.comments.second.content.split("\n").first.strip)
62
+ expect(csv.flatten.join(' ')).to include(@player.comments.first.content.split("\n").first.strip)
63
+ expect(csv.flatten.join(' ')).to include(@player.comments.second.content.split("\n").first.strip)
64
64
  end
65
65
 
66
66
  it "should allow to export to JSON" do
@@ -88,10 +88,10 @@ describe "RailsAdmin Export" do
88
88
  select "<comma> ','", :from => "csv_options_generator_col_sep"
89
89
  click_button 'Export to csv'
90
90
  csv = CSV.parse find('body').text
91
- csv[0].should =~ ["Id", "Commentable", "Commentable type", "Content", "Created at", "Updated at"]
91
+ expect(csv[0]).to match_array ["Id", "Commentable", "Commentable type", "Content", "Created at", "Updated at"]
92
92
  csv[1..-1].each do |line|
93
- line[csv[0].index('Commentable')].should == @player.id.to_s
94
- line[csv[0].index('Commentable type')].should == @player.class.to_s
93
+ expect(line[csv[0].index('Commentable')]).to eq(@player.id.to_s)
94
+ expect(line[csv[0].index('Commentable type')]).to eq(@player.class.to_s)
95
95
  end
96
96
  end
97
97
  end
@@ -100,7 +100,7 @@ describe "RailsAdmin Export" do
100
100
  it "should export with modified schema" do
101
101
  page.driver.post(export_path(:model_name => 'player', :schema => @non_default_schema, :csv => true, :all => true, :csv_options => { :generator => { :col_sep => "," } }))
102
102
  csv = CSV.parse find('body').text
103
- csv[0].should_not include('Created at')
103
+ expect(csv[0]).not_to include('Created at')
104
104
  end
105
105
  end
106
106
  end
@@ -15,16 +15,16 @@ describe "RailsAdmin Basic List" do
15
15
  describe "GET /admin/typo" do
16
16
  it "should redirect to dashboard and inform the user the model wasn't found" do
17
17
  visit '/admin/whatever'
18
- page.driver.status_code.should eql(404)
19
- find('.alert-error').should have_content("Model 'Whatever' could not be found")
18
+ expect(page.driver.status_code).to eq(404)
19
+ expect(find('.alert-error')).to have_content("Model 'Whatever' could not be found")
20
20
  end
21
21
  end
22
22
 
23
23
  describe "GET /admin/balls/545-typo" do
24
24
  it "should redirect to balls index and inform the user the id wasn't found" do
25
25
  visit '/admin/ball/545-typo'
26
- page.driver.status_code.should eql(404)
27
- find('.alert-error').should have_content("Ball with id '545-typo' could not be found")
26
+ expect(page.driver.status_code).to eq(404)
27
+ expect(find('.alert-error')).to have_content("Ball with id '545-typo' could not be found")
28
28
  end
29
29
  end
30
30
 
@@ -286,9 +286,9 @@ describe "RailsAdmin Basic List" do
286
286
  end
287
287
 
288
288
  it "should paginate correctly" do
289
- find('.pagination ul li:first').should have_content("« Prev")
290
- find('.pagination ul li:last').should have_content("Next »")
291
- find('.pagination ul li.active').should have_content("2")
289
+ expect(find('.pagination ul li:first')).to have_content("« Prev")
290
+ expect(find('.pagination ul li:last')).to have_content("Next »")
291
+ expect(find('.pagination ul li.active')).to have_content("2")
292
292
  end
293
293
  end
294
294
 
@@ -300,9 +300,9 @@ describe "RailsAdmin Basic List" do
300
300
  end
301
301
 
302
302
  it "should paginate correctly and contain the right item" do
303
- find('.pagination ul li:first').should have_content("« Prev")
304
- find('.pagination ul li:last').should have_content("Next »")
305
- find('.pagination ul li.active').should have_content("3")
303
+ expect(find('.pagination ul li:first')).to have_content("« Prev")
304
+ expect(find('.pagination ul li:last')).to have_content("Next »")
305
+ expect(find('.pagination ul li.active')).to have_content("3")
306
306
  end
307
307
  end
308
308
 
@@ -310,7 +310,7 @@ describe "RailsAdmin Basic List" do
310
310
  it "should respond successfully" do
311
311
  2.times.map { FactoryGirl.create :player }
312
312
  visit index_path(:model_name => "player", :all => true)
313
- find('div.total-count').should have_content("2 players")
313
+ expect(find('div.total-count')).to have_content("2 players")
314
314
  end
315
315
  end
316
316
 
@@ -319,7 +319,7 @@ describe "RailsAdmin Basic List" do
319
319
  @team = FactoryGirl.create :team
320
320
  2.times.map { FactoryGirl.create :player, :team => @team }
321
321
  visit index_path(:model_name => "player", :associated_collection => "players", :compact => true, :current_action => 'update', :source_abstract_model => 'team', :source_object_id => @team.id)
322
- find('div.total-count').should have_content("2 players")
322
+ expect(find('div.total-count')).to have_content("2 players")
323
323
  end
324
324
  end
325
325
 
@@ -327,10 +327,10 @@ describe "RailsAdmin Basic List" do
327
327
  it "should have_content an array with 2 elements and contain an array of elements with keys id and label" do
328
328
  2.times.map { FactoryGirl.create :player }
329
329
  response = page.driver.get(index_path(:model_name => "player", :compact => true, :format => :json))
330
- ActiveSupport::JSON.decode(response.body).length.should eql(2)
330
+ expect(ActiveSupport::JSON.decode(response.body).length).to eq(2)
331
331
  ActiveSupport::JSON.decode(response.body).each do |object|
332
- object.should have_key("id")
333
- object.should have_key("label")
332
+ expect(object).to have_key("id")
333
+ expect(object).to have_key("label")
334
334
  end
335
335
  end
336
336
  end
@@ -339,7 +339,7 @@ describe "RailsAdmin Basic List" do
339
339
  let(:player) { FactoryGirl.create :player }
340
340
 
341
341
  before do
342
- Player.count.should == 0
342
+ expect(Player.count).to eq(0)
343
343
  end
344
344
 
345
345
  it "finds the player if the query matches the default search opeartor" do
@@ -55,19 +55,19 @@ describe "RailsAdmin Basic New" do
55
55
  describe "GET /admin/player/new with parameters for pre-population" do
56
56
  it "should populate form field when corresponding parameters are passed in" do
57
57
  visit new_path(:model_name => 'player', :player => {:name => 'Sam'})
58
- page.should have_css('input[value=Sam]')
58
+ expect(page).to have_css('input[value=Sam]')
59
59
  end
60
60
 
61
61
  it "should prepropulate belongs to relationships" do
62
62
  @team = FactoryGirl.create :team, :name => "belongs_to association prepopulated"
63
63
  visit new_path(:model_name => 'player', :associations => { :team => @team.id } )
64
- page.should have_css("select#player_team_id option[selected='selected'][value='#{@team.id}']")
64
+ expect(page).to have_css("select#player_team_id option[selected='selected'][value='#{@team.id}']")
65
65
  end
66
66
 
67
67
  it "should prepropulate has_many relationships" do
68
68
  @player = FactoryGirl.create :player, :name => "has_many association prepopulated"
69
69
  visit new_path(:model_name => 'team', :associations => { :players => @player.id } )
70
- page.should have_css("select#team_player_ids option[selected='selected'][value='#{@player.id}']")
70
+ expect(page).to have_css("select#team_player_ids option[selected='selected'][value='#{@player.id}']")
71
71
  end
72
72
  end
73
73
 
@@ -6,13 +6,13 @@ describe "RailsAdmin Namespaced Model New" do
6
6
 
7
7
  describe "AbstractModel#to_param" do
8
8
  it 'turns namespaces into prefixes with ~' do
9
- RailsAdmin::AbstractModel.new("Cms::BasicPage").to_param.should == 'cms~basic_page'
9
+ expect(RailsAdmin::AbstractModel.new("Cms::BasicPage").to_param).to eq('cms~basic_page')
10
10
  end
11
11
  end
12
12
 
13
13
  describe "ApplicationController#to_model_name" do
14
14
  it 'turns cms~basic_page into Cms::BasicPage' do
15
- RailsAdmin::ApplicationController.new.to_model_name('cms~basic_page').should == 'Cms::BasicPage'
15
+ expect(RailsAdmin::ApplicationController.new.to_model_name('cms~basic_page')).to eq('Cms::BasicPage')
16
16
  end
17
17
  end
18
18
 
@@ -22,11 +22,10 @@ describe "RailsAdmin Basic Show" do
22
22
  describe "GET /admin/players/123this-id-doesnt-exist" do
23
23
  it "should raise NotFound" do
24
24
  visit '/admin/players/123this-id-doesnt-exist'
25
- page.driver.status_code.should eql(404)
25
+ expect(page.driver.status_code).to eq(404)
26
26
  end
27
27
  end
28
28
 
29
-
30
29
  describe "show with belongs_to association" do
31
30
  before(:each) do
32
31
  @player = FactoryGirl.create :player
@@ -13,7 +13,7 @@ describe "RailsAdmin Basic Update" do
13
13
  it "should return to edit page" do
14
14
  fill_in "player[name]", :with => ""
15
15
  click_button "Save"
16
- page.driver.status_code.should eql(406)
16
+ expect(page.driver.status_code).to eq(406)
17
17
  should have_selector "form", :action => "/admin/players/#{@player.id}"
18
18
  end
19
19
  end
@@ -33,9 +33,9 @@ describe "RailsAdmin Basic Update" do
33
33
  end
34
34
 
35
35
  it "should update an object with correct attributes" do
36
- @player.name.should eql("Jackie Robinson")
37
- @player.number.should eql(42)
38
- @player.position.should eql("Second baseman")
36
+ expect(@player.name).to eq("Jackie Robinson")
37
+ expect(@player.number).to eq(42)
38
+ expect(@player.position).to eq("Second baseman")
39
39
  end
40
40
  end
41
41
 
@@ -54,9 +54,9 @@ describe "RailsAdmin Basic Update" do
54
54
  end
55
55
 
56
56
  it "should update an object with correct attributes" do
57
- @player.name.should eql("Jackie Robinson")
58
- @player.number.should eql(42)
59
- @player.position.should eql("Second baseman")
57
+ expect(@player.name).to eq("Jackie Robinson")
58
+ expect(@player.number).to eq(42)
59
+ expect(@player.position).to eq("Second baseman")
60
60
  end
61
61
  end
62
62
 
@@ -70,14 +70,14 @@ describe "RailsAdmin Basic Update" do
70
70
  end
71
71
 
72
72
  it "should update an object with correct attributes" do
73
- @player.name.should eql("Jackie Robinson")
74
- @player.number.should eql(@number)
75
- @player.position.should eql("Second baseman")
73
+ expect(@player.name).to eq("Jackie Robinson")
74
+ expect(@player.number).to eq(@number)
75
+ expect(@player.position).to eq("Second baseman")
76
76
  end
77
77
 
78
78
  it "should update an object with correct associations" do
79
79
  @draft.reload
80
- @player.draft.should eql(@draft)
80
+ expect(@player.draft).to eq(@draft)
81
81
  end
82
82
  end
83
83
 
@@ -93,19 +93,19 @@ describe "RailsAdmin Basic Update" do
93
93
  page.driver.put edit_path(:model_name => "league", :id => @league.id, :league => {:name => "National League", :division_ids => [@divisions[0].id] })
94
94
 
95
95
  @league.reload
96
- @league.name.should eql("National League")
96
+ expect(@league.name).to eq("National League")
97
97
  @divisions[0].reload
98
- @league.divisions.should include(@divisions[0])
99
- @league.divisions.should_not include(@divisions[1])
100
- @league.divisions.should_not include(@divisions[2])
98
+ expect(@league.divisions).to include(@divisions[0])
99
+ expect(@league.divisions).not_to include(@divisions[1])
100
+ expect(@league.divisions).not_to include(@divisions[2])
101
101
 
102
- RailsAdmin::History.where(:item => @league.id).collect(&:message).should include("Added Divisions ##{@divisions[0].id} associations, Changed name")
102
+ expect(RailsAdmin::History.where(:item => @league.id).collect(&:message)).to include("Added Divisions ##{@divisions[0].id} associations, Changed name")
103
103
 
104
104
  page.driver.put edit_path(:model_name => "league", :id => @league.id, :league => {:division_ids => [""]})
105
105
 
106
106
  @league.reload
107
- @league.divisions.should be_empty
108
- RailsAdmin::History.where(:item => @league.id).collect(&:message).should include("Removed Divisions ##{@divisions[0].id} associations")
107
+ expect(@league.divisions).to be_empty
108
+ expect(RailsAdmin::History.where(:item => @league.id).collect(&:message)).to include("Removed Divisions ##{@divisions[0].id} associations")
109
109
  end
110
110
  end
111
111
 
@@ -115,7 +115,7 @@ describe "RailsAdmin Basic Update" do
115
115
  end
116
116
 
117
117
  it "should raise NotFound" do
118
- page.driver.status_code.should eql(404)
118
+ expect(page.driver.status_code).to eq(404)
119
119
  end
120
120
  end
121
121
 
@@ -137,7 +137,7 @@ describe "RailsAdmin Basic Update" do
137
137
  # TODO: Mongoid 3.0.0 lacks ability of numericality validation on Integer field.
138
138
  # This is caused by change in https://github.com/mongoid/mongoid/pull/1698
139
139
  # I believe this should be a bug in Mongoid.
140
- body.should have_content("Player failed to be updated") unless CI_ORM == :mongoid && Mongoid::VERSION >= '3.0.0'
140
+ expect(body).to have_content("Player failed to be updated") unless CI_ORM == :mongoid && Mongoid::VERSION >= '3.0.0'
141
141
  end
142
142
  end
143
143
 
@@ -160,7 +160,7 @@ describe "RailsAdmin Basic Update" do
160
160
  end
161
161
 
162
162
  it "should save the serialized data" do
163
- @user.roles.should eql(['admin','user'])
163
+ expect(@user.roles).to eq(['admin','user'])
164
164
  end
165
165
  end
166
166
 
@@ -177,8 +177,8 @@ describe "RailsAdmin Basic Update" do
177
177
  click_button "Save"
178
178
 
179
179
  @field_test.reload
180
- @field_test.array_field.should eql([4, 2])
181
- @field_test.hash_field.should eql({ "a" => 6, "b" => 2 })
180
+ expect(@field_test.array_field).to eq([4, 2])
181
+ expect(@field_test.hash_field).to eq({ "a" => 6, "b" => 2 })
182
182
  end
183
183
 
184
184
  it "should clear data when empty string is passed" do
@@ -187,8 +187,8 @@ describe "RailsAdmin Basic Update" do
187
187
  click_button "Save"
188
188
 
189
189
  @field_test.reload
190
- @field_test.array_field.should eql(nil)
191
- @field_test.hash_field.should eql(nil)
190
+ expect(@field_test.array_field).to eq(nil)
191
+ expect(@field_test.hash_field).to eq(nil)
192
192
  end
193
193
  end
194
194
 
@@ -205,7 +205,7 @@ describe "RailsAdmin Basic Update" do
205
205
  end
206
206
 
207
207
  it "should update an object with correct attributes" do
208
- @ball.color.should eql("gray")
208
+ expect(@ball.color).to eq("gray")
209
209
  end
210
210
  end
211
211
 
@@ -222,7 +222,7 @@ describe "RailsAdmin Basic Update" do
222
222
  end
223
223
 
224
224
  it "should update an object with correct attributes" do
225
- @hardball.color.should eql("cyan")
225
+ expect(@hardball.color).to eq("cyan")
226
226
  end
227
227
  end
228
228
 
@@ -5,7 +5,7 @@ require 'spec_helper'
5
5
  describe "RailsAdmin Config DSL Edit Section" do
6
6
 
7
7
  subject { page }
8
-
8
+
9
9
  describe " a field with 'format' as a name (Kernel function)" do
10
10
 
11
11
  it "should be updatable without any error" do
@@ -18,7 +18,7 @@ describe "RailsAdmin Config DSL Edit Section" do
18
18
  fill_in "field_test[format]", :with => "test for format"
19
19
  click_button "Save"
20
20
  @record = RailsAdmin::AbstractModel.new("FieldTest").first
21
- @record.format.should eql("test for format")
21
+ expect(@record.format).to eq("test for format")
22
22
  end
23
23
  end
24
24
 
@@ -49,10 +49,10 @@ describe "RailsAdmin Config DSL Edit Section" do
49
49
  # but Capybara's RackTest driver is not up to this behavior change.
50
50
  # (https://github.com/jnicklas/capybara/issues/677)
51
51
  # So we manually cut off first newline character as a workaround here.
52
- find_field('field_test[string_field]').value.gsub(/^\n/, '').should == 'string_field default_value'
53
- find_field('field_test[text_field]').value.gsub(/^\n/, '').should == 'string_field text_field'
54
- find_field('field_test[date_field]').value.should == Date.today.to_s
55
- has_checked_field?('field_test[boolean_field]').should be_true
52
+ expect(find_field('field_test[string_field]').value.gsub(/^\n/, '')).to eq('string_field default_value')
53
+ expect(find_field('field_test[text_field]').value.gsub(/^\n/, '')).to eq('string_field text_field')
54
+ expect(find_field('field_test[date_field]').value).to eq(Date.today.to_s)
55
+ expect(has_checked_field?('field_test[boolean_field]')).to be_true
56
56
  end
57
57
 
58
58
  it "should set default value for selects" do
@@ -65,7 +65,7 @@ describe "RailsAdmin Config DSL Edit Section" do
65
65
  end
66
66
  end
67
67
  visit new_path(:model_name => "team")
68
- find_field('team[color]').value.should == 'black'
68
+ expect(find_field('team[color]').value).to eq('black')
69
69
  end
70
70
  end
71
71
 
@@ -95,8 +95,8 @@ describe "RailsAdmin Config DSL Edit Section" do
95
95
  should have_no_selector "field_test[protected_field]"
96
96
  click_button "Save"
97
97
  @field_test = FieldTest.first
98
- @field_test.string_field.should == "No problem here"
99
- @field_test.restricted_field.should == "I'm allowed to do that as :custom_role only"
98
+ expect(@field_test.string_field).to eq("No problem here")
99
+ expect(@field_test.restricted_field).to eq("I'm allowed to do that as :custom_role only")
100
100
  end
101
101
  end
102
102
 
@@ -182,19 +182,19 @@ describe "RailsAdmin Config DSL Edit Section" do
182
182
  context "using mongoid", :skip_active_record => true do
183
183
  it "should use the db column size for the maximum length" do
184
184
  visit new_path(:model_name => "help_test")
185
- find("#help_test_name_field .help-block").should have_content("Length up to 255.")
185
+ expect(find("#help_test_name_field .help-block")).to have_content("Length up to 255.")
186
186
  end
187
187
 
188
188
  it "should return nil for the maximum length" do
189
189
  visit new_path(:model_name => "team")
190
- find("#team_custom_field_field .help-block").should_not have_content("Length")
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
195
  it "should use the db column size for the maximum length" do
196
196
  visit new_path(:model_name => "help_test")
197
- find("#help_test_name_field .help-block").should have_content("Length up to 50.")
197
+ expect(find("#help_test_name_field .help-block")).to have_content("Length up to 50.")
198
198
  end
199
199
 
200
200
  it "should use the :minimum setting from the validation" do
@@ -202,7 +202,7 @@ describe "RailsAdmin Config DSL Edit Section" do
202
202
  validates_length_of :name, :minimum => 1
203
203
  end
204
204
  visit new_path(:model_name => "help_test")
205
- find("#help_test_name_field .help-block").should have_content("Length of 1-50.")
205
+ expect(find("#help_test_name_field .help-block")).to have_content("Length of 1-50.")
206
206
  end
207
207
 
208
208
  it "should use the minimum of db column size or :maximum setting from the validation" do
@@ -210,7 +210,7 @@ describe "RailsAdmin Config DSL Edit Section" do
210
210
  validates_length_of :name, :maximum => 51
211
211
  end
212
212
  visit new_path(:model_name => "help_test")
213
- find("#help_test_name_field .help-block").should have_content("Length up to 50.")
213
+ expect(find("#help_test_name_field .help-block")).to have_content("Length up to 50.")
214
214
  end
215
215
  end
216
216
 
@@ -263,7 +263,7 @@ describe "RailsAdmin Config DSL Edit Section" do
263
263
  validates_length_of :name, :is => 3
264
264
  end
265
265
  visit new_path(:model_name => "help_test")
266
- find("#help_test_name_field .help-block").should have_content("Length of 3.")
266
+ expect(find("#help_test_name_field .help-block")).to have_content("Length of 3.")
267
267
  end
268
268
 
269
269
  it "should use the :maximum setting from the validation" do
@@ -271,7 +271,7 @@ describe "RailsAdmin Config DSL Edit Section" do
271
271
  validates_length_of :name, :maximum => 49
272
272
  end
273
273
  visit new_path(:model_name => "help_test")
274
- find("#help_test_name_field .help-block").should have_content("Length up to 49.")
274
+ expect(find("#help_test_name_field .help-block")).to have_content("Length up to 49.")
275
275
  end
276
276
 
277
277
  it "should use the :minimum and :maximum from the validation" do
@@ -279,7 +279,7 @@ describe "RailsAdmin Config DSL Edit Section" do
279
279
  validates_length_of :name, :minimum => 1, :maximum => 49
280
280
  end
281
281
  visit new_path(:model_name => "help_test")
282
- find("#help_test_name_field .help-block").should have_content("Length of 1-49.")
282
+ expect(find("#help_test_name_field .help-block")).to have_content("Length of 1-49.")
283
283
  end
284
284
 
285
285
  it "should use the range from the validation" do
@@ -287,7 +287,7 @@ describe "RailsAdmin Config DSL Edit Section" do
287
287
  validates_length_of :name, :in => 1..49
288
288
  end
289
289
  visit new_path(:model_name => "help_test")
290
- find("#help_test_name_field .help-block").should have_content("Length of 1-49.")
290
+ expect(find("#help_test_name_field .help-block")).to have_content("Length of 1-49.")
291
291
  end
292
292
 
293
293
  end
@@ -311,9 +311,9 @@ describe "RailsAdmin Config DSL Edit Section" do
311
311
  visit new_path(:model_name => "team")
312
312
  should have_selector("legend", :text => "Basic info")
313
313
  all("legend", :text => "Basic info").tap do |nodes|
314
- nodes.count.should == 2
315
- nodes.first.visible?.should be_false
316
- nodes.last.visible?.should be_true
314
+ expect(nodes.count).to eq(2)
315
+ expect(nodes.first.visible?).to be_false
316
+ expect(nodes.last.visible?).to be_true
317
317
  end
318
318
  should have_selector("legend", :text => "Belong's to associations")
319
319
  should have_selector("label", :text => "Name")
@@ -565,9 +565,9 @@ describe "RailsAdmin Config DSL Edit Section" do
565
565
  end
566
566
  end
567
567
  visit new_path(:model_name => "team")
568
- find("#team_manager_field .help-block").should have_content("Required. Length up to 100. Additional help text for manager field.")
569
- find("#team_division_id_field .help-block").should have_content("Required")
570
- find("#team_name_field .help-block").should_not have_content("Additional help text")
568
+ expect(find("#team_manager_field .help-block")).to have_content("Required. Length up to 100. Additional help text for manager field.")
569
+ expect(find("#team_division_id_field .help-block")).to have_content("Required")
570
+ expect(find("#team_name_field .help-block")).not_to have_content("Additional help text")
571
571
  end
572
572
 
573
573
  it "should have option to override required status" do
@@ -585,9 +585,9 @@ describe "RailsAdmin Config DSL Edit Section" do
585
585
  end
586
586
  end
587
587
  visit new_path(:model_name => "team")
588
- find("#team_manager_field .help-block").should have_content("Optional")
589
- find("#team_division_id_field .help-block").should have_content("Optional")
590
- find("#team_name_field .help-block").should have_content("Required")
588
+ expect(find("#team_manager_field .help-block")).to have_content("Optional")
589
+ expect(find("#team_division_id_field .help-block")).to have_content("Optional")
590
+ expect(find("#team_name_field .help-block")).to have_content("Required")
591
591
  end
592
592
  end
593
593
 
@@ -624,9 +624,9 @@ describe "RailsAdmin Config DSL Edit Section" do
624
624
  page.find('#field_test_nested_field_tests_attributes_1__destroy').set('true')
625
625
  click_button "Save"
626
626
  @record.reload
627
- @record.comment.content.should == 'nested comment content'
628
- @record.nested_field_tests.length.should == 1
629
- @record.nested_field_tests[0].title.should == 'nested field test title 1 edited'
627
+ expect(@record.comment.content).to eq('nested comment content')
628
+ expect(@record.nested_field_tests.length).to eq(1)
629
+ expect(@record.nested_field_tests[0].title).to eq('nested field test title 1 edited')
630
630
  end
631
631
 
632
632
  it 'should set bindings[:object] to nested object' do
@@ -642,7 +642,7 @@ describe "RailsAdmin Config DSL Edit Section" do
642
642
  @record = FieldTest.create
643
643
  @record.nested_field_tests << NestedFieldTest.create!(:title => 'title 1')
644
644
  visit edit_path(:model_name => "field_test", :id => @record.id)
645
- find('#field_test_nested_field_tests_attributes_0_title_field').should have_content('NestedFieldTest')
645
+ expect(find('#field_test_nested_field_tests_attributes_0_title_field')).to have_content('NestedFieldTest')
646
646
  end
647
647
 
648
648
  it 'should be desactivable' do
@@ -677,7 +677,7 @@ describe "RailsAdmin Config DSL Edit Section" do
677
677
  FieldTest.nested_attributes_options.stub(:[]).with(:nested_field_tests).
678
678
  and_return({:allow_destroy=>false, :update_only=>false})
679
679
  visit edit_path(:model_name => "field_test", :id => @record.id)
680
- find('#field_test_nested_field_tests_attributes_0_title').value.should == 'nested title 1'
680
+ expect(find('#field_test_nested_field_tests_attributes_0_title').value).to eq('nested title 1')
681
681
  should_not have_selector('form .remove_nested_fields')
682
682
  should have_selector('[id$="_fields_blueprint"] .remove_nested_fields')
683
683
  end
@@ -701,8 +701,8 @@ describe "RailsAdmin Config DSL Edit Section" do
701
701
  page.find('#field_test_embeds_attributes_1__destroy').set('true')
702
702
  click_button "Save"
703
703
  @record.reload
704
- @record.embeds.length.should == 1
705
- @record.embeds[0].name.should == 'embed 1 edited'
704
+ expect(@record.embeds.length).to eq(1)
705
+ expect(@record.embeds[0].name).to eq('embed 1 edited')
706
706
  end
707
707
  end
708
708
 
@@ -712,26 +712,26 @@ describe "RailsAdmin Config DSL Edit Section" do
712
712
  it "should be required" do
713
713
  # draft.notes is nullable and has no validation
714
714
  field = RailsAdmin::config("Draft").edit.fields.find{|f| f.name == :notes}
715
- field.properties[:nullable?].should be true
716
- field.required?.should be false
715
+ expect(field.properties[:nullable?]).to be_true
716
+ expect(field.required?).to be_false
717
717
 
718
718
  # draft.date is nullable in the schema but has an AR
719
719
  # validates_presence_of validation that makes it required
720
720
  field = RailsAdmin::config("Draft").edit.fields.find{|f| f.name == :date}
721
- field.properties[:nullable?].should be true
722
- field.required?.should be true
721
+ expect(field.properties[:nullable?]).to be_true
722
+ expect(field.required?).to be_true
723
723
 
724
724
  # draft.round is nullable in the schema but has an AR
725
725
  # validates_numericality_of validation that makes it required
726
726
  field = RailsAdmin::config("Draft").edit.fields.find{|f| f.name == :round}
727
- field.properties[:nullable?].should be true
728
- field.required?.should be true
727
+ expect(field.properties[:nullable?]).to be_true
728
+ expect(field.required?).to be_true
729
729
 
730
730
  # team.revenue is nullable in the schema but has an AR
731
731
  # validates_numericality_of validation that allows nil
732
732
  field = RailsAdmin::config("Team").edit.fields.find{|f| f.name == :revenue}
733
- field.properties[:nullable?].should be true
734
- field.required?.should be false
733
+ expect(field.properties[:nullable?]).to be_true
734
+ expect(field.required?).to be_false
735
735
  end
736
736
  end
737
737
 
@@ -739,7 +739,7 @@ describe "RailsAdmin Config DSL Edit Section" do
739
739
 
740
740
  it "should start with CKEditor disabled" do
741
741
  field = RailsAdmin::config("Draft").edit.fields.find{|f| f.name == :notes}
742
- field.ckeditor.should be false
742
+ expect(field.ckeditor).to be_false
743
743
  end
744
744
 
745
745
  it "should add Javascript to enable CKEditor" do
@@ -759,7 +759,7 @@ describe "RailsAdmin Config DSL Edit Section" do
759
759
 
760
760
  it "should start with CodeMirror disabled" do
761
761
  field = RailsAdmin::config("Draft").edit.fields.find{|f| f.name == :notes}
762
- field.codemirror.should be false
762
+ expect(field.codemirror).to be_false
763
763
  end
764
764
 
765
765
  it "should add Javascript to enable CodeMirror" do
@@ -779,7 +779,7 @@ describe "RailsAdmin Config DSL Edit Section" do
779
779
 
780
780
  it "should start with bootstrap_wysihtml5 disabled" do
781
781
  field = RailsAdmin::config("Draft").edit.fields.find{|f| f.name == :notes}
782
- field.bootstrap_wysihtml5.should be false
782
+ expect(field.bootstrap_wysihtml5).to be_false
783
783
  end
784
784
 
785
785
  it "should add Javascript to enable bootstrap_wysihtml5" do