diff options
Diffstat (limited to 'spec/mailers/notifier_spec.rb')
-rw-r--r-- | spec/mailers/notifier_spec.rb | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index a8abde338..872530e9b 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -121,10 +121,6 @@ describe Notifier, type: :mailer do it "has the post text in the body" do expect(@mail.body.encoded).to include(@post.text) end - - it "should not include translation fallback" do - expect(@mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared") - end end describe ".mentioned_in_comment" do @@ -180,10 +176,6 @@ describe Notifier, type: :mailer do it "has the post text not in the body" do expect(@mail.body.encoded).not_to include(@post.text) end - - it "should not include translation fallback" do - expect(@mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared") - end end describe ".liked" do @@ -205,10 +197,6 @@ describe Notifier, type: :mailer do expect(@mail.body.encoded).to include(@like.author.name) end - it "should not include translation fallback" do - expect(@mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared") - end - it "can handle a reshare" do reshare = FactoryGirl.create(:reshare) like = reshare.likes.create!(author: bob.person) @@ -247,10 +235,6 @@ describe Notifier, type: :mailer do it "BODY: contains the name of person liking" do expect(@mail.body.encoded).to include(@reshare.author.name) end - - it "should not include translation fallback" do - expect(@mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared") - end end describe ".private_message" do @@ -294,10 +278,6 @@ describe Notifier, type: :mailer do it "BODY: does not contain the message text" do expect(@mail.body.encoded).not_to include(@cnv.messages.first.text) end - - it "should not include translation fallback" do - expect(@mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared") - end end context "comments" do @@ -334,10 +314,6 @@ describe Notifier, type: :mailer do it "contains the original post's link with comment anchor" do expect(comment_mail.body.encoded).to include("#{comment.post.id}##{comment.guid}") end - - it "should not include translation fallback" do - expect(comment_mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared") - end end [:reshare].each do |post_type| @@ -380,10 +356,6 @@ describe Notifier, type: :mailer do it "contains the original post's link with comment anchor" do expect(comment_mail.body.encoded).to include("#{comment.post.id}##{comment.guid}") end - - it "should not include translation fallback" do - expect(comment_mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared") - end end [:reshare].each do |post_type| context post_type.to_s do @@ -490,10 +462,6 @@ describe Notifier, type: :mailer do it "BODY: contains the name of person liking" do expect(mail.body.encoded).to include(bob.name) end - - it "should not include translation fallback" do - expect(mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared") - end end end @@ -548,7 +516,7 @@ describe Notifier, type: :mailer do end it "has the inviter id if the name is nil" do - bob.person.profile.update_attributes(first_name: "", last_name: "") + bob.person.profile.update(first_name: "", last_name: "") mail = Notifier.invite(alice.email, bob, "1234", "en") expect(email.body.encoded).to_not include("#{bob.name} (#{bob.diaspora_handle})") expect(mail.body.encoded).to include(bob.person.diaspora_handle) @@ -580,16 +548,16 @@ describe Notifier, type: :mailer do it "has some informative text in the body" do email.body.parts.each do |part| - expect(part.decoded).to include("https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)") + expect(part.decoded).to include("https://owasp.org/www-community/attacks/csrf") end end end describe "hashtags" do it "escapes hashtags" do - mails = Notifier.admin("#Welcome to bureaucracy!", [bob]) - expect(mails.length).to eq(1) - mail = mails.first + status = FactoryGirl.create(:status_message, author: alice.person, text: "#Welcome to bureaucracy!", public: true) + like = status.likes.create!(author: bob.person) + mail = Notifier.send_notification("liked", alice.id, like.author.id, like.id) expect(mail.body.encoded).to match( "<p><a href=\"#{AppConfig.url_to(tag_path('welcome'))}\">#Welcome</a> to bureaucracy!</p>" ) @@ -605,7 +573,7 @@ describe Notifier, type: :mailer do end it "FROM: header should be 'pod_name (username)' when there is no first and last name" do - bob.person.profile.update_attributes(first_name: "", last_name: "") + bob.person.profile.update(first_name: "", last_name: "") mail = Notifier.send_notification("started_sharing", alice.id, bob.person.id) expect(mail["From"].to_s).to eq("\"#{pod_name} (#{bob.person.username})\" <#{AppConfig.mail.sender_address}>") end |