Sha256: 80f4afde0bddfe5757701d5abc58c6d13c02087718d3c47af2d0252badb944ea

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe "tickets" do
  let(:client) { create_client }
  it_should_behave_like "a resource", 
    :tickets,
    lambda { {subject: Zendesk2.uuid, description: Zendesk2.uuid} },
    lambda { {subject: Zendesk2.uuid} }

  describe "with a created ticket" do
    let(:ticket) { client.tickets.create(subject: Zendesk2.uuid, description: Zendesk2.uuid) }
    it "should get requester" do
      ticket.requester.should == client.users.current
    end

    it "should get submitter" do
      ticket.submitter.should == client.users.current
    end
  end

  describe "comments" do
    let(:ticket) { client.tickets.create(subject: Zendesk2.uuid, description: Zendesk2.uuid) }
    before(:each) { client.data[:ticket_audits] = {} }

    it "lists audits" do
      ticket.audits.size.should == 0
      client.data[:ticket_audits][1] = {'ticket_id' => ticket.id}
      ticket.audits.size.should == 1
    end

    it "lists comments" do
      ticket.comments.size.should == 0
      client.data[:ticket_audits][2] = {'ticket_id' => ticket.id, 'events' => [{'type' => 'Comment'}]}
      client.data[:ticket_audits][3] = {'ticket_id' => ticket.id, 'events' => [{'type' => 'Change'}]}
      ticket.comments.size.should == 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zendesk2-0.0.23 spec/tickets_spec.rb