Sha256: 15822927395459b6acad6a5f2b8c1dba5d88f7b353f34aabe66935f51f17b8f3

Contents?: true

Size: 1.64 KB

Versions: 7

Compression:

Stored size: 1.64 KB

Contents

require "spec_helper"

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

  describe ".create_organization", :vcr do
    it "creates a new organization" do
      organization = @client.create_organization "testOrg"
      expect(organization).to be_kind_of(Object)
      expect(organization.name).to eq("testOrg")

      assert_requested :post, bugsnag_url("/organizations")
    end
  end

  context "with organization", :vcr do
    before do
      @organization = @client.create_organization "testOrg"
    end

    describe ".organization", :vcr do
      it "returns the requested organization" do
        organization = @client.organization @organization.id
        expect(organization.id).to eq(@organization.id)

        assert_requested :get, bugsnag_url("/organizations/#{@organization.id}")
      end
    end

    describe ".update_organization", :vcr do
      it "updates and returns the organization" do
        updatedOrg = @client.update_organization @organization.id, "updated_name", false, {:invoice_address => "test_string"}
        expect(updatedOrg.id).to eq(@organization.id)
        expect(updatedOrg.name).to eq("updated_name")
        expect(updatedOrg.auto_upgrade).to be false

        assert_requested :patch, bugsnag_url("/organizations/#{@organization.id}")
      end
    end

    describe ".delete_organization", :vcr do
      it "deletes the organization" do
        deletedOrg = @client.delete_organization @organization.id
        expect(deletedOrg).to be true
      
        assert_requested :delete, bugsnag_url("/organizations/#{@organization.id}")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bugsnag-api-3.0.0 spec/bugsnag/api/client/organizations_spec.rb
bugsnag-api-2.1.1 spec/bugsnag/api/client/organizations_spec.rb
bugsnag-api-2.1.0 spec/bugsnag/api/client/organizations_spec.rb
bugsnag-api-2.0.3 spec/bugsnag/api/client/organizations_spec.rb
bugsnag-api-2.0.2 spec/bugsnag/api/client/organizations_spec.rb
bugsnag-api-2.0.1 spec/bugsnag/api/client/organizations_spec.rb
bugsnag-api-2.0.0 spec/bugsnag/api/client/organizations_spec.rb