Sha256: fbf219c6acf9a341a6490dc0f71d280471914d69af161643b2aec366e3f59794

Contents?: true

Size: 1.27 KB

Versions: 241

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Appsignal::AuthCheck do
  let(:config) { project_fixture_config }
  let(:logger) { Logger.new(StringIO.new) }
  let(:auth_check) { Appsignal::AuthCheck.new(config, logger) }

  describe "#perform_with_result" do
    it "should give success message" do
      auth_check.should_receive(:perform).and_return('200')
      auth_check.perform_with_result.should ==
        ['200', 'AppSignal has confirmed authorization!']
    end

    it "should give 401 message" do
      auth_check.should_receive(:perform).and_return('401')
      auth_check.perform_with_result.should ==
        ['401', 'API key not valid with AppSignal...']
    end

    it "should give an error message" do
      auth_check.should_receive(:perform).and_return('402')
      auth_check.perform_with_result.should ==
        ['402', 'Could not confirm authorization: 402']
    end
  end

  context "transmitting" do
    before do
      @transmitter = double
      Appsignal::Transmitter.should_receive(:new).with(
        'auth',
        kind_of(Appsignal::Config)
      ).and_return(@transmitter)
    end

    describe "#perform" do
      it "should not transmit any extra data" do
        @transmitter.should_receive(:transmit).with({}).and_return({})
        auth_check.perform
      end
    end
  end
end

Version data entries

241 entries across 241 versions & 1 rubygems

Version Path
appsignal-1.0.6.beta.2 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.1.0.beta.8 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.6.beta.1 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.5 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.1.0.beta.7 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.5.beta.4 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.5.beta.3 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.5.beta.2 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.5.beta.1 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.4 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.1.0.beta.6 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.3 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.3.beta.2 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.3.beta.1 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.1.0.beta.5 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.1.0.beta.4 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.1.0.beta.3 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.1.0.beta.2 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.1.0.beta.1 spec/lib/appsignal/auth_check_spec.rb
appsignal-1.0.2 spec/lib/appsignal/auth_check_spec.rb