Sha256: 658378d02409ecebf89fdf63bba6732bf279185569cb31ba2a0d915782fcdade

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
voog_api-0.0.10 spec/voog_api/api/tickets_spec.rb
voog_api-0.0.7 spec/voog_api/api/tickets_spec.rb