Skip to content

Commit

Permalink
Refract test cases for admin
Browse files Browse the repository at this point in the history
  • Loading branch information
perryzjc committed Mar 5, 2024
1 parent df28698 commit 38fca3b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions features/admin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ Feature: basic admin functionality
And I press "❌" on Actions for first teacher
Then the "denial_reason" field should not contain "Test"
And I fill in "denial_reason" with "Denial Reason"
And I capture the email count
And I press "Submit"
Then I can send a deny email
Then I should see a new email sent out
Then I should see dialog box closed

Scenario: Not logged in should not have access to edit
Given the following schools exist:
Expand Down Expand Up @@ -250,9 +253,11 @@ Feature: basic admin functionality
And I press "Cancel"
And I press "❓" on Actions for first teacher
Then the "request_reason" field should not contain "Need more details on qualifications"
And I capture the email count
And I fill in "request_reason" with "Complete your profile details"
And I press "Submit"
Then I can send a request info email
Then I should see a new email sent out
Then I should see dialog box closed

Scenario: Denying teacher without specifying a reason as an admin should not send email
Expand All @@ -273,7 +278,7 @@ Feature: basic admin functionality
And I fill in "denial_reason" with ""
And I press "Submit"
Then I should see dialog box remain open
Then no new emails should have been sent
Then I should not see any new email sent out

Scenario: Requesting more information from a teacher without specifying a reason as an admin should not send email
Given the following schools exist:
Expand All @@ -293,7 +298,7 @@ Feature: basic admin functionality
And I fill in "request_reason" with ""
And I press "Submit"
Then I should see dialog box remain open
Then no new emails should have been sent
Then I should not see any new email sent out

# Scenario: Admin can import csv file. The loader should filter invalid record and create associate school.
# Given the following schools exist:
Expand Down
6 changes: 5 additions & 1 deletion features/step_definitions/admin_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
@initial_email_count = ActionMailer::Base.deliveries.count
end

Then(/no new emails should have been sent/) do
Then(/I should not see any new email sent out/) do
expect(ActionMailer::Base.deliveries.count).to eq @initial_email_count
end

Then(/I should see a new email sent out/) do
expect(ActionMailer::Base.deliveries.count).to eq(@initial_email_count + 1)
end

0 comments on commit 38fca3b

Please sign in to comment.