Sha256: 4826c534afda876a877ba69a820af2922955d57a22fc93597b2350211d97fc3b

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

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')
    described_class.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 be(:check)
  end

  it 'returns the instance name' do
    expect(described_class.name).to be(:check)
  end

  it 'enables and disables the check' do
    expect(described_class.enabled?).to be(true)
    described_class.enabled = false
    expect(described_class.enabled?).to be(false)
    described_class.enabled = true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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