class Rack::ClientSpec
Constants
- VERSION
Public Class Methods
new(app, test_case)
click to toggle source
# File lib/rack/client_spec.rb, line 9 def initialize(app, test_case) @app = app @test_case = test_case @tracer = RequestTrace.new(test_case.make_sequences) @sequence = [] Printer.print_initialized Printer.print_states @tracer.states end
Public Instance Methods
call(env)
click to toggle source
# File lib/rack/client_spec.rb, line 18 def call(env) response = @app.call(env) begin do_test(env, response) rescue => e p e # TODO error inspection end return response end
do_test(env, response)
click to toggle source
# File lib/rack/client_spec.rb, line 28 def do_test(env, response) @sequence << GotRequest.new(env, response) matched = @tracer.trace(env) if matched match_function = @tracer.match result = @test_case.run_sequence(match_function, @sequence) @tracer.reset(match_function) end Printer.print_states @tracer.states if result if result.success? Printer.print_success match_function else Printer.print_fail match_function, result end end end