Skip to content

Commit

Permalink
Functional Tests for Ordering aphabetically (publiclab#6371)
Browse files Browse the repository at this point in the history
* test ordering of tags

* test that wikis are ordered alphabetically based on title

* Fix failing test on wiki test
  • Loading branch information
StlMaris123 authored and nstjean committed Nov 2, 2019
1 parent 46f9a08 commit 3bacc02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions test/functional/tag_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ def setup
assert_template 'tag/index'
end

test 'tags in asc order' do
get :index, params: {sort: 'name', order: 'asc' }
assert :success
assert assigns(:tags).each_cons(2).all?{|i,j| j.name >= i.name}
end

test 'tags in desc order' do
get :index, params: {sort: 'name', order: 'desc' }
assert :success
assert assigns(:tags).each_cons(2).all?{|i,j| j.name <= i.name}
end

test 'tag show' do
get :show, params: { id: tags(:spectrometer).name }

Expand Down
4 changes: 2 additions & 2 deletions test/functional/wiki_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def teardown
end

test 'should get wiki index in alphabetical order' do
get :index, params: { order: 'alphabetic' }
get :index, params: { sort: 'title' }

assert_response :success
assert_not_nil :wikis
assert assigns(:wikis).each_cons(2).all?{|i,j| "j.node_revisions.title" >= "i.node_revisions.title" }
end

test 'should get wiki stale pages' do
Expand Down

0 comments on commit 3bacc02

Please sign in to comment.