7 changed files with 7 additions and 28 deletions
@ -1,11 +0,0 @@ |
|||||||
class ErrorSummaryFullMessagesPresenter |
|
||||||
def initialize(error_messages) |
|
||||||
@error_messages = error_messages |
|
||||||
end |
|
||||||
|
|
||||||
def formatted_error_messages |
|
||||||
@error_messages.map do |attribute, messages| |
|
||||||
[attribute, [attribute.to_s.humanize, messages.first].join(" ")] |
|
||||||
end |
|
||||||
end |
|
||||||
end |
|
@ -1,12 +0,0 @@ |
|||||||
require "rails_helper" |
|
||||||
|
|
||||||
RSpec.describe ErrorSummaryFullMessagesPresenter do |
|
||||||
subject(:error_summary_presenter) { described_class.new(error_messages) } |
|
||||||
|
|
||||||
let(:error_messages) { { reset_password_token: %w[expired] } } |
|
||||||
let(:formatted_error_messages) { [[:reset_password_token, "Reset password token expired"]] } |
|
||||||
|
|
||||||
it "formats messages to include the attribute name" do |
|
||||||
expect(error_summary_presenter.formatted_error_messages).to eq(formatted_error_messages) |
|
||||||
end |
|
||||||
end |
|
Loading…
Reference in new issue