File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 36
36
< div class ="article-content container " itemprop ="articleBody ">
37
37
<%= yield %>
38
38
</ div >
39
- <% if @page . topics . any? %>
39
+ <% if @page . topics . approved . any? %>
40
40
< section id ="article-topics " class ="section-content container ">
41
- <%= render Pages ::Topics . new ( topics : @page . topics . pluck ( :slug ) ) %>
41
+ <%= render Pages ::Topics . new ( topics : @page . topics . approved . pluck ( :slug ) ) %>
42
42
</ section >
43
43
<% end %>
44
44
</ article >
Original file line number Diff line number Diff line change 12
12
13
13
article = Page . first
14
14
article . topics << FactoryBot . create_list ( :topic , 2 , :approved )
15
+ article . topics << FactoryBot . create_list ( :topic , 1 , :pending )
16
+ article . topics << FactoryBot . create_list ( :topic , 1 , :rejected )
15
17
article . save!
16
18
17
19
visit "/articles"
22
24
expect ( page ) . to have_content ( article . title )
23
25
end
24
26
25
- expect ( article . topics . count ) . to eq ( 2 )
27
+ expect ( article . topics . count ) . to eq ( 4 )
28
+ expect ( article . topics . approved . count ) . to eq ( 2 )
26
29
27
- article . topics . each do |topic |
30
+ article . topics . approved . each do |topic |
28
31
expect ( page ) . to have_link ( "##{ topic . slug } " , href : topic_path ( topic ) )
29
32
end
33
+ ( article . topics . rejected + article . topics . pending ) . each do |topic |
34
+ expect ( page ) . not_to have_link ( "##{ topic . slug } " , href : topic_path ( topic ) )
35
+ end
30
36
31
37
first_topic = article . topics . first
32
38
click_link "##{ first_topic . slug } "
You can’t perform that action at this time.
0 commit comments