Permalink
Browse files

Rename assertions

  • Loading branch information...
1 parent e2a7060 commit 02c03c15f613970071e97e15ff8d43e26e651b04 @sferik committed Oct 10, 2012
Showing with 338 additions and 338 deletions.
  1. +7 −7 spec/controllers/main_controller_spec.rb
  2. +19 −19 spec/helpers/application_helper_spec.rb
  3. +1 −1 spec/helpers/form_builder_spec.rb
  4. +2 −2 spec/integration/basic/bulk_action/rails_admin_basic_bulk_action_spec.rb
  5. +2 −2 spec/integration/basic/bulk_destroy/rails_admin_basic_bulk_destroy_spec.rb
  6. +9 −9 spec/integration/basic/create/rails_admin_basic_create_spec.rb
  7. +1 −1 spec/integration/basic/create/rails_admin_namespaced_model_create_spec.rb
  8. +4 −4 spec/integration/basic/delete/rails_admin_basic_delete_spec.rb
  9. +8 −8 spec/integration/basic/destroy/rails_admin_basic_destroy_spec.rb
  10. +10 −10 spec/integration/basic/edit/rails_admin_basic_edit_spec.rb
  11. +5 −5 spec/integration/basic/export/rails_admin_basic_export_spec.rb
  12. +25 −25 spec/integration/basic/list/rails_admin_basic_list_spec.rb
  13. +8 −8 spec/integration/basic/new/rails_admin_basic_new_spec.rb
  14. +1 −1 spec/integration/basic/new/rails_admin_namespaced_model_new_spec.rb
  15. +6 −6 spec/integration/basic/show/rails_admin_basic_show_spec.rb
  16. +13 −13 spec/integration/basic/update/rails_admin_basic_update_spec.rb
  17. +59 −59 spec/integration/config/edit/rails_admin_config_edit_spec.rb
  18. +28 −28 spec/integration/config/list/rails_admin_config_list_spec.rb
  19. +20 −20 spec/integration/config/show/rails_admin_config_show_spec.rb
  20. +6 −6 spec/integration/history/rails_admin_history_spec.rb
  21. +14 −14 spec/integration/rails_admin_spec.rb
  22. +3 −3 spec/integration/relation_spec.rb
  23. +7 −7 spec/unit/adapters/active_record/abstract_object_spec.rb
  24. +4 −4 spec/unit/adapters/mongoid_spec.rb
  25. +2 −2 spec/unit/config/actions/base_spec.rb
  26. +14 −14 spec/unit/config/actions_spec.rb
  27. +29 −29 spec/unit/config/fields/base_spec.rb
  28. +4 −4 spec/unit/config/fields/date_spec.rb
  29. +4 −4 spec/unit/config/fields/datetime_spec.rb
  30. +3 −3 spec/unit/config/fields/time_spec.rb
  31. +1 −1 spec/unit/config/fields/timestamp_spec.rb
  32. +10 −10 spec/unit/config/model_spec.rb
  33. +4 −4 spec/unit/config/sections_spec.rb
  34. +5 −5 spec/unit/config_spec.rb
@@ -9,12 +9,12 @@
controller.stub(:render).and_return(true) # no rendering
end
- it "should show statistics by default" do
+ it "shows statistics by default" do
RailsAdmin.config(Player).abstract_model.should_receive(:count).and_return(0)
controller.dashboard
end
- it "should not show statistics if turned off" do
+ it "does not show statistics if turned off" do
RailsAdmin.config do |c|
c.actions do
dashboard do
@@ -30,20 +30,20 @@
describe "#check_for_cancel" do
- it "should redirect to back if params[:bulk_ids] is nil when params[:bulk_action] is present" do
+ it "redirects to back if params[:bulk_ids] is nil when params[:bulk_action] is present" do
controller.stub(:back_or_index) { raise StandardError.new('redirected back') }
expect { get :bulk_delete, { :model_name => "player", :bulk_action =>"bulk_delete" } }.to raise_error('redirected back')
expect { get :bulk_delete, { :model_name => "player", :bulk_action =>"bulk_delete", :bulk_ids => [] } }.to_not raise_error('redirected back')
end
end
describe "#get_sort_hash" do
- it "should work with belongs_to associations with label method virtual" do
+ it "works with belongs_to associations with label method virtual" do
controller.params = { :sort => "parent_category", :model_name =>"categories" }
expect(controller.send(:get_sort_hash, RailsAdmin.config(Category))).to eq({:sort=>"categories.parent_category_id", :sort_reverse=>true})
end
- it "should work with belongs_to associations with label method real column" do
+ it "works with belongs_to associations with label method real column" do
controller.params = { :sort => "team", :model_name =>"players" }
expect(controller.send(:get_sort_hash, RailsAdmin.config(Player))).to eq({:sort=>"teams.name", :sort_reverse=>true})
end
@@ -55,7 +55,7 @@
controller.params = { :model_name => "teams" }
end
- it "should paginate" do
+ it "paginates" do
expect(controller.list_entries(RailsAdmin.config(Team), :index, nil, false).to_a.length).to eq(21)
expect(controller.list_entries(RailsAdmin.config(Team), :index, nil, true).to_a.length).to eq(20)
end
@@ -67,7 +67,7 @@
controller.params = { :model_name => "teams", :bulk_action => "bulk_delete", :bulk_ids => @teams.map(&:id) }
end
- it "should not paginate" do
+ it "does not paginate" do
expect(controller.list_entries(RailsAdmin.config(Team), :bulk_delete).to_a.length).to eq(21)
end
end
@@ -7,7 +7,7 @@
end
describe "#current_action?" do
- it "should return true if current_action, false otherwise" do
+ it "returns true if current_action, false otherwise" do
@action = RailsAdmin::Config::Actions.find(:index)
expect(helper.current_action?(RailsAdmin::Config::Actions.find(:index))).to be_true
@@ -16,7 +16,7 @@
end
describe "#action" do
- it "should return action by :custom_key" do
+ it "returns action by :custom_key" do
RailsAdmin.config do |config|
config.actions do
dashboard do
@@ -27,7 +27,7 @@
expect(helper.action(:my_custom_dashboard_key)).to be
end
- it "should return only visible actions" do
+ it "returns only visible actions" do
RailsAdmin.config do |config|
config.actions do
dashboard do
@@ -39,7 +39,7 @@
expect(helper.action(:dashboard)).to be_nil
end
- it "should return only visible actions, passing all bindings" do
+ it "returns only visible actions, passing all bindings" do
RailsAdmin.config do |config|
config.actions do
member :test_bindings do
@@ -58,7 +58,7 @@
end
describe "#actions" do
- it "should return actions by type" do
+ it "returns actions by type" do
abstract_model = RailsAdmin::AbstractModel.new(Player)
object = FactoryGirl.create :player
expect(helper.actions(:all, abstract_model, object).map(&:custom_key)).to eq([:dashboard, :index, :show, :new, :edit, :export, :delete, :bulk_delete, :history_show, :history_index, :show_in_app])
@@ -67,7 +67,7 @@
expect(helper.actions(:member, abstract_model, object).map(&:custom_key)).to eq([:show, :edit, :delete, :history_show, :show_in_app])
end
- it "should only return visible actions, passing bindings correctly" do
+ it "only returns visible actions, passing bindings correctly" do
RailsAdmin.config do |config|
config.actions do
member :test_bindings do
@@ -180,14 +180,14 @@
end
describe "#main_navigation" do
- it "should show included models" do
+ it "shows included models" do
RailsAdmin.config do |config|
config.included_models = [Ball, Comment]
end
expect(helper.main_navigation).to match /(nav\-header).*(Navigation).*(Balls).*(Comments)/m
end
- it "should not draw empty navigation labels" do
+ it "does not draw empty navigation labels" do
RailsAdmin.config do |config|
config.included_models = [Ball, Comment, Comment::Confirmed]
config.model Comment do
@@ -201,7 +201,7 @@
expect(helper.main_navigation).not_to match /(nav\-header).*(Navigation).*(Balls).*(Commentz).*(Confirmed).*(Comment)/m
end
- it "should not show unvisible models" do
+ it "does not show unvisible models" do
RailsAdmin.config do |config|
config.included_models = [Ball, Comment]
config.model Comment do
@@ -213,7 +213,7 @@
expect(result).not_to match "Comments"
end
- it "should show children of hidden models" do # https://github.com/sferik/rails_admin/issues/978
+ it "shows children of hidden models" do # https://github.com/sferik/rails_admin/issues/978
RailsAdmin.config do |config|
config.included_models = [Ball, Hardball]
config.model Ball do
@@ -223,14 +223,14 @@
expect(helper.main_navigation).to match /(nav\-header).*(Navigation).*(Hardballs)/m
end
- it "should show children of excluded models" do
+ it "shows children of excluded models" do
RailsAdmin.config do |config|
config.included_models = [Hardball]
end
expect(helper.main_navigation).to match /(nav\-header).*(Navigation).*(Hardballs)/m
end
- it "should nest in navigation label" do
+ it "nests in navigation label" do
RailsAdmin.config do |config|
config.included_models = [Comment]
config.model Comment do
@@ -240,7 +240,7 @@
expect(helper.main_navigation).to match /(nav\-header).*(commentable).*(Comments)/m
end
- it "should nest in parent model" do
+ it "nests in parent model" do
RailsAdmin.config do |config|
config.included_models = [Player, Comment]
config.model Comment do
@@ -250,7 +250,7 @@
expect(helper.main_navigation).to match /(Players).*(nav\-level\-1).*(Comments)/m
end
- it "should order" do
+ it "orders" do
RailsAdmin.config do |config|
config.included_models = [Player, Comment]
end
@@ -264,14 +264,14 @@
end
describe "#static_navigation" do
- it "should show not show static nav if no static links defined" do
+ it "shows not show static nav if no static links defined" do
RailsAdmin.config do |config|
config.navigation_static_links = {}
end
expect(helper.static_navigation).to be_empty
end
- it "should show links if defined" do
+ it "shows links if defined" do
RailsAdmin.config do |config|
config.navigation_static_links = {
'Test Link' => 'http://www.google.com'
@@ -280,7 +280,7 @@
expect(helper.static_navigation).to match /Test Link/
end
- it "should show default header if navigation_static_label not defined in config" do
+ it "shows default header if navigation_static_label not defined in config" do
RailsAdmin.config do |config|
config.navigation_static_links = {
'Test Link' => 'http://www.google.com'
@@ -289,7 +289,7 @@
expect(helper.static_navigation).to match I18n.t('admin.misc.navigation_static_label')
end
- it "should show custom header if defined" do
+ it "shows custom header if defined" do
RailsAdmin.config do |config|
config.navigation_static_label = "Test Header"
config.navigation_static_links = {
@@ -301,7 +301,7 @@
end
describe "#bulk_menu" do
- it "should include all visible bulkable actions" do
+ it "includes all visible bulkable actions" do
RailsAdmin.config do |config|
config.actions do
index
@@ -9,7 +9,7 @@
@builder.stub(:field_for).and_return("field")
end
- it "should not add additional error div from default ActionView::Base.field_error_proc" do
+ it "does not add additional error div from default ActionView::Base.field_error_proc" do
expect(@builder.generate({ :action => :create, :model_config => RailsAdmin.config(Player) })).not_to have_css(".field_with_errors")
expect(@builder.generate({ :action => :create, :model_config => RailsAdmin.config(Player) })).to have_css(".control-group.error")
end
@@ -9,14 +9,14 @@
end
describe "bulk_delete" do
- it "should show names of to-be-deleted players" do
+ it "shows names of to-be-deleted players" do
page.driver.post(bulk_action_path(:bulk_action => 'bulk_delete', :model_name => "player", :bulk_ids => @players.map(&:id)))
@players.each { |player| should have_content(player.name) }
end
end
describe "bulk_export" do
- it "should show form for export" do
+ it "shows form for export" do
visit index_path(:model_name => "player")
click_link "Export found Players"
@players.each { |player| should have_content("Select fields to export") }
@@ -14,7 +14,7 @@
click_button "Yes, I'm sure"
end
- it "should not contain deleted records" do
+ it "does not contain deleted records" do
expect(RailsAdmin::AbstractModel.new("Player").count).to eq(1)
expect(RailsAdmin::History.count).to eq(@delete_ids.count)
RailsAdmin::History.all.each do |history|
@@ -35,7 +35,7 @@
click_button "Cancel"
end
- it "should not delete records" do
+ it "does not delete records" do
expect(RailsAdmin::AbstractModel.new("Player").count).to eq(3)
end
end
@@ -13,7 +13,7 @@
@player = RailsAdmin::AbstractModel.new("Player").first
end
- it "should create an object with correct attributes" do
+ it "creates an object with correct attributes" do
expect(@player.name).to eq("Jackie Robinson")
expect(@player.number).to eq(42)
expect(@player.position).to eq("Second baseman")
@@ -32,7 +32,7 @@
@player = RailsAdmin::AbstractModel.new("Player").first
end
- it "should create an object with correct attributes" do
+ it "creates an object with correct attributes" do
expect(@player.name).to eq("Jackie Robinson")
expect(@player.number).to eq(42)
expect(@player.position).to eq("Second baseman")
@@ -51,7 +51,7 @@
@player = RailsAdmin::AbstractModel.new("Player").first
end
- it "should create an object with correct attributes" do
+ it "creates an object with correct attributes" do
expect(@player.name).to eq("Jackie Robinson")
expect(@player.number).to eq(42)
expect(@player.position).to eq("Second baseman")
@@ -67,7 +67,7 @@
@player = RailsAdmin::AbstractModel.new("Player").all.last # first is created by FactoryGirl
end
- it "should create an object with correct associations" do
+ it "creates an object with correct associations" do
@draft.reload
expect(@player.draft).to eq(@draft)
end
@@ -80,7 +80,7 @@
@league = RailsAdmin::AbstractModel.new("League").all.last
end
- it "should create an object with correct associations" do
+ it "creates an object with correct associations" do
@divisions[0].reload
expect(@league.divisions).to include(@divisions[0])
expect(@league.divisions).not_to include(@divisions[1])
@@ -95,7 +95,7 @@
@fan = RailsAdmin::AbstractModel.new("Fan").first
end
- it "should create an object with correct associations" do
+ it "creates an object with correct associations" do
@teams[0].reload
expect(@fan.teams).to include(@teams[0])
expect(@fan.teams).not_to include(@teams[1])
@@ -111,7 +111,7 @@
page.driver.post new_path(:model_name => "player", :player => {:name => @player.name, :number => @player.number.to_s, :position => @player.position, :team_id => @team.id})
end
- it "should show an error message" do
+ it "shows an error message" do
should have_content("There is already a player with that number on this team")
end
end
@@ -121,7 +121,7 @@
page.driver.post(new_path(:model_name => "player", :id => 1), :params => {:player => {}})
end
- it "should show an error message" do
+ it "shows an error message" do
should have_content("Player failed to be created")
should have_selector "form", :action => "/admin/players"
end
@@ -134,7 +134,7 @@
click_button "Save and add another"
end
- it "should show error base error message in flash" do
+ it "shows error base error message in flash" do
should have_content("Player failed to be created. Player is cheating")
end
end
@@ -4,7 +4,7 @@
subject { page }
- it "should create object with correct attributes" do
+ it "creates object with correct attributes" do
visit new_path(:model_name => "cms~basic_page")
fill_in "cms_basic_page[title]", :with => "Hello"
@@ -5,7 +5,7 @@
subject { page }
describe "delete" do
- it "should show \"Delete model\"" do
+ it "shows \"Delete model\"" do
@draft = FactoryGirl.create :draft
@player = @draft.player
@comment = @player.comments.create
@@ -22,7 +22,7 @@
visit delete_path(:model_name => "player", :id => 1)
end
- it "should raise NotFound" do
+ it "raises NotFound" do
expect(page.driver.status_code).to eq(404)
end
end
@@ -40,7 +40,7 @@
visit delete_path(:model_name => "player", :id => @player.id)
end
- it "should show \"Delete model\"" do
+ it "shows \"Delete model\"" do
should have_content("delete this player")
should_not have_selector("a[href=\"/admin/player/#{@player.id}\"]")
should_not have_selector("a[href=\"/admin/draft/#{@draft.id}\"]")
@@ -55,7 +55,7 @@
visit delete_path(:model_name => "player", :id => @player.id)
end
- it "should show \"Delete model\"" do
+ it "shows \"Delete model\"" do
should_not have_content("Routing Error")
should have_content("delete this player")
should have_link(@player.name, :href => "/admin/player/#{@player.id}")
Oops, something went wrong.

0 comments on commit 02c03c1

Please sign in to comment.