Skip to content

Commit

Permalink
Convert some flash msgs from notices to warnings
Browse files Browse the repository at this point in the history
- also fix an intermittently failing feature spec
  • Loading branch information
bengolder committed Jun 25, 2020
1 parent 0e48b87 commit 5ea990d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
7 changes: 4 additions & 3 deletions app/assets/stylesheets/organisms/_flash-messages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
border: none;
color: white;
padding: 1.5rem;
a {
color: inherit;
}
}

.flash--notice {
background-color: $color-green;
}

.flash--alert {
background-color: #D70A40;
font-weight: bold;
a {
color: inherit;
}
}
.flash--warning {
background-color: $color-yellow-light;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ class RequestedDocumentsLaterController < DocumentUploadQuestionController

rescue_from ActionController::InvalidAuthenticityToken do
switch_locale do
redirect_to(
root_path,
notice: t("controllers.send_requested_documents_later_controller.not_found")
)
flash[:warning] = t("controllers.send_requested_documents_later_controller.not_found")
redirect_to root_path
end
end

Expand Down Expand Up @@ -81,10 +79,8 @@ def form_class

def current_session_or_home
if session[:documents_request_id].nil?
redirect_to(
root_path,
notice: t("controllers.send_requested_documents_later_controller.not_found")
)
flash[:warning] = t("controllers.send_requested_documents_later_controller.not_found")
redirect_to root_path
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ class SendRequestedDocumentsLaterController < DocumentUploadQuestionController
def edit
documents_request = DocumentsRequest.find_by(id: session[:documents_request_id])
if documents_request.nil?
@flash_message = t("controllers.send_requested_documents_later_controller.not_found")
@flash_warning = t("controllers.send_requested_documents_later_controller.not_found")
else
intake = documents_request.intake
documents_request.documents.update_all(intake_id: intake.id)
SendRequestedDocumentsToZendeskJob.perform_later(intake.id)
@flash_message = t("controllers.send_requested_documents_later_controller.success")
@flash_notice = t("controllers.send_requested_documents_later_controller.success")
end
redirect_to(root_path)
end
Expand All @@ -30,7 +30,8 @@ def self.document_type
end

def add_flash_message
flash[:notice] = @flash_message
flash[:notice] = @flash_notice if @flash_notice.present?
flash[:warning] = @flash_warning if @flash_warning.present?
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
post :update, params: params

expect(response).to redirect_to(root_path(locale: :es))
expect(flash[:notice]).to match("Lo sentimos, no pudimos cargar su documento")
expect(flash[:warning]).to match("Lo sentimos, no pudimos cargar su documento")
end
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/features/web_intake/requested_documents_token_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
expect(page).to have_content("test-pattern.png")
page.accept_confirm { click_link("Remove") }

expect(page).not_to have_content("test-pattern.png")
attach("requested_document_upload_form[document]", Rails.root.join("spec", "fixtures", "attachments", "test-pattern.png"))
click_on "Continue"

Expand Down

0 comments on commit 5ea990d

Please sign in to comment.