Sha256: 6607cb586f70aecfc90b1aaef6c31eb0c3b880c35e21f7534d98ec88ad7c529c

Contents?: true

Size: 830 Bytes

Versions: 1

Compression:

Stored size: 830 Bytes

Contents

require 'spec_helper'

describe 'posting a list delivery', :integration do
  let(:template_name) { :test }
  let(:list_name)     { :customers }
  let(:payload)       { { :message => "Are you ok?" } }

  before do
    Mailstro.configure do |config|
      config.api_key = 'lolapi'
    end
  end

  let(:expected_body) {{
    "api_key"       => "lolapi",
    "template_name" => "test",
    "list_name"     => "customers",
    "payload"       => { "message" => "Are you ok?" }
  }}

  it "succesfully submits a list delivery to mailstro" do
    stub_request(:post, "https://api.mailstroapp.com/v1/lists/deliveries").
    with(:body => expected_body).to_return(:status => 200, :body => fixture("response.json"))

    response = Mailstro.list_deliver(template_name, list_name, payload)

    response[:success].should == true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mailstro-0.0.5 spec/integration/list_delivery_spec.rb