Module: BeyondTheApiTestHelpers::Request::IndexAssertions
- Defined in:
- lib/beyond_the_api_test_helpers/request/index_assertions.rb
Instance Method Summary collapse
- #assert_request_index_not_found(urls_not_found, options = {}) ⇒ Object
- #assert_request_index_paginated(url, params = {}) ⇒ Object
- #assert_request_index_total_count(url, options = {}) ⇒ Object
- #assert_request_index_valid(url, options = {}) ⇒ Object
- #assert_request_index_with_filters(url, filters, params = {}) ⇒ Object
Instance Method Details
#assert_request_index_not_found(urls_not_found, options = {}) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/beyond_the_api_test_helpers/request/index_assertions.rb', line 43 def assert_request_index_not_found(urls_not_found, = {}) request_instance_variables_set @headers.merge!(logged_in_headers) if required_login urls_not_found.each do |url_not_found| assert_request_index_not_found_i18n_all(url_not_found) end end |
#assert_request_index_paginated(url, params = {}) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/beyond_the_api_test_helpers/request/index_assertions.rb', line 25 def assert_request_index_paginated(url, params = {}) request_instance_variables_set_pluralize params @headers.merge!(logged_in_headers) if required_login get(url, params: @params.merge(page: 1, per_page: 1, total_pages: true), headers: @headers) assert_equal 1, json_response_name.size assert_kind_of Integer, ['total_pages'] end |
#assert_request_index_total_count(url, options = {}) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/beyond_the_api_test_helpers/request/index_assertions.rb', line 18 def assert_request_index_total_count(url, = {}) request_instance_variables_set_pluralize @headers.merge!(logged_in_headers) if required_login get(url, params: @params.merge(total_count: true), headers: @headers) assert_kind_of Integer, ['total_count'] end |
#assert_request_index_valid(url, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/beyond_the_api_test_helpers/request/index_assertions.rb', line 4 def assert_request_index_valid(url, = {}) request_instance_variables_set_pluralize if required_login assert_request_needs_to_be_logged(url, :get) @headers.merge!(logged_in_headers) end get(url, params: @params, headers: @headers) response_assertions(status: 200) assert_kind_of Array, json_response_name assert_request_index_should_include if @should_include || @should_not_include end |
#assert_request_index_with_filters(url, filters, params = {}) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/beyond_the_api_test_helpers/request/index_assertions.rb', line 34 def assert_request_index_with_filters(url, filters, params = {}) request_instance_variables_set_pluralize params @headers.merge!(logged_in_headers) if required_login filters.each do |key, | assert_request_index_filter(url, key, ) end end |