Skip to content

Commit e365c12

Browse files
committed
Fix spec/system/topics/search_spec.rb tests
The test checking that no dropdown menu is present when a user only has 1 provider was previously passing erroneously: it was checking that no provider select menu was present before the Topics page was loaded, so it only confirmed that that dropdown menu was not on the "Dashbaord" page. I had to tweak some tests because: - It is also no longer possible for a contributor to have no providers. - we now automatically associate 1 provider to the user in the factory, so the set up for "with 1 associated provider" was incorrect.
1 parent 8bf7593 commit e365c12

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

spec/system/topics/search_spec.rb

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,21 +183,9 @@
183183
context "when the user is a contributor" do
184184
let(:user) { create(:user) }
185185

186-
context "with no associated providers" do
187-
before { click_link("Topics") }
188-
189-
it "shows no topics" do
190-
expect(page).to have_link("Add New Topic")
191-
expect(page).not_to have_text(english_active_topic.title)
192-
expect(page).not_to have_text(spanish_active_topic.title)
193-
expect(page).not_to have_text(english_archived_topic.title)
194-
expect(page).not_to have_text(other_provider_topic.title)
195-
end
196-
end
197-
198186
context "with 1 associated provider" do
199187
before do
200-
user.providers << provider_1
188+
user.update(provider_ids: [ provider_1.id ])
201189
click_link("Topics")
202190
end
203191

@@ -316,7 +304,7 @@
316304

317305
context "with multiple associated providers" do
318306
before do
319-
user.providers << [ provider_1, provider_2 ]
307+
user.update(provider_ids: [ provider_1.id, provider_2.id ])
320308
click_link("Topics")
321309
end
322310

0 commit comments

Comments
 (0)