Sha256: 2db1981399f0e4937e33255f487dc45b7c548d202312928c44bfb784d9d27171

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

require 'test_helper'

class CheckResultTest < ChilloutTestCase
  def test_successful_for_response_with_200_code
    response = stub(code: "200")
    check_result = CheckResult.new(response)
    assert check_result.successful?
  end

  def test_not_successful_for_response_with_other_code
    response = stub(code: "304")
    check_result = CheckResult.new(response)
    refute check_result.successful?
  end

  def test_not_successful_for_response_that_dont_respond_to_code
    response = stub
    check_result = CheckResult.new(response)
    refute check_result.successful?
  end

  def test_dont_have_problem_with_authorization_for_response_with_200_code
    response = stub(code: "200")
    check_result = CheckResult.new(response)
    refute check_result.has_problem_with_authorization?
  end

  def test_have_problem_with_authorization_for_response_with_401_code
    response = stub(code: "401")
    check_result = CheckResult.new(response)
    assert check_result.has_problem_with_authorization?
  end

  def test_dont_have_problem_with_authorization_for_response_with_other_code
    response = stub(code: "501")
    check_result = CheckResult.new(response)
    refute check_result.has_problem_with_authorization?
  end

  def test_dont_have_problem_with_authorization_for_response_that_dont_respond_to_code
    response = stub
    check_result = CheckResult.new(response)
    refute check_result.has_problem_with_authorization?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chillout-0.4.0 test/check_result_test.rb