diff --git a/spec/mailers/maintenance_spec.rb b/spec/mailers/maintenance_spec.rb index 1ca07c513..d333e5db1 100644 --- a/spec/mailers/maintenance_spec.rb +++ b/spec/mailers/maintenance_spec.rb @@ -8,15 +8,15 @@ describe Maintenance, :type => :mailer do describe 'create warning' do before do @removal_timestamp = Time.now + 3.days - @user = FactoryGirl.create(:user_with_aspect, :username => "local", :remove_after => @removal_timestamp) + @user = FactoryGirl.create(:user_with_aspect, :username => "local", :remove_after => @removal_timestamp) end - + it "#should deliver successfully" do expect { Maintenance.account_removal_warning(@user).deliver }.to_not raise_error end - + it "#should be added to the delivery queue" do expect { Maintenance.account_removal_warning(@user).deliver @@ -27,15 +27,15 @@ describe Maintenance, :type => :mailer do Maintenance.account_removal_warning(@user).deliver expect(ActionMailer::Base.deliveries.last.to[0]).to include(@user.email) end - + it "#should include after inactivity days from settings" do Maintenance.account_removal_warning(@user).deliver - expect(ActionMailer::Base.deliveries.last.body.parts[0].body.raw_source).to include("more than "+AppConfig.settings.maintenance.remove_old_users.after_days.to_s+" days") + expect(ActionMailer::Base.deliveries.last.body.parts[0].body.raw_source).to include("for #{AppConfig.settings.maintenance.remove_old_users.after_days} days") end - + it "#should include timestamp for account removal" do Maintenance.account_removal_warning(@user).deliver - expect(ActionMailer::Base.deliveries.last.body.parts[0].body.raw_source).to include("logging into the account before "+@removal_timestamp.utc.to_s) + expect(ActionMailer::Base.deliveries.last.body.parts[0].body.raw_source).to include("sign in to your account before #{@removal_timestamp.utc}") end end end