Sha256: dcd86fe77ea4425afc55153ecbfca1f7932ede5b519118948a60a8bf7505b458
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
require 'spec_helper' describe "RailsAdmin Basic Bulk Destroy" do subject { page } describe "successful bulk delete of records", :active_record => true do before do RailsAdmin::History.destroy_all RailsAdmin.config { |c| c.audit_with :history } @players = 3.times.map { FactoryGirl.create(:player) } @delete_ids = @players[0..1].map(&:id) page.driver.post(bulk_action_path(:bulk_action => 'bulk_delete', :model_name => "player", :bulk_ids => @delete_ids)) click_button "Yes, I'm sure" end 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| expect(history.table).to eq("Player") end RailsAdmin::History.all.each do |history| expect(@delete_ids).to include(history.item) end expect(page).to have_selector(".alert-success", :text => "2 Players successfully deleted") end end describe "cancelled bulk_deletion" do before do @players = 3.times.map { FactoryGirl.create(:player) } @delete_ids = @players[0..1].map(&:id) page.driver.post(bulk_action_path(:bulk_action => 'bulk_delete', :model_name => "player", :bulk_ids => @delete_ids)) click_button "Cancel" end it "does not delete records" do expect(RailsAdmin::AbstractModel.new("Player").count).to eq(3) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_admin-0.3.0 | spec/integration/basic/bulk_destroy/rails_admin_basic_bulk_destroy_spec.rb |
rails_admin-0.2.0 | spec/integration/basic/bulk_destroy/rails_admin_basic_bulk_destroy_spec.rb |