summaryrefslogtreecommitdiff
path: root/spec/models/sign_up_spec.rb
blob: 1d129837a96c528b3cc55256748605506e04856d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require "spec_helper"

describe SignUp do
  before do
    @sign_up = SignUp.new
  end

  subject { @sign_up }

  it { should respond_to(:email) }

  context :subscribe do
    let(:sign_up) { SignUp.new(email: email) }
    let(:gibbon) { Gibbon.new(ENV['MAILCHIMP_API_KEY']) }
    let(:email) { 'example@parleytool.com' }
    let(:list_id) { ENV['MAILCHIMP_LIST_ID'] }

    before :each do
      sign_up.subscribe
    end

    after :each do
      gibbon.list_unsubscribe(id: list_id, email_address: email)
    end

    it "should subscribe to the mailchimp email list" do
      results = gibbon.lists_for_email(email_address: email)
      results.should include(list_id)
    end
  end
end