Sha256: 7eef3e3ffed9736aa9576870edb39b94456890ee4d6322f47d7d7f3d49940b63

Contents?: true

Size: 754 Bytes

Versions: 3

Compression:

Stored size: 754 Bytes

Contents

require 'spec_helper'
require 'mailgun'
require 'mailgun/events/events'

vcr_opts = { :cassette_name => "events" }

describe 'For the Events endpoint', vcr: vcr_opts do
  before(:all) do
    @mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
    @domain = TESTDOMAIN
    @events = Mailgun::Events.new(@mg_obj, @domain)
  end

  it 'can get an event.' do
    result = @mg_obj.get("#{@domain}/events", {:limit => 1})

    result.to_h!
    expect(result.body["items"].length).to be_within(1).of(1)
    expect(result.body["paging"]).to include("next")
    expect(result.body["paging"]).to include("previous")
  end

  it 'can iterate over all events with `each`' do
    @events.each do |e|
      expect(e).to have_key('event')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mailgun-ruby-1.2.16 spec/integration/events_spec.rb
mailgun-ruby-1.2.15 spec/integration/events_spec.rb
mailgun-ruby-1.2.14 spec/integration/events_spec.rb