This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
87 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
class CommentsMailer < ApplicationMailer | ||
helper :playbacks | ||
|
||
def new_comment(comment) | ||
def new_comment(comment, playback) | ||
@comment = comment | ||
@playback = playback | ||
|
||
subject = "New comment from #{@comment.author}" | ||
mail(to: 'hello@wearecast.org.uk', subject: subject) | ||
mail(to: @playback.email, bcc: 'designhops@wearecast.org.uk', subject: subject) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
FactoryBot.define do | ||
factory :playback do | ||
organisation_name { 'ACME' } | ||
email { 'test@wearecast.co.uk' } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
require 'test_helper' | ||
|
||
class CommentsMailerTest < ActionMailer::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
setup do | ||
@playback = create(:playback) | ||
@comment = create(:comment) | ||
end | ||
|
||
test 'new_comment' do | ||
mail = CommentsMailer.new_comment(@comment, @playback) | ||
assert_equal('New comment from John Doe', mail.subject) | ||
assert_equal([@playback.email], mail.to) | ||
assert_equal(['designhops@wearecast.org.uk'], mail.from) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'application_system_test_case' | ||
|
||
class CommentsTest < ApplicationSystemTestCase | ||
|
||
setup do | ||
@user = create(:user) | ||
|
||
end | ||
|
||
test 'send email when comment created' do | ||
visit new_playback_path | ||
sign_in | ||
|
||
fill_in(:playback_organisation_name, with: 'ACME') | ||
|
||
click_link('Add Section') | ||
fill_in('Section name', with: 'Discover') | ||
|
||
click_button('Create Playback') | ||
|
||
click_on 'Ask for help' | ||
|
||
fill_in('Author', with: 'Author') | ||
find('trix-editor').click.set('Test') | ||
|
||
click_on 'Comment' | ||
|
||
assert(ActionMailer::Base.deliveries.count == 1) | ||
|
||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters