Skip to content

Commit bd8bf74

Browse files
committed
added pinned links controller test for the 'filter' param
1 parent 8e0b9fb commit bd8bf74

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

test/controllers/pinned_links_controller_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@
33
class PinnedLinksControllerTest < ActionController::TestCase
44
include Devise::Test::ControllerHelpers
55

6+
test ':index should correctly filter byt activity status' do
7+
sign_in users(:moderator)
8+
9+
get :index, params: { filter: 'all' }
10+
assert_response(:success)
11+
assert assigns(:links).any?
12+
13+
get :index, params: { filter: 'inactive' }
14+
@links = assigns(:links)
15+
16+
assert_response(:success)
17+
assert @links.any?
18+
assert @links.none?(&:active?)
19+
end
20+
621
test 'only mods or higher should be able to see pinned links' do
722
users.each do |user|
823
sign_in user

0 commit comments

Comments
 (0)