Navigation Menu

Skip to content

Commit

Permalink
Tests: added Ruby test with constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-zelenkov committed Nov 13, 2019
1 parent bdd96bc commit defb14f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/ruby/constants/config.ru
@@ -0,0 +1,15 @@
app = Proc.new do |env|
['200', {
'X-Copyright' => RUBY_COPYRIGHT,
'X-Description' => RUBY_DESCRIPTION,
'X-Engine' => RUBY_ENGINE,
'X-Engine-Version' => RUBY_ENGINE_VERSION,
'X-Patchlevel' => RUBY_PATCHLEVEL.to_s,
'X-Platform' => RUBY_PLATFORM,
'X-Release-Date' => RUBY_RELEASE_DATE,
'X-Revision' => RUBY_REVISION.to_s,
'X-Version' => RUBY_VERSION,
}, []]
end

run app
23 changes: 23 additions & 0 deletions test/test_ruby_application.py
Expand Up @@ -347,6 +347,29 @@ def test_ruby_keepalive_body(self):

self.assertEqual(resp['body'], '0123456789', 'keep-alive 2')

def test_ruby_application_constants(self):
self.load('constants')

resp = self.get()

self.assertEqual(resp['status'], 200, 'status')

headers = resp['headers']
self.assertGreater(len(headers['X-Copyright']), 0, 'RUBY_COPYRIGHT')
self.assertGreater(
len(headers['X-Description']), 0, 'RUBY_DESCRIPTION'
)
self.assertGreater(len(headers['X-Engine']), 0, 'RUBY_ENGINE')
self.assertGreater(
len(headers['X-Engine-Version']), 0, 'RUBY_ENGINE_VERSION'
)
self.assertGreater(len(headers['X-Patchlevel']), 0, 'RUBY_PATCHLEVEL')
self.assertGreater(len(headers['X-Platform']), 0, 'RUBY_PLATFORM')
self.assertGreater(
len(headers['X-Release-Date']), 0, 'RUBY_RELEASE_DATE'
)
self.assertGreater(len(headers['X-Revision']), 0, 'RUBY_REVISION')
self.assertGreater(len(headers['X-Version']), 0, 'RUBY_VERSION')

if __name__ == '__main__':
TestRubyApplication.main()

0 comments on commit defb14f

Please sign in to comment.