Sha256: b8ff4536bca2cbce7405c50eb58d4ea385fca623aa5c16e5d7dba100f661a4d1

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe "organizations" do
  let(:client) { create_client }
  it_should_behave_like "a resource",
    :organizations,
    lambda { {name: Zendesk2.uuid} },
    lambda { {name: Zendesk2.uuid} }

  describe "with an organization" do
    let(:organization) { client.organizations.create(name: Zendesk2.uuid) }
    it "should get #users" do
      user = client.users.create(email: "#{Zendesk2.uuid}@example.org", name: Zendesk2.uuid, organization: organization)
      organization.users.should include user
    end

    it "should get #tickets" do
      user = client.users.create(email: "#{Zendesk2.uuid}@example.org", name: Zendesk2.uuid, organization: organization)
      ticket = client.tickets.create(subject: "#{Zendesk2.uuid}@example.org", description: Zendesk2.uuid, requester: user)
      organization.tickets.should include ticket
    end

    it "should hate non-unique names" do
      lambda { client.organizations.create!(name: organization.name) }.should raise_exception(Zendesk2::Error)
      model = client.organizations.create(name: organization.name)
      model.errors.should == {"name" => ["Name: has already been taken"]}
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zendesk2-0.1.1 spec/organizations_spec.rb
zendesk2-0.1.0 spec/organizations_spec.rb
zendesk2-0.0.23 spec/organizations_spec.rb
zendesk2-0.0.22 spec/organizations_spec.rb
zendesk2-0.0.20 spec/organizations_spec.rb
zendesk2-0.0.19 spec/organizations_spec.rb