Skip to content

Commit

Permalink
assorted fixes 11
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantk committed Oct 19, 2023
1 parent f47d88a commit d818b67
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let(:file) { fixture_file_upload(Rails.root.join("spec/fixtures/support/text-file.txt"), "text/plain") }

before do
create(:support_email_attachment, file:, email: create(:support_email, :inbox, case: support_case))
create(:support_email_attachment, file:, email: create(:support_email, :inbox, ticket: support_case))
end

it "adds a custom name and description to the attachment", js: true do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe "Agent can download attachments", js: true do
include_context "with an agent"

let(:email) { create(:support_email, :inbox, case: support_case, unique_body: "Catering requirements") }
let(:email) { create(:support_email, :inbox, ticket: support_case, unique_body: "Catering requirements") }
let(:support_case) { create(:support_case) }

before do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
include_context "with an agent"

let(:is_read) { true }
let(:email) { create(:support_email, :inbox, case: support_case, subject: "Catering requirements", is_read:) }
let(:email) { create(:support_email, :inbox, ticket: support_case, subject: "Catering requirements", is_read:) }
let(:support_case) { create(:support_case) }

before do
Expand Down
4 changes: 2 additions & 2 deletions spec/features/support/emails/agent_sees_email_threads_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

context "when messages accross multiple threads exist" do
before do
create(:support_email, :inbox, case: support_case, outlook_conversation_id: "OCID1", subject: "Email thread 1", recipients: [{ "name" => "Test 1", "address" => "[email protected]" }], unique_body: "Email 1", is_read: false)
create(:support_email, :inbox, case: support_case, outlook_conversation_id: "OCID2", subject: "Email thread 2", recipients: [{ "name" => "Test 2", "address" => "[email protected]" }], unique_body: "Email 2", is_read: true)
create(:support_email, :inbox, ticket: support_case, outlook_conversation_id: "OCID1", subject: "Email thread 1", recipients: [{ "name" => "Test 1", "address" => "[email protected]" }], unique_body: "Email 1", is_read: false)
create(:support_email, :inbox, ticket: support_case, outlook_conversation_id: "OCID2", subject: "Email thread 2", recipients: [{ "name" => "Test 2", "address" => "[email protected]" }], unique_body: "Email 2", is_read: true)
create(:support_email, ticket: support_case, outlook_conversation_id: "OCID2", subject: "Re: Email thread 2", unique_body: "Email 3")

visit support_case_path(support_case)
Expand Down
16 changes: 8 additions & 8 deletions spec/requests/support/email_read_status_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
let(:support_case) { create(:support_case, :action_required) }

context "when there are other unread emails in the inbox" do
before { create(:support_email, :inbox, case: support_case, is_read: false) }
before { create(:support_email, :inbox, ticket: support_case, is_read: false) }

specify "then the case remains as action required" do
patch support_email_read_status_path(email, status: "read")
Expand All @@ -25,7 +25,7 @@
end

context "when there are other unread emails in the sent items folder" do
before { create(:support_email, :sent_items, case: support_case, is_read: false) }
before { create(:support_email, :sent_items, ticket: support_case, is_read: false) }

specify "then the case is not longer marked as action required" do
patch support_email_read_status_path(email, status: "read")
Expand All @@ -35,8 +35,8 @@

context "when there are no unread emails in the inbox but there are unread sent items" do
before do
create(:support_email, :inbox, case: support_case, is_read: true)
create(:support_email, :sent_items, case: support_case, is_read: false)
create(:support_email, :inbox, ticket: support_case, is_read: true)
create(:support_email, :sent_items, ticket: support_case, is_read: false)
end

specify "then the case is not longer marked as action required" do
Expand All @@ -60,7 +60,7 @@
let(:support_case) { create(:support_case, action_required: true) }

context "when there are other unread emails in the inbox" do
before { create(:support_email, :inbox, case: support_case, is_read: false) }
before { create(:support_email, :inbox, ticket: support_case, is_read: false) }

specify "then the case remains as action required" do
patch support_email_read_status_path(email, status: "read")
Expand All @@ -69,7 +69,7 @@
end

context "when there are other unread emails in the sent items folder" do
before { create(:support_email, :sent_items, case: support_case, is_read: false) }
before { create(:support_email, :sent_items, ticket: support_case, is_read: false) }

specify "then the case is not longer marked as action required" do
patch support_email_read_status_path(email, status: "read")
Expand All @@ -79,8 +79,8 @@

context "when there are no unread emails in the inbox but there are unread sent items" do
before do
create(:support_email, :inbox, case: support_case, is_read: true)
create(:support_email, :sent_items, case: support_case, is_read: false)
create(:support_email, :inbox, ticket: support_case, is_read: true)
create(:support_email, :sent_items, ticket: support_case, is_read: false)
end

specify "then the case is not longer marked as action required" do
Expand Down
14 changes: 7 additions & 7 deletions spec/support/shared/duplicate_email_attachments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
# same file name, different checksum
let(:file_3) { fixture_file_upload(Rails.root.join("spec/fixtures/text-file.txt"), "text/plain") }

let!(:case_1_attachment_1) { create(:support_email_attachment, file: file_1, email: create(:support_email, :inbox, case: case_1)) }
let!(:case_1_attachment_2) { create(:support_email_attachment, file: file_2, email: create(:support_email, :inbox, case: case_1)) }
let!(:case_1_attachment_3) { create(:support_email_attachment, file: file_2, email: create(:support_email, :inbox, case: case_1)) }
let!(:case_1_attachment_4) { create(:support_email_attachment, file: file_3, email: create(:support_email, :inbox, case: case_1)) }
let!(:case_2_attachment_1) { create(:support_email_attachment, file: file_1, email: create(:support_email, :inbox, case: case_2)) }
let!(:case_2_attachment_2) { create(:support_email_attachment, file: file_1, email: create(:support_email, :inbox, case: case_2)) }
let!(:case_2_attachment_3) { create(:support_email_attachment, file: file_2, email: create(:support_email, :inbox, case: case_2)) }
let!(:case_1_attachment_1) { create(:support_email_attachment, file: file_1, email: create(:support_email, :inbox, ticket: case_1)) }
let!(:case_1_attachment_2) { create(:support_email_attachment, file: file_2, email: create(:support_email, :inbox, ticket: case_1)) }
let!(:case_1_attachment_3) { create(:support_email_attachment, file: file_2, email: create(:support_email, :inbox, ticket: case_1)) }
let!(:case_1_attachment_4) { create(:support_email_attachment, file: file_3, email: create(:support_email, :inbox, ticket: case_1)) }
let!(:case_2_attachment_1) { create(:support_email_attachment, file: file_1, email: create(:support_email, :inbox, ticket: case_2)) }
let!(:case_2_attachment_2) { create(:support_email_attachment, file: file_1, email: create(:support_email, :inbox, ticket: case_2)) }
let!(:case_2_attachment_3) { create(:support_email_attachment, file: file_2, email: create(:support_email, :inbox, ticket: case_2)) }
end

0 comments on commit d818b67

Please sign in to comment.