class Capsium::Package::Testing::RouteTest
A βrouteβ test (05x-testing): requests the URL path from the reactor serving the package and checks the expected status, and optionally the content type and a response body substring.
Attributes
expected_content_type
[R]
String?
expected_status
[R]
Integer
response_contains
[R]
String?
url
[R]
String
Public Class Methods
(name: String name, url: String url, expected_status: Integer expected_status, ?response_contains: String? response_contains, ?expected_content_type: String? expected_content_type) → void
Source
# File lib/capsium/package/testing/route_test.rb, line 15 def initialize(name:, url:, expected_status:, response_contains: nil, expected_content_type: nil) super(name: name) @url = url @expected_status = expected_status @response_contains = response_contains @expected_content_type = expected_content_type end
Calls superclass method
Public Instance Methods
(Context context) → TestCase::Result
Source
# File lib/capsium/package/testing/route_test.rb, line 24 def run(context) response = Net::HTTP.get_response(URI.join(context.base_url, request_path)) problems = status_problems(response) + content_type_problems(response) + body_problems(response) Result.new(name: name, ok: problems.empty?, messages: problems) end