Skip to content

Commit

Permalink
moved private classes in spec to private area
Browse files Browse the repository at this point in the history
  • Loading branch information
Janell-Huyck committed Oct 6, 2023
1 parent 1f9dbf2 commit 5116789
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions spec/mailers/previews/publication_mailer_preview.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# frozen_string_literal: true


# The PublicationMailerPreview class is used to preview email templates for the PublicationMailer.
# It fetches a real Submitter and Publication from the database if they exist; otherwise, it uses mock objects.
# This is especially useful for visually testing email layouts and contents in the development environment.
#
# Preview all emails at http://localhost:3000/rails/mailers/publication_mailer
class PublicationMailerPreview < ActionMailer::Preview
def publication_submit
submitter = Submitter.first || mock_submitter
publication = OtherPublication.last || mock_publication

PublicationMailer.publication_submit(submitter, publication)
end

private


# MockSubmitter serves as a stand-in for the Submitter model during testing.
# It mimics the interface of the real Submitter model, providing the minimum
# methods and attributes needed for the PublicationMailerPreview.
Expand All @@ -26,20 +43,6 @@ def initialize(work_title:, author_first_name:, author_last_name:)
end
end

# The PublicationMailerPreview class is used to preview email templates for the PublicationMailer.
# It fetches a real Submitter and Publication from the database if they exist; otherwise, it uses mock objects.
# This is especially useful for visually testing email layouts and contents in the development environment.
#
# Preview all emails at http://localhost:3000/rails/mailers/publication_mailer
class PublicationMailerPreview < ActionMailer::Preview
def publication_submit
submitter = Submitter.first || mock_submitter
publication = OtherPublication.last || mock_publication

PublicationMailer.publication_submit(submitter, publication)
end

private

def mock_submitter
MockSubmitter.new(
Expand Down

0 comments on commit 5116789

Please sign in to comment.