Skip to content

Commit

Permalink
fixed rspec test failures and rubocop by updating seed data which get…
Browse files Browse the repository at this point in the history
…s loaded on each run
  • Loading branch information
ArushC committed Feb 20, 2024
1 parent 870491a commit c231e07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/mailers/teacher_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def welcome_email(teacher)
@teacher = teacher
set_body
set_recipients
mail to: @recipients, #ActionMailer accepts comma-separated lists of emails
mail to: @recipients, # ActionMailer accepts comma-separated lists of emails
cc: CONTACT_EMAIL,
subject: email_template.subject
end
Expand Down Expand Up @@ -61,14 +61,13 @@ def email_template
@email_template ||= EmailTemplate.find_by(title: action_name.titlecase)
end

#renders the email body with the {{parameter}} things
# renders the email body with the {{parameter}} things
def set_body
@body = Liquid::Template.parse(email_template.body).render(liquid_assigns).html_safe
end

#renders the list of recipients with the {{parameter}} things
# renders the list of recipients with the {{parameter}} things
def set_recipients
@recipients = Liquid::Template.parse(email_template.to).render(liquid_assigns).html_safe
end

end
6 changes: 6 additions & 0 deletions db/seed_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ module SeedData
DENY_EMAIL3

@to_field = "{{teacher_email}}, {{teacher_personal_email}}"

def self.emails
[
{
to: @to_field,
body: @welcome_email,
path: "teacher_mailer/welcome_email",
locale: nil,
Expand All @@ -73,6 +76,7 @@ def self.emails
subject: "Welcome to The Beauty and Joy of Computing!"
},
{
to: @to_field,
body: @form_submission,
path: "teacher_mailer/form_submission",
locale: nil,
Expand All @@ -84,6 +88,7 @@ def self.emails
subject: "Form Submission"
},
{
to: @to_field,
body: @deny_email,
path: "teacher_mailer/deny_email",
locale: nil,
Expand All @@ -95,6 +100,7 @@ def self.emails
subject: "Deny Email"
},
{
to: @to_field,
body: @basic_email_with_reason,
path: "teacher_mailer/request_info_email",
locale: nil,
Expand Down

0 comments on commit c231e07

Please sign in to comment.