From b7541657a47f237ccbb86faecb18623d1c34f3e9 Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 22 Jul 2013 12:04:10 -0600 Subject: allow signups to subscribe to a mailing list --- spec/models/sign_up_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'spec') diff --git a/spec/models/sign_up_spec.rb b/spec/models/sign_up_spec.rb index e43bbf3..0c27680 100644 --- a/spec/models/sign_up_spec.rb +++ b/spec/models/sign_up_spec.rb @@ -8,4 +8,23 @@ describe SignUp do 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' } + + before :each do + sign_up.subscribe + end + + after :each do + gibbon.list_unsubscribe(id: ENV['MAILCHIMP_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(ENV['MAILCHIMP_LIST_ID']) + end + end end -- cgit v1.2.3