Class: ActionController::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/atech/extensions/controller_tests.rb

Instance Method Summary collapse

Instance Method Details

#assert_json(&block) ⇒ Object



6
7
8
9
10
# File 'lib/atech/extensions/controller_tests.rb', line 6

def assert_json(&block)
  decoded_json = ActiveSupport::JSON.decode(@response.body) rescue InvalidJsonObject.new
  assert !decoded_json.is_a?(InvalidJsonObject)
  block.call(decoded_json) if block_given?
end

#assert_status(required) ⇒ Object



2
3
4
# File 'lib/atech/extensions/controller_tests.rb', line 2

def assert_status(required)
  assert_equal required, @response.status
end