Sha256: 135f703bb5af5ce3d2aaf4acc9fdec20ec8eeee6b0cdfc3b55064fcc8011d8f2

Contents?: true

Size: 1.52 KB

Versions: 6

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe Voog::API::Tickets do

  let(:client) { voog_client }

  describe '#tickets' do
    before do
      request_fixture(:get, 'forms/1/tickets', fixture: 'tickets/tickets')
    end

    it 'returns a list of tickets' do
      expect(client.tickets(1).length).to eql(2)
    end
  end

  describe '#ticket' do
    before do
      request_fixture(:get, 'forms/1/tickets/1', fixture: 'tickets/ticket')
    end

    it 'returns a single ticket' do
      expect(client.ticket(1, 1).user_country).to eq('us')
    end

    it 'returns a ticket with the same id as in the request' do
      expect(client.ticket(1, 1).id).to eq(1)
    end
  end

  describe '#delete_ticket' do

    before do
      request_fixture(:delete, 'forms/1/tickets/2')
    end

    it 'calls delete method on ticket' do
      client.delete_ticket(1, 2)
      assert_requested :delete, 'http://voog.test/admin/api/forms/1/tickets/2'
    end
  end

  describe '#delete_spam_tickets' do

    before do
      request_fixture(:delete, 'forms/1/tickets/delete_spam')
    end

    it 'calls delete_spam method on ticket' do
      client.delete_spam_tickets(1)
      assert_requested :delete, 'http://voog.test/admin/api/forms/1/tickets/delete_spam'
    end
  end

  describe '#delete_tickets' do

    before do
      request_fixture(:delete, 'forms/1/tickets/delete_tickets')
    end

    it 'calls delete method on ticket' do
      client.delete_tickets(1)
      assert_requested :delete, 'http://voog.test/admin/api/forms/1/tickets/delete_tickets'
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
voog_api-0.0.16 spec/voog_api/api/tickets_spec.rb
voog_api-0.0.15 spec/voog_api/api/tickets_spec.rb
voog_api-0.0.14 spec/voog_api/api/tickets_spec.rb
voog_api-0.0.13 spec/voog_api/api/tickets_spec.rb
voog_api-0.0.12 spec/voog_api/api/tickets_spec.rb
voog_api-0.0.11 spec/voog_api/api/tickets_spec.rb