Skip to content

Commit 83f0ad7

Browse files
Moved tests that didn't rely on javascript to requests
1 parent 1b18256 commit 83f0ad7

4 files changed

Lines changed: 38 additions & 64 deletions

File tree

spec/requests/organization_requests_spec.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@
123123
expect(html.text).to include("Logo")
124124
expect(html.text).to include("Use one-step Partner invite and approve process?")
125125
expect(html.text).to include("Receive email when Partner makes a Request?")
126+
expect(html.text).not_to include("Your next reminder date is ")
127+
expect(html.text).not_to include("The deadline on your next reminder email will be ")
126128
end
127129

128130
it "displays the correct organization details" do
@@ -153,6 +155,31 @@
153155
end
154156
end
155157

158+
context "with a reminder schedule" do
159+
before do
160+
travel_to Time.zone.local(2020, 10, 10)
161+
valid_reminder_schedule = ReminderScheduleService.new({
162+
by_month_or_week: "day_of_month",
163+
every_nth_month: 1,
164+
day_of_month: 20
165+
}).to_ical
166+
organization.update(reminder_schedule_definition: valid_reminder_schedule)
167+
end
168+
169+
it "reports the next date a reminder email will be sent" do
170+
get organization_path
171+
expect(response.body).to include "Your next reminder date is Tue Oct 20 2020."
172+
expect(response.body).not_to include "The deadline on your next reminder email will be Sun Oct 25 2020."
173+
end
174+
175+
it "reports the deadline date that will be included in the next reminder email" do
176+
organization.update(deadline_day: 25)
177+
get organization_path
178+
expect(response.body).to include "Your next reminder date is Tue Oct 20 2020."
179+
expect(response.body).to include "The deadline on your next reminder email will be Sun Oct 25 2020."
180+
end
181+
end
182+
156183
it "cannot see 'Demote to User' button for admins" do
157184
expect(response.body).to_not include "Demote to User"
158185
end

spec/requests/partners_requests_spec.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@
1616
context "html" do
1717
let(:response_format) { 'html' }
1818

19-
let!(:partner) { create(:partner, organization: organization) }
19+
let!(:partner) { create(:partner, organization: organization, name: "Partner One") }
2020

21-
it { is_expected.to be_successful }
21+
it {
22+
is_expected.to be_successful
23+
expect(response.body).to include "Partner One"
24+
expect(response.body).not_to include "Your next reminder date is Tue Oct 20 2020."
25+
expect(response.body).not_to include "The deadline on your next reminder email will be Sun Oct 25 2020."
26+
}
2227

2328
include_examples "restricts access to organization users/admins"
2429
end

spec/system/organization_system_spec.rb

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -50,53 +50,6 @@
5050
sign_in(organization_admin)
5151
end
5252

53-
describe "Viewing the organization" do
54-
it "can view organization details", :aggregate_failures do
55-
organization.update!(one_step_partner_invite: true)
56-
57-
visit organization_path
58-
59-
expect(page.find("h1")).to have_text(organization.name)
60-
expect(page).to have_link("Home", href: dashboard_path)
61-
62-
expect(page).to have_content("Basic information")
63-
expect(page).to have_content("Storage")
64-
expect(page).to have_content("Partner approval process")
65-
expect(page).to have_content("What kind of Requests can approved Partners make?")
66-
expect(page).to have_content("Other emails")
67-
expect(page).to have_content("Printing")
68-
expect(page).to have_content("Annual Survey")
69-
70-
expect(page).not_to have_content("Your next reminder date is ")
71-
expect(page).not_to have_content("The deadline on your next reminder email will be ")
72-
end
73-
74-
context "with a reminder schedule" do
75-
before do
76-
travel_to Time.zone.local(2020, 10, 10)
77-
valid_reminder_schedule = ReminderScheduleService.new({
78-
by_month_or_week: "day_of_month",
79-
every_nth_month: 1,
80-
day_of_month: 20
81-
}).to_ical
82-
organization.update(reminder_schedule_definition: valid_reminder_schedule)
83-
end
84-
85-
it "reports the next date a reminder email will be sent" do
86-
visit organization_path
87-
expect(page).to have_content("Your next reminder date is Tue Oct 20 2020.")
88-
expect(page).not_to have_content("The deadline on your next reminder email will be Sun Oct 25 2020.")
89-
end
90-
91-
it "reports the deadline date that will be included in the next reminder email" do
92-
organization.update(deadline_day: 25)
93-
visit organization_path
94-
expect(page).to have_content("Your next reminder date is Tue Oct 20 2020.")
95-
expect(page).to have_content("The deadline on your next reminder email will be Sun Oct 25 2020.")
96-
end
97-
end
98-
end
99-
10053
describe "Editing the organization" do
10154
let(:partner) { create(:partner, organization: organization) }
10255

spec/system/partner_system_spec.rb

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -612,29 +612,18 @@
612612
sign_in(user)
613613
end
614614

615-
let!(:item_category_1) { create(:item_category, name: "Category One", organization: organization) }
616-
let!(:item_category_2) { create(:item_category, name: "Category Two", organization: organization) }
615+
let!(:item_category_1) { create(:item_category, organization: organization) }
616+
let!(:item_category_2) { create(:item_category, organization: organization) }
617617
let!(:items_in_category_1) { create_list(:item, 3, item_category_id: item_category_1.id) }
618618
let!(:items_in_category_2) { create_list(:item, 3, item_category_id: item_category_2.id) }
619619

620620
describe 'viewing the partner groups' do
621-
let!(:partner_group_1) { create(:partner_group, name: "Group One", organization: organization) }
622-
let!(:partner_1) { create(:partner, name: "Partner One", partner_group: partner_group_1) }
621+
let!(:partner_group_1) { create(:partner_group, organization: organization) }
622+
let!(:partner_1) { create(:partner, partner_group: partner_group_1) }
623623
before do
624624
partner_group_1.item_categories << item_category_1
625625
end
626626

627-
it "shows the name, member partners, and item categories" do
628-
visit partners_path
629-
click_on 'Groups'
630-
expect(page).to have_content("Group One")
631-
expect(page).to have_content("Partner One")
632-
expect(page).to have_content("Category One")
633-
634-
expect(page).not_to have_content("Your next reminder date is Tue Oct 20 2020.")
635-
expect(page).not_to have_content("The deadline on your next reminder email will be Sun Oct 25 2020.")
636-
end
637-
638627
context "with a reminder schedule" do
639628
before do
640629
travel_to Time.zone.local(2020, 10, 10)

0 commit comments

Comments
 (0)