|
1 | 1 | require "rails_helper" |
2 | 2 |
|
3 | 3 | RSpec.describe "followups/resolve", :js, type: :system do |
4 | | - include ActiveJob::TestHelper |
5 | | - |
6 | 4 | let(:casa_org) { create(:casa_org) } |
7 | 5 | let(:admin) { create(:casa_admin, casa_org: casa_org) } |
8 | 6 | let(:supervisor) { build(:supervisor, casa_org: casa_org) } |
|
13 | 11 | let(:case_contact) { build(:case_contact, casa_case: casa_case, creator: cc_creator) } |
14 | 12 | let!(:followup) { create(:followup, case_contact: case_contact, creator: followup_creator) } |
15 | 13 |
|
| 14 | + before { sign_in admin } |
| 15 | + |
16 | 16 | it "changes status of followup to resolved" do |
17 | | - sign_in admin |
18 | 17 | visit casa_case_path(case_contact.casa_case) |
19 | 18 |
|
20 | | - perform_enqueued_jobs { click_button "Resolve Reminder" } |
| 19 | + click_button "Resolve Reminder" |
| 20 | + expect(page).to have_button("Make Reminder") |
21 | 21 |
|
22 | 22 | expect(case_contact.followups.count).to eq(1) |
23 | 23 | expect(case_contact.followups.first.resolved?).to be_truthy |
|
27 | 27 | let(:cc_creator) { volunteer } |
28 | 28 | let(:followup_creator) { volunteer } |
29 | 29 |
|
30 | | - xit "changes status of followup to resolved" do # TODO make test not flaky |
31 | | - sign_in admin |
| 30 | + before { sign_in admin } |
| 31 | + |
| 32 | + it "changes status of followup to resolved" do # TODO make test not flaky |
32 | 33 | visit casa_case_path(case_contact.casa_case) |
33 | 34 |
|
34 | 35 | click_button "Resolve Reminder" |
| 36 | + expect(page).to have_button("Make Reminder") |
35 | 37 |
|
36 | 38 | expect(case_contact.followups.count).to eq(1) |
37 | 39 | expect(case_contact.followups.first.resolved?).to be_truthy |
|
41 | 43 | sign_in admin |
42 | 44 | visit casa_case_path(case_contact.casa_case) |
43 | 45 |
|
44 | | - perform_enqueued_jobs { click_button "Resolve Reminder" } |
| 46 | + click_button "Resolve Reminder" |
| 47 | + expect(page).to have_button("Make Reminder") |
45 | 48 |
|
46 | 49 | expect(page).to have_button("Make Reminder") |
47 | 50 | end |
|
51 | 54 | let(:cc_creator) { supervisor } |
52 | 55 | let(:followup_creator) { volunteer } |
53 | 56 |
|
| 57 | + before { sign_in supervisor } |
| 58 | + |
54 | 59 | it "changes status of followup to resolved" do |
55 | | - sign_in supervisor |
56 | 60 | visit casa_case_path(case_contact.casa_case) |
57 | 61 |
|
58 | | - perform_enqueued_jobs { click_button "Resolve Reminder" } |
| 62 | + click_button "Resolve Reminder" |
| 63 | + expect(page).to have_button("Make Reminder") |
59 | 64 |
|
60 | 65 | expect(case_contact.followups.count).to eq(1) |
61 | 66 | expect(case_contact.followups.first.resolved?).to be_truthy |
|
68 | 73 |
|
69 | 74 | before do |
70 | 75 | case_contact.casa_case.assigned_volunteers << volunteer |
| 76 | + sign_in volunteer |
71 | 77 | end |
72 | 78 |
|
73 | 79 | it "changes status of followup to resolved" do |
74 | | - sign_in volunteer |
75 | 80 | visit case_contacts_path |
76 | 81 |
|
77 | | - perform_enqueued_jobs { click_button "Resolve Reminder" } |
| 82 | + click_button "Resolve Reminder" |
| 83 | + expect(page).to have_button("Make Reminder") |
78 | 84 |
|
79 | 85 | expect(case_contact.followups.count).to eq(1) |
80 | 86 | expect(case_contact.followups.first.resolved?).to be_truthy |
|
0 commit comments