Sha256: 839904ea631c6a3bb2427600e6a9a51fc207125407dbe69844bfb8a737649fdd

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

require "spec_helper"

describe Bugsnag::Api::Client::Events do
  before do
    Bugsnag::Api.reset!
    @client = basic_auth_client
  end

  describe ".project_events", :vcr do
    it "returns all events on a project" do
      events = @client.project_events(test_bugsnag_project)
      expect(events).to be_kind_of(Array)
      expect(events.first.context).not_to be_nil

      assert_requested :get, basic_bugsnag_url("/projects/#{test_bugsnag_project}/events")
    end
  end

  describe ".error_events", :vcr do
    it "returns all events on an error" do
      events = @client.error_events(test_bugsnag_error)
      expect(events).to be_kind_of(Array)
      expect(events.first.context).not_to be_nil

      assert_requested :get, basic_bugsnag_url("/errors/#{test_bugsnag_error}/events")
    end
  end

  context "with event", :vcr do
    let(:event_url) { basic_bugsnag_url("/events/#{test_bugsnag_event}") }

    describe ".event" do
      it "returns an event" do
        event = @client.event(test_bugsnag_event)
        expect(event.context).not_to be_nil

        assert_requested :get, event_url
      end
    end

    describe ".delete_event", :vcr do
      it "deletes the event" do
        stub_request(:delete, event_url).to_return(:status => [204, "No Content"])

        response = @client.delete_event(test_bugsnag_event)
        expect(response).to be true

        assert_requested :delete, event_url
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bugsnag-api-1.0.3 spec/bugsnag/api/client/events_spec.rb
bugsnag-api-1.0.2 spec/bugsnag/api/client/events_spec.rb
bugsnag-api-1.0.1 spec/bugsnag/api/client/events_spec.rb