Class: Snapshots::MailController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Snapshots::MailController
- Defined in:
- app/controllers/snapshot_inspector/snapshots/mail_controller.rb
Instance Method Summary collapse
Instance Method Details
#raw ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/snapshot_inspector/snapshots/mail_controller.rb', line 19 def raw @snapshot = Snapshot.find(params[:slug]) @email = @snapshot. part_type = Mime::Type.lookup(params[:part] || "text/html") if (part = find_part(part_type)) response.content_type = part_type render plain: part.respond_to?(:decoded) ? part.decoded : part else raise AbstractController::ActionNotFound, "Email part `#{part_type}` not found in a snapshot #{@snapshot.context.test_case_name}##{@snapshot.context.method_name}" end end |
#show ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/snapshot_inspector/snapshots/mail_controller.rb', line 7 def show @snapshot = Snapshot.find(params[:slug]) @email = @snapshot. if params[:format] == "eml" send_data @email.to_s, filename: "#{@snapshot.mailer_name}##{@snapshot.action_name}.eml" else @part = find_preferred_part(request.format, Mime[:html], Mime[:text]) render :show, formats: [:html] end end |