main
 1require 'spec_helper'
 2
 3describe Urkel do
 4  it 'has a version number' do
 5    expect(Urkel::VERSION).not_to be nil
 6  end
 7
 8  describe ".oops" do
 9    let(:error) { StandardError.new("Ooops... did i do that?") }
10
11    it 'publishes a new error' do
12      stub_request(:post, "http://localhost:3000/api/v1/failures").to_return(status: 200)
13      Urkel.configure do |configuration|
14        configuration.api_host = 'http://localhost:3000'
15        configuration.api_key = '02513a35-b875-40a1-a1fc-f2d2582bdcc5'
16      end
17      expect(Urkel.oops(error)).to be_truthy
18    end
19
20    it 'raises an error when not configured' do
21      Urkel.reset
22      expect(-> { Urkel.oops(error) }).to raise_error(Urkel::InvalidConfigurationError)
23    end
24  end
25end