Include tests

This commit is contained in:
Cadu Ribeiro 2020-12-17 16:35:52 -03:00
parent 64347b004e
commit 06e049c1a5
No known key found for this signature in database
GPG Key ID: B4AA080E1479FA6B
1 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,14 @@ class BaseTest < Minitest::Test
get('/') { 'Hello World' }
end
class TestKeywordArgumentInitializerApp < Sinatra::Base
def initialize(argument:)
@argument = argument
end
get('/') { "Hello World with Keyword Arguments: #{@argument}" }
end
it 'include Rack::Utils' do
assert TestApp.included_modules.include?(Rack::Utils)
end
@ -48,6 +56,16 @@ class BaseTest < Minitest::Test
TestApp.configure { context = self }
assert_equal self, context
end
it "allows constructor to receive keyword arguments" do
app = TestKeywordArgumentInitializerApp.new(argument: "some argument")
request = Rack::MockRequest.new(app)
response = request.get('/')
assert response.ok?
assert_equal 'Hello World with Keyword Arguments: some argument', response.body
end
end
describe "Sinatra::Base#new" do