Sha256: 8f101be64c8f2d4367d27c9f06dcc21fc7a2ffbc8165011e4c86f90d66cb3b85

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 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', 'age']})
  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

  def test_assert_response_xml_schema_method
    get '/path?foo=bar', {a: :b}, {'CONTENT_TYPE' => 'application/xml'}
    assert_response_xml_schema 'schemas/response.schema.xsd'
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dock_test-0.4.8 test/dock_test/test_assertions.rb
dock_test-0.4.6 test/dock_test/test_assertions.rb
dock_test-0.4.5 test/dock_test/test_assertions.rb
dock_test-0.4.0 test/dock_test/test_assertions.rb
dock_test-0.3.7 test/dock_test/test_assertions.rb
dock_test-0.3.6 test/dock_test/test_assertions.rb
dock_test-0.3.5 test/dock_test/test_assertions.rb
dock_test-0.3.4 test/dock_test/test_assertions.rb
dock_test-0.3.3 test/dock_test/test_assertions.rb
dock_test-0.3.2 test/dock_test/test_assertions.rb
dock_test-0.3.1 test/dock_test/test_assertions.rb
dock_test-0.3.0 test/dock_test/test_assertions.rb