Sha256: 7ab6183cf46c41f17e6cbe7a6e328f520031ae5f13227e8693880c61bc5746e5

Contents?: true

Size: 855 Bytes

Versions: 9

Compression:

Stored size: 855 Bytes

Contents

require 'test_plugin_helper'

class ArfReportsControllerTest < ActionController::TestCase

  test "should delete selected reports" do
    host = FactoryGirl.create(:compliance_host)
    ForemanOpenscap::Helper.stubs(:find_name_or_uuid_by_host)
    ::ProxyAPI::Openscap.any_instance.stubs(:destroy_report).returns(true)
    ForemanOpenscap::ArfReport.any_instance.stubs(:openscap_proxy).returns(host.openscap_proxy)
    arf_reports = []
    3.times do
      arf_reports << FactoryGirl.create(:arf_report, :host_id => host.id)
    end
    last_arf = arf_reports[-1]
    assert_difference("ForemanOpenscap::ArfReport.count", -2) do
      post :submit_delete_multiple, { :arf_report_ids => arf_reports[0..-2].map(&:id) }, set_session_user
    end
    assert_redirected_to arf_reports_path
    assert_equal last_arf, ForemanOpenscap::ArfReport.first
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman_openscap-0.6.4 test/functional/arf_reports_controller_test.rb
foreman_openscap-0.6.3 test/functional/arf_reports_controller_test.rb
foreman_openscap-0.6.2 test/functional/arf_reports_controller_test.rb
foreman_openscap-0.6.1 test/functional/arf_reports_controller_test.rb
foreman_openscap-0.6.0 test/functional/arf_reports_controller_test.rb
foreman_openscap-0.5.4 test/functional/arf_reports_controller_test.rb
foreman_openscap-0.5.3 test/functional/arf_reports_controller_test.rb
foreman_openscap-0.5.2 test/functional/arf_reports_controller_test.rb
foreman_openscap-0.5.1 test/functional/arf_reports_controller_test.rb