File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ require "rails_helper"
2
+
3
+ RSpec . describe "Topics" , type : :system do
4
+ it "displays the topics and provides navigation links" do
5
+ Page . upsert_from_sitepress! ( limit : 3 )
6
+
7
+ expect ( Page . count ) . to eq ( 3 )
8
+
9
+ Page . find_each do |model |
10
+ model . topics = FactoryBot . create_list ( :topic , 2 , :approved )
11
+ model . save!
12
+ end
13
+
14
+ visit topics_path
15
+
16
+ expect ( page ) . to have_content ( "Topics" )
17
+
18
+ Topic . approved . find_each do |topic |
19
+ expect ( page ) . to have_link ( topic . name , href : topic_path ( topic ) )
20
+ end
21
+
22
+ topic = Topic . first
23
+
24
+ click_link topic . name
25
+
26
+ expect ( page ) . to have_content ( topic . name )
27
+
28
+ topic . pages . each do |model |
29
+ expect ( page ) . to have_link ( model . title , href : model . request_path )
30
+ end
31
+ end
32
+ end
You can’t perform that action at this time.
0 commit comments