Sha256: 2276d855ca89428031b12b87bd7aded265f7e9500ff77df9b6631fc27fa41edf
Contents?: true
Size: 1.39 KB
Versions: 10
Compression:
Stored size: 1.39 KB
Contents
# frozen_string_literal: true require_relative 'helper' class AppTest < MiniTest::Test def test_empty_app app = Impression::App.new(path: '/') req = mock_req(':method' => 'GET', ':path' => '/') app.call(req) assert_equal Qeweney::Status::NOT_FOUND, req.adapter.status end def test_app_each app = Impression::App.new(path: '/') buffer = [] app.each { |r| buffer << r } assert_equal [app], buffer foo = PathRenderingResource.new(parent: app, path: 'foo') bar = PathRenderingResource.new(parent: app, path: 'bar') buffer = [] app.each { |r| buffer << r } assert_equal [app, foo, bar], buffer end def test_app_to_proc app = Impression::App.new(path: '/') app_proc = app.to_proc foo = PathRenderingResource.new(parent: app, path: 'foo') bar = PathRenderingResource.new(parent: app, path: 'bar') # req = mock_req(':method' => 'GET', ':path' => '/') # app_proc.(req) # assert_equal Qeweney::Status::NOT_FOUND, req.adapter.status req = mock_req(':method' => 'GET', ':path' => '/foo') app_proc.(req) assert_equal '/foo', req.adapter.body req = mock_req(':method' => 'GET', ':path' => '/bar') app_proc.(req) assert_equal '/bar', req.adapter.body req = mock_req(':method' => 'GET', ':path' => '/baz') app_proc.(req) assert_equal Qeweney::Status::NOT_FOUND, req.adapter.status end end
Version data entries
10 entries across 10 versions & 1 rubygems