Sha256: d8578ba5fb889e46a86c77be149f6619698b1abbdb7a18a022c9e69159ab6172

Contents?: true

Size: 643 Bytes

Versions: 103

Compression:

Stored size: 643 Bytes

Contents

require 'test_plugin_helper'

class InsightsFacetTest < ActiveSupport::TestCase
  setup do
    @host = FactoryBot.create(:host, :with_insights_hits)
    InsightsFacet.reset_counters(@host.insights.id, :hits_count)
  end

  test 'host with hits can be deleted' do
    assert_equal 1, @host.insights.hits.count

    host_id = @host.id
    @host.destroy
    actual_host = Host.find_by_id(host_id)
    assert_nil actual_host
  end

  test 'search host by recommendations_count' do
    FactoryBot.create(:host) # create another host with no recommendations

    assert_equal 1, Host.search_for('insights_recommendations_count = 1').count
  end
end

Version data entries

103 entries across 103 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.18.1 test/unit/insights_facet_test.rb
foreman_rh_cloud-1.0.18 test/unit/insights_facet_test.rb
foreman_rh_cloud-2.0.18 test/unit/insights_facet_test.rb
foreman_rh_cloud-3.0.18 test/unit/insights_facet_test.rb
foreman_rh_cloud-1.0.17 test/unit/insights_facet_test.rb
foreman_rh_cloud-2.0.17 test/unit/insights_facet_test.rb
foreman_rh_cloud-3.0.17 test/unit/insights_facet_test.rb
foreman_rh_cloud-2.0.16 test/unit/insights_facet_test.rb
foreman_rh_cloud-1.0.16 test/unit/insights_facet_test.rb
foreman_rh_cloud-3.0.16 test/unit/insights_facet_test.rb
foreman_rh_cloud-1.0.15 test/unit/insights_facet_test.rb
foreman_rh_cloud-2.0.15 test/unit/insights_facet_test.rb
foreman_rh_cloud-3.0.15 test/unit/insights_facet_test.rb
foreman_rh_cloud-3.0.14 test/unit/insights_facet_test.rb
foreman_rh_cloud-2.0.14 test/unit/insights_facet_test.rb
foreman_rh_cloud-1.0.14 test/unit/insights_facet_test.rb
foreman_rh_cloud-0.9.14 test/unit/insights_facet_test.rb
foreman_rh_cloud-0.9.13.1 test/unit/insights_facet_test.rb
foreman_rh_cloud-1.0.13.1 test/unit/insights_facet_test.rb
foreman_rh_cloud-2.0.13.1 test/unit/insights_facet_test.rb