Sha256: 1502a3f8102ad5309c75a3738acfe40a9b08a65ed6179ef38d199c3e4ea70b02

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 KB

Contents

require 'test_helper'

class ActsAsMonitorTest < ActiveSupport::TestCase
  test "Methods exists!" do
    @test_class = TestClass.new
    assert TestClass.respond_to?(:acts_as_monitor), "acts_as_monitor missing!"
    assert @test_class.respond_to?(:status), "status missing!"
    assert @test_class.respond_to?(:status_flag), "status_flag missing!"
  end
  
  test "Status ok" do
    @test_class = TestClass.new()
    assert @test_class.status == {:warn => [], :error => []} , "Error: #{@test_class.status.inspect}"
    assert @test_class.status_flag == :green , "Error: #{@test_class.status_flag.inspect}"
  end
  
  test "Status warn" do
    @test_class = TestClass.new(:warn => true)
    assert @test_class.status == {:warn => [:warn_test ], :error => []} , "Error: #{@test_class.status.inspect}"
    assert @test_class.status_flag == :yellow , "Error: #{@test_class.status_flag.inspect}"
  end
  
  test "Status error" do
    @test_class = TestClass.new(:error => true)
    assert @test_class.status == {:warn => [], :error => [:error_test ]}, "Error: #{@test_class.status.inspect}"
    assert @test_class.status_flag == :red , "Error: #{@test_class.status_flag.inspect}"
  end
  
  test "Status error & warn " do
    @test_class = TestClass.new(:error => true, :warn => true)
    assert @test_class.status == {:warn => [:warn_test ], :error => [:error_test ]}, "Error: #{@test_class.status.inspect}"
    assert @test_class.status_flag == :red , "Error: #{@test_class.status_flag.inspect}"
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_monitor-0.0.9 test/acts_as_monitor_test.rb