Sha256: 134e99d4aaaf8857c13c6eea6d11cc183575736b69c61e515852755ef43905f4

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

require 'test_helper'

class TestAssertions < Minitest::Test

  include DockTest::Methods

  def test_assert_response_status_method
    get '/path?foo=bar', {a: :b}, {'CONTENT_TYPE' => 'application/json'}
    assert_response_status 200
  end

  def test_assert_response_content_type_method
    get '/path?foo=bar', {a: :b}, {'CONTENT_TYPE' => 'application/json'}
    assert_response_content_type 'application/json'
  end

  def test_assert_response_headers_method
    get '/path?foo=bar', {a: :b}, {'CONTENT_TYPE' => 'application/json'}
    assert_response_headers({"content-type"=>["application/json"]} , {exclude: ['content-length', 'server', 'connection', 'date', 'via']})
  end

  def test_assert_response_body_method
    skip unless ENV['DOCK_ENV'] == 'development'
    get '/path?foo=bar', {a: :b}, {'CONTENT_TYPE' => 'application/json'}
    assert_response_body '{"verb":"GET","uri":"http://localhost:9871/path?foo=bar&a=b","body":"","protcol":"HTTP/1.1","headers":{"ACCEPT":"*/*","USER_AGENT":"Ruby","CONTENT_TYPE":"application/json","HOST":"localhost:9871","VERSION":"HTTP/1.1"}}'
  end

  def test_assert_response_json_schema_method
    get '/path?foo=bar', {a: :b}, {'CONTENT_TYPE' => 'application/json'}
    assert_response_json_schema 'schemas/response.schema.json'
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dock_test-0.1.6 test/dock_test/test_assertions.rb
dock_test-0.1.5 test/dock_test/test_assertions.rb
dock_test-0.1.3 test/dock_test/test_assertions.rb
dock_test-0.1.2 test/dock_test/test_assertions.rb
dock_test-0.1.1 test/dock_test/test_assertions.rb