fixed the email from header issues and backfilled few tests
This commit is contained in:
parent
f8a030d761
commit
7fd7fa968c
5 changed files with 48 additions and 7 deletions
|
|
@ -167,7 +167,7 @@ test:
|
|||
pod_url: "http://localhost:9887"
|
||||
socket_port: 8081
|
||||
enable_splunk_logging: false
|
||||
open_invitations: false
|
||||
open_invitations: true
|
||||
|
||||
|
||||
integration_1:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,17 @@ Devise.setup do |config|
|
|||
# (bson_ext recommended) and :data_mapper (experimental).
|
||||
require 'devise/orm/active_record'
|
||||
|
||||
#mail setup
|
||||
if AppConfig[:smtp_sender_address]
|
||||
config.mailer_sender = AppConfig[:smtp_sender_address]
|
||||
else
|
||||
unless Rails.env == 'test'
|
||||
Rails.logger.warn("No smtp sender address set, mail may fail.")
|
||||
puts "WARNING: No smtp sender address set, mail may fail."
|
||||
end
|
||||
config.mailer_sender = "please-change-me@config-initializers-devise.com"
|
||||
end
|
||||
|
||||
# Configure the class responsible to send e-mails.
|
||||
config.mailer = "DiasporaDeviseMailer"
|
||||
|
||||
|
|
|
|||
|
|
@ -48,3 +48,10 @@ Feature: invitation acceptance
|
|||
When I follow "Finished"
|
||||
Then I should be on the aspects page
|
||||
|
||||
Scenario: sends an invitation
|
||||
Given a user with email "bob@bob.bob"
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I follow "By email"
|
||||
And I fill in "user_email" with "alex@example.com"
|
||||
And I press "Send an invitation"
|
||||
Then I should have 1 Devise email delivery
|
||||
|
|
|
|||
|
|
@ -150,6 +150,11 @@ And /^I follow the "([^\"]*)" link from the last sent email$/ do |link_text|
|
|||
visit URI::parse(path).request_uri
|
||||
end
|
||||
|
||||
Then /^I should have (\d+) Devise email delivery$/ do |n|
|
||||
Devise.mailer.deliveries.length.should == n.to_i
|
||||
end
|
||||
|
||||
|
||||
When /^"([^\"]+)" has posted a status message with a photo$/ do |email|
|
||||
user = User.find_for_database_authentication(:username => email)
|
||||
post = Factory(:status_message_with_photo, :text => "Look at this dog", :author => user.person)
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ describe Invitation do
|
|||
end
|
||||
|
||||
it 'generate the invitation token and pass it to the user' do
|
||||
|
||||
pending
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -100,17 +100,35 @@ describe Invitation do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#resend' do
|
||||
describe 'send' do
|
||||
before do
|
||||
@invitation = Factory(:invitation, :sender => alice, :aspect => alice.aspects.first, :service => 'email', :identifier => 'a@a.com')
|
||||
end
|
||||
|
||||
it 'sends an email' do
|
||||
lambda {
|
||||
@invitation.send!
|
||||
}.should change(Devise.mailer.deliveries, :count).by(1)
|
||||
end
|
||||
|
||||
it 'sends an email with from header' do
|
||||
@invitation.send!
|
||||
Devise.mailer.deliveries.first.from.should_not be_blank
|
||||
end
|
||||
|
||||
it 'sends an email with from header' do
|
||||
@invitation.send!
|
||||
Devise.mailer.deliveries.first.to.should == ["a@a.com"]
|
||||
end
|
||||
|
||||
context "re-send" do
|
||||
it 'sends another email' do
|
||||
lambda {
|
||||
@invitation.resend
|
||||
}.should change(Devise.mailer.deliveries, :count).by(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#recipient_identifier' do
|
||||
it 'calls email if the invitation_service is email' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue