Skip to content

Commit

Permalink
assorted fixes 10
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantk committed Oct 19, 2023
1 parent 39dc2a7 commit f47d88a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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, case: support_case, outlook_conversation_id: "OCID2", subject: "Re: Email thread 2", unique_body: "Email 3")
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)
click_link "Messages"
Expand Down
4 changes: 2 additions & 2 deletions spec/presenters/support/case_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@

describe "#message_threads" do
before do
create(:support_email, case: support_case)
create(:support_email, case: support_case)
create(:support_email, ticket: support_case)
create(:support_email, ticket: support_case)
end

it "returns all the message threads wrapped in a presenter" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ def expected_url(attachment)

describe "#case_reference" do
context "when there is no case" do
let(:email) { create(:support_email, case: nil) }
let(:email) { create(:support_email, ticket: nil) }

it "returns nil" do
expect(presenter.case_reference).to be_nil
end
end

context "when there is a case" do
let(:email) { create(:support_email, case: create(:support_case, ref: "000001")) }
let(:email) { create(:support_email, ticket: create(:support_case, ref: "000001")) }

it "returns the case reference" do
expect(presenter.case_reference).to eq "000001"
Expand All @@ -99,15 +99,15 @@ def expected_url(attachment)

describe "#case_org_name" do
context "when there is no case" do
let(:email) { create(:support_email, case: nil) }
let(:email) { create(:support_email, ticket: nil) }

it "returns nil" do
expect(presenter.case_org_name).to be_nil
end
end

context "when there is a case" do
let(:email) { create(:support_email, case: create(:support_case, organisation: create(:support_organisation, name: "School"))) }
let(:email) { create(:support_email, ticket: create(:support_case, organisation: create(:support_organisation, name: "School"))) }

it "returns the organisation name" do
expect(presenter.case_org_name).to eq "School"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe "Deleting email attachments" do
before { agent_is_signed_in }

let(:attachment) { create(:support_email_attachment, hidden: false, email: create(:support_email, case: support_case)) }
let(:attachment) { create(:support_email_attachment, hidden: false, email: create(:support_email, ticket: support_case)) }
let(:support_case) { create(:support_case) }

it "redirects back to attachments with the attachment now hidden from view" do
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/support/email_read_status_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

context "when marking an email as read" do
let(:support_case) { create(:support_case) }
let!(:email) { create(:support_email, case: support_case) }
let!(:email) { create(:support_email, ticket: support_case) }

it "marks the email as read" do
patch support_email_read_status_path(email, status: "read")
Expand Down Expand Up @@ -49,7 +49,7 @@

context "when marking an email as unread" do
let(:support_case) { create(:support_case) }
let!(:email) { create(:support_email, case: support_case) }
let!(:email) { create(:support_email, ticket: support_case) }

it "marks the email as unread" do
patch support_email_read_status_path(email, status: "unread")
Expand Down

0 comments on commit f47d88a

Please sign in to comment.