Sha256: 628dbc4e3965e19fb72bb1301c658eab33333a518afa3c2a5b4ecd3174132e98

Contents?: true

Size: 737 Bytes

Versions: 2

Compression:

Stored size: 737 Bytes

Contents

require 'spec_helper'

describe 'posting a subscription to a list', :integration do
  let(:list_name)     { :test }
  let(:contact_email) { "test@example.com" }

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

  let(:expected_body) {{
    "api_key"       => "lolapi",
    "list_name"     => "test",
    "contact_email" => "test@example.com",
  }}

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

    response = Mailstro.list_subscribe(list_name, contact_email)
    response['success'].should == true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mailstro-0.0.6 spec/integration/list_subscribe_spec.rb
mailstro-0.0.5 spec/integration/list_subscribe_spec.rb