Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions spec/system/supervisors/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
context "logged in as an admin" do
let(:user) { create(:casa_admin, casa_org: organization) }

it "can edit supervisor by clicking on the edit link from the supervisors list page", :js do
it "can edit supervisor by clicking on the edit link from the supervisors list page" do
supervisor_name = "Leslie Knope"
create(:supervisor, display_name: supervisor_name, casa_org: organization)
sign_in user
Expand All @@ -22,7 +22,7 @@
expect(page).to have_text("Editing Supervisor")
end

it "can edit supervisor by clicking on the supervisor's name from the supervisors list page", :js do
it "can edit supervisor by clicking on the supervisor's name from the supervisors list page" do
supervisor_name = "Leslie Knope"
create(:supervisor, display_name: supervisor_name, casa_org: organization)
sign_in user
Expand Down Expand Up @@ -84,11 +84,11 @@
visit edit_supervisor_path(supervisor)

dismiss_confirm do
find("a[href='#{deactivate_supervisor_path(supervisor)}']").click
click_link "Deactivate Supervisor"
end

accept_confirm do
find("a[href='#{deactivate_supervisor_path(supervisor)}']").click
click_link "Deactivate Supervisor"
end
expect(page).to have_text("Supervisor was deactivated on")

Expand All @@ -110,7 +110,7 @@
expect(inactive_supervisor.reload).to be_active
end

it "can resend invitation to a supervisor", :js do
it "can resend invitation to a supervisor" do
supervisor = create :supervisor, casa_org: organization

sign_in user
Expand All @@ -126,7 +126,7 @@
expect(deliveries.last.subject).to have_text "CASA Console invitation instructions"
end

it "can convert the supervisor to an admin", :js do
it "can convert the supervisor to an admin" do
supervisor = create(:supervisor, casa_org_id: organization.id)

sign_in user
Expand All @@ -143,7 +143,7 @@
context "logged in as a supervisor" do
let(:supervisor) { create(:supervisor) }

it "can't deactivate a supervisor", :js do
it "can't deactivate a supervisor" do
supervisor2 = create :supervisor, casa_org: organization

sign_in supervisor
Expand Down Expand Up @@ -179,14 +179,14 @@
end

it "sends a confirmation email to the supervisor and displays current email" do
expect(page).to have_text "Supervisor was successfully updated. Confirmation Email Sent."
expect(page).to have_field("Email", with: @old_email)
expect(@supervisor.unconfirmed_email).to eq("new_supervisor_email@example.com")

expect(ActionMailer::Base.deliveries.count).to eq(1)
expect(ActionMailer::Base.deliveries.first).to be_a(Mail::Message)
expect(ActionMailer::Base.deliveries.first.body.encoded)
.to match("Click here to confirm your email")

expect(page).to have_text "Supervisor was successfully updated. Confirmation Email Sent."
expect(page).to have_field("Email", with: @old_email)
expect(@supervisor.unconfirmed_email).to eq("new_supervisor_email@example.com")
end

it "correctly updates the supervisor email once confirmed" do
Expand Down
Loading