Skip to content

Commit

Permalink
Refs #37587 - add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylenz committed Sep 3, 2024
1 parent d5cefc8 commit 5d2577f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/controllers/api/v2/api_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ def test_scoped_search_full_results_false
assert_equal(2, response[:results].length)
end

def test_scoped_search_casts_to_integer
params = { full_result: 'false', page: '1', per_page: '2' }
@controller.stubs(:params).returns(params)

response = @controller.scoped_search(@query, @default_sort[0], @default_sort[1], @options)
refute_empty response[:results], "results"
assert_nil response[:error], "error"
assert_equal 1, response[:page], "page"
assert_kind_of(Integer, response[:page])
assert_equal 2, response[:per_page], "per page"
assert_kind_of(Integer, response[:per_page])
assert_equal(2, response[:results].length)
end

def test_scoped_search_no_results
params = { :search => "asdfasdf" }
@controller.stubs(:params).returns(params)
Expand Down

0 comments on commit 5d2577f

Please sign in to comment.