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"
|
pod_url: "http://localhost:9887"
|
||||||
socket_port: 8081
|
socket_port: 8081
|
||||||
enable_splunk_logging: false
|
enable_splunk_logging: false
|
||||||
open_invitations: false
|
open_invitations: true
|
||||||
|
|
||||||
|
|
||||||
integration_1:
|
integration_1:
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,17 @@ Devise.setup do |config|
|
||||||
# (bson_ext recommended) and :data_mapper (experimental).
|
# (bson_ext recommended) and :data_mapper (experimental).
|
||||||
require 'devise/orm/active_record'
|
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.
|
# Configure the class responsible to send e-mails.
|
||||||
config.mailer = "DiasporaDeviseMailer"
|
config.mailer = "DiasporaDeviseMailer"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,3 +48,10 @@ Feature: invitation acceptance
|
||||||
When I follow "Finished"
|
When I follow "Finished"
|
||||||
Then I should be on the aspects page
|
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
|
visit URI::parse(path).request_uri
|
||||||
end
|
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|
|
When /^"([^\"]+)" has posted a status message with a photo$/ do |email|
|
||||||
user = User.find_for_database_authentication(:username => email)
|
user = User.find_for_database_authentication(:username => email)
|
||||||
post = Factory(:status_message_with_photo, :text => "Look at this dog", :author => user.person)
|
post = Factory(:status_message_with_photo, :text => "Look at this dog", :author => user.person)
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ describe Invitation do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'generate the invitation token and pass it to the user' do
|
it 'generate the invitation token and pass it to the user' do
|
||||||
|
pending
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -100,15 +100,33 @@ describe Invitation do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#resend' do
|
describe 'send' do
|
||||||
before do
|
before do
|
||||||
@invitation = Factory(:invitation, :sender => alice, :aspect => alice.aspects.first, :service => 'email', :identifier => 'a@a.com')
|
@invitation = Factory(:invitation, :sender => alice, :aspect => alice.aspects.first, :service => 'email', :identifier => 'a@a.com')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sends another email' do
|
it 'sends an email' do
|
||||||
lambda {
|
lambda {
|
||||||
@invitation.resend
|
@invitation.send!
|
||||||
}.should change(Devise.mailer.deliveries, :count).by(1)
|
}.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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue