generated from dxw/rails-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test spec for case with category and without category
- Loading branch information
1 parent
783ba69
commit 41f0e46
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,58 @@ | |
|
||
expect(find("#complete-evaluation-4-status")).to have_text("Complete") | ||
end | ||
|
||
context "without sub_category" do | ||
it "sends support email" do | ||
support_case.update!(evaluation_due_date: Date.tomorrow, has_uploaded_documents: true, category_id: nil) | ||
support_case.evaluators.create!(first_name: "Momo", last_name: "Taro", email: "email@address") | ||
document_uploader.save! | ||
create(:support_email_template, title: "Invitation to complete procurement evaluation", subject: "about energy", body: "Test body {{sub_category}} ") | ||
support_case.reload | ||
|
||
visit support_case_path(support_case, anchor: "tasklist") | ||
|
||
expect(find("#complete-evaluation-4-status")).to have_text("To do") | ||
|
||
visit edit_support_case_email_evaluators_path(support_case) | ||
|
||
expect(page).not_to have_content("an Audit Accessibility (buildings and digital)") | ||
expect(page).to have_content("[sub_category]") | ||
|
||
create(:support_email, :inbox, ticket: support_case, outlook_conversation_id: "OCID1", subject: "Email Evaluators", recipients: [{ "name" => "Test 1", "address" => "[email protected]" }], unique_body: "Email 1", is_read: false) | ||
support_case.update!(sent_email_to_evaluators: true) | ||
|
||
visit support_case_path(support_case, anchor: "tasklist") | ||
|
||
expect(find("#complete-evaluation-4-status")).to have_text("Complete") | ||
end | ||
end | ||
|
||
context "with sub_category" do | ||
let(:support_case) { create(:support_case, :with_support_category) } | ||
|
||
it "sends support email" do | ||
support_case.update!(evaluation_due_date: Date.tomorrow, has_uploaded_documents: true) | ||
support_case.evaluators.create!(first_name: "Momo", last_name: "Taro", email: "email@address") | ||
document_uploader.save! | ||
create(:support_email_template, title: "Invitation to complete procurement evaluation", subject: "about energy", body: "Test body {{sub_category}} ") | ||
support_case.reload | ||
|
||
visit support_case_path(support_case, anchor: "tasklist") | ||
|
||
expect(find("#complete-evaluation-4-status")).to have_text("To do") | ||
|
||
visit edit_support_case_email_evaluators_path(support_case) | ||
|
||
expect(page).to have_content("an Audit Accessibility (buildings and digital)") | ||
expect(page).not_to have_content("[sub_category]") | ||
|
||
create(:support_email, :inbox, ticket: support_case, outlook_conversation_id: "OCID1", subject: "Email Evaluators", recipients: [{ "name" => "Test 1", "address" => "[email protected]" }], unique_body: "Email 1", is_read: false) | ||
support_case.update!(sent_email_to_evaluators: true) | ||
|
||
visit support_case_path(support_case, anchor: "tasklist") | ||
|
||
expect(find("#complete-evaluation-4-status")).to have_text("Complete") | ||
end | ||
end | ||
end |