docbrown/spec/mailers/devise_mailer_spec.rb
Julianna Tetreault ca6ba1af7d
Replace collective_noun with community_name (#11846) [deploy]
* Removes collective_noun and collective_noun_disabled from app

* Config Generalization: replaces community_qualified_name with community_name
  - Generalizes SiteConfig after the removal of collective_noun field
  - Updates copy where necessary to be readable with community_name
  - Makes the community_name SiteConfig description more explicit
  - Adds flexibility for Admins by removing appended "community"

* Adds a data_update script to remove collective_noun and collective_noun_disabled

* Removes appended community from stories_controller.rb

* Removes unnecessary quotation marks around SiteConfig.community_name.to_s

* Makes SiteConfig community_name description more explicit

* Removes topic from #email_from and replaces arg with _

* Removes argument from #email_from (facepalm)

* Reverts changes to application_mailer and notify_mailer_spec

* Removes default "Community" topic from application_mailer and makes topic optional

* Refactors #prepopulate_new_form to resolve Code Climate failures

* Refactors #email_from even further by use of a ternary operator per review suggestion

* Simplifies the data_update script used to remove collective_noun per review request

* Adds a data_update script to append community to community_name

* Updates data_update script to correctly append Community to community_name

* Removes RemoveCollectiveNounFromConfig and updates other script

* Removes superfluous false from data_update script

* Updates data_update script to be more idiomatic
2020-12-28 09:34:17 -07:00

22 lines
649 B
Ruby

require "rails_helper"
RSpec.describe DeviseMailer, type: :mailer do
let(:user) { create(:user) }
describe "#reset_password_instructions" do
let(:email) { described_class.reset_password_instructions(user, "test") }
before do
allow(SiteConfig).to receive(:app_domain).and_return("funky-one-of-a-kind-domain-#{rand(100)}.com")
end
it "renders sender" do
expected_from = "#{SiteConfig.community_name} <#{SiteConfig.email_addresses[:default]}>"
expect(email["from"].value).to eq(expected_from)
end
it "renders proper URL" do
expect(email.to_s).to include(SiteConfig.app_domain)
end
end
end