Sha256: be134f3f2bdfda3b29aad04e9fff4467965f87f11b26773f56bbe20187f7a69d

Contents?: true

Size: 742 Bytes

Versions: 6

Compression:

Stored size: 742 Bytes

Contents

require 'test_statistics_helper'

module ForemanStatistics
  class TrendTest < ActiveSupport::TestCase
    test 'should delete trend and associated trend counters' do
      trend = FactoryBot.create(:foreman_statistics_trend, :value, :with_counters)
      trend_id = trend.id
      assert_equal 2, TrendCounter.where(:trend_id => trend_id).length
      assert_difference('Trend.count', -1) do
        as_admin do
          trend.destroy
        end
      end
      assert_equal 0, TrendCounter.where(:trend_id => trend_id).length
    end

    test '#find hosts returns empty result if associated record does not exist' do
      trend = FactoryBot.build(:foreman_statistics_foreman_trend)
      assert_empty trend.find_hosts
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_statistics-2.1.0 test/models/foreman_statistics/trend_test.rb
foreman_statistics-2.0.1 test/models/foreman_statistics/trend_test.rb
foreman_statistics-2.0.0 test/models/foreman_statistics/trend_test.rb
foreman_statistics-1.2.0 test/models/foreman_statistics/trend_test.rb
foreman_statistics-1.1.1 test/models/foreman_statistics/trend_test.rb
foreman_statistics-1.1.0 test/models/foreman_statistics/trend_test.rb