pushing mailer spec for ilya

This commit is contained in:
maxwell 2010-11-18 15:36:30 -08:00
parent cb23fd495b
commit 747ab761a0
3 changed files with 25 additions and 1 deletions

View file

@ -14,7 +14,7 @@ module RakeHelpers
backer_name = backers[n+offset][0].to_s.strip
backer_email = backers[n+offset][1].to_s.gsub('.ksr', '').strip
puts "sending email to: #{backer_name} #{backer_email}"
Invitation.create_invitee(:email => backer_email, :name => backer_name, :invites => 5)
Invitation.create_invitee(:email => backer_email, :name => backer_name, :invites => 5) unless User.find_by_email(backer_email)
end
churn_through
end

4
spec/fixtures/test.csv vendored Normal file
View file

@ -0,0 +1,4 @@
Backer,Email,
maxwell salzberg, mbs348@foo.com
billy mcgee, billy@foo.com
big foo, bar@moms.com
1 Backer,Email,
2 maxwell salzberg, mbs348@foo.com
3 billy mcgee, billy@foo.com
4 big foo, bar@moms.com

View file

@ -0,0 +1,20 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
require File.join(Rails.root, 'lib/rake_helpers.rb')
describe RakeHelpers do
before do
@csv = File.join(Rails.root, 'spec/fixtures/test.csv')
end
describe '#process_emails' do
it 'should send emails to each backer' do
pending
Invitation.should_receive(:create_invitee).exactly(3).times
RakeHelpers::process_emails(@csv, 100, 0)
end
end
end