Sha256: 08abc0fc4836abb61bd96dab3aba45fecedb37d09309cf9b1bf5a73a11267970

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe SiteInspector::Endpoint::Check do
  subject do
    stub_request(:head, 'http://example.com/').to_return(status: 200)
    endpoint = SiteInspector::Endpoint.new('http://example.com')
    SiteInspector::Endpoint::Check.new(endpoint)
  end

  it 'returns the endpoint' do
    expect(subject.endpoint.class).to eql(SiteInspector::Endpoint)
  end

  it 'returns the response' do
    expect(subject.response.class).to eql(Typhoeus::Response)
  end

  it 'returns the request' do
    expect(subject.request.class).to eql(Typhoeus::Request)
  end

  it 'returns the host' do
    expect(subject.host).to eql('example.com')
  end

  it 'returns its name' do
    expect(subject.name).to eql(:check)
  end

  it 'returns the instance name' do
    expect(SiteInspector::Endpoint::Check.name).to eql(:check)
  end

  it 'enables and disables the check' do
    expect(SiteInspector::Endpoint::Check.enabled?).to eql(true)
    SiteInspector::Endpoint::Check.enabled = false
    expect(SiteInspector::Endpoint::Check.enabled?).to eql(false)
    SiteInspector::Endpoint::Check.enabled = true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
site-inspector-3.1.1 spec/checks/site_inspector_endpoint_check_spec.rb