Sha256: 90ea3c2010fca2c5306c76a8e74f252d2aa6413454b6bbbc5d4daf4bcbfd9762

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

require 'spec_helper'

describe UptimeRobot::Client do
  let(:client) { UptimeRobot::Client.new('abc123') }
  subject { client }

  describe 'attributes' do
    it { should respond_to :api_key }
  end


  describe '#get' do
    context 'when Uptime Robot responds with a good status code' do
      before { RestClient.stub(:get).and_raise(RestClient::Exception) }

      it "should raise UptimeRobot::Exception" do
        expect { client.get('resource') }.to raise_error(UptimeRobot::Exception)
      end
    end

    context 'when Uptime Robot responds with a bad status code' do
      before { RestClient.stub(:get).and_return("{\"foo\":\"bar\",\"baz\":\"qux\"}") }
      subject { client.get('resource') }

      it { should be_a(Hash) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uptime_robot-0.0.1 spec/uptime_robot/client_spec.rb