Sha256: 99a70e6e1fbbbf9e866e4e368c21a53594283524da8289c72b1a4238619fc929

Contents?: true

Size: 793 Bytes

Versions: 5

Compression:

Stored size: 793 Bytes

Contents

require 'test_helper'

class RedisWriteableCheckTest < ActiveSupport::TestCase

  test "#run sets success conditions on successful run" do
    Redis.any_instance.stubs(:set).returns("OK")
    check = create_check
    results = check.check

    assert_equal("Writeable", results[1])
    assert_equal(true, results[0])
  end

  test "#run sets failure conditions on a failed run" do
    Redis.any_instance.stubs(:set).raises(Redis::ConnectionError.new)
    check = create_check
    results = check.check

    assert_equal("Read Only", results[1])
    assert_equal(false, results[0])
  end

  private
  def create_check
    # Get us a config hash from disk in this case
    Easymon::RedisWriteableCheck.new(YAML.load_file(Rails.root.join("config/redis.yml"))[Rails.env].symbolize_keys)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
easymon-1.6.3 test/unit/checks/redis_writeable_check_test.rb
easymon-1.6.2 test/unit/checks/redis_writeable_check_test.rb
easymon-1.6.1 test/unit/checks/redis_writeable_check_test.rb
easymon-1.5 test/unit/checks/redis_writeable_check_test.rb
easymon-1.6.0 test/unit/checks/redis_writeable_check_test.rb