Sha256: b96a593455ef7b64af5aafc567fab78e4437ae757283f1605ef3064c9cdbacbe

Contents?: true

Size: 1.19 KB

Versions: 17

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'
require 'mailgun'

vcr_opts = { :cassette_name => "bounces" }

describe 'For the Bounces endpoint', order: :defined, vcr: vcr_opts do
  before(:all) do
    @mg_obj = Mailgun::Client.new(APIKEY, APIHOST, APIVERSION, SSL)
    @domain = TESTDOMAIN
    @email = "integration-test-email@#{TESTDOMAIN}"
  end

  it 'creates a bounce' do
    @result = @mg_obj.post("#{@domain}/bounces",
                           {:address => @email,
                            :code => 550,
                            :error => "Integration Test"})

    @result.to_h!
    expect(@result.body["message"]).to eq("Address has been added to the bounces table")
    expect(@result.body["address"]).to eq(@email)
  end

  it 'get a bounce.' do
    result = @mg_obj.get("#{@domain}/bounces/#{@email}")

    result.to_h!
    expect(result.body["code"]).to eq("550")
    expect(result.body["address"]).to eq(@email)
    expect(result.body["error"]).to eq("Integration Test")
  end

  it 'gets a list of bounces.' do
    result = @mg_obj.get("#{@domain}/bounces")

    result.to_h!
    expect(result.body["items"].length).to be > 0
  end

  it 'deletes a bounce' do
    @mg_obj.delete("#{@domain}/bounces/#{@email}")
  end

end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
mailgun-ruby-1.2.6 spec/integration/bounces_spec.rb
mailgun-ruby-1.2.5 spec/integration/bounces_spec.rb
mailgun-ruby-1.2.4 spec/integration/bounces_spec.rb
mailgun-ruby-1.2.3 spec/integration/bounces_spec.rb
mailgun-ruby-1.2.0 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.11 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.10 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.9 spec/integration/bounces_spec.rb
wj-mailgun-ruby-1.1.7 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.8 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.6 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.5 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.4 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.3 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.2 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.1 spec/integration/bounces_spec.rb
mailgun-ruby-1.1.0 spec/integration/bounces_spec.rb