Sha256: 8e5f8a6596c3c72a6e0a488dabb7e4e78133b36a8de1e1a6053d269df2663f9f

Contents?: true

Size: 993 Bytes

Versions: 2

Compression:

Stored size: 993 Bytes

Contents

require 'spec_helper'

describe 'posting a list delivery', :integration do
  let(:template_name) { :build_failure }
  let(:list_type)     { :build_watchers }
  let(:list_name)     { 12 }
  let(:template_data) { { :commit => "Ooops" } }

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

  let(:expected_body) {{
    "api_key"       => "lolapi",
    "template_name" => "build_failure",
    "list_type"     => "build_watchers",
    "list_name"      => 12,
    "template_data" => { "commit" => "Ooops" }
  }}

  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.deliver(
      :to            => [list_type, list_name],
      :template_name => template_name,
      :template_data => template_data
    )

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mailstro-0.0.8 spec/integration/list_delivery_spec.rb
mailstro-0.0.7 spec/integration/list_delivery_spec.rb