Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #912 from frozenbonito/support-ruby2.7
Support ruby2.7
- Loading branch information
Showing
8 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
require 'json' | ||
|
||
def hello(event:, context:) | ||
{ body: JSON.generate({'message' => 'Hello Ruby 2.5!'}), statusCode: 200 } | ||
{ | ||
body: JSON.generate({ | ||
message: 'Hello Ruby 2.5!', | ||
version: RUBY_VERSION, | ||
}), | ||
statusCode: 200, | ||
} | ||
end |
41 changes: 41 additions & 0 deletions
41
tests/integration/docker/ruby/ruby2.7/dockerRuby2.7.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { resolve } from 'path' | ||
import fetch from 'node-fetch' | ||
import { satisfies } from 'semver' | ||
import { joinUrl, setup, teardown } from '../../../_testHelpers/index.js' | ||
|
||
jest.setTimeout(120000) | ||
|
||
// "Could not find 'Docker', skipping 'Docker' tests." | ||
const _describe = process.env.DOCKER_DETECTED ? describe : describe.skip | ||
|
||
_describe('Ruby 2.7 with Docker tests', () => { | ||
// init | ||
beforeAll(() => | ||
setup({ | ||
servicePath: resolve(__dirname), | ||
}), | ||
) | ||
|
||
// cleanup | ||
afterAll(() => teardown()) | ||
|
||
// | ||
;[ | ||
{ | ||
description: 'should work with ruby2.7 in docker container', | ||
expected: { | ||
message: 'Hello Ruby 2.7!', | ||
}, | ||
path: '/dev/hello', | ||
}, | ||
].forEach(({ description, expected, path }) => { | ||
test(description, async () => { | ||
const url = joinUrl(TEST_BASE_URL, path) | ||
const response = await fetch(url) | ||
const json = await response.json() | ||
|
||
expect(json.message).toEqual(expected.message) | ||
expect(satisfies(json.version, '2.7')).toEqual(true) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'json' | ||
|
||
def hello(event:, context:) | ||
{ | ||
body: JSON.generate({ | ||
message: 'Hello Ruby 2.7!', | ||
version: RUBY_VERSION, | ||
}), | ||
statusCode: 200, | ||
} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
service: docker-ruby2.7-tests | ||
|
||
plugins: | ||
- ./../../../../../ | ||
|
||
provider: | ||
memorySize: 128 | ||
name: aws | ||
region: us-east-1 # default | ||
runtime: ruby2.7 | ||
stage: dev | ||
versionFunctions: false | ||
|
||
custom: | ||
serverless-offline: | ||
useDocker: true | ||
|
||
functions: | ||
hello: | ||
events: | ||
- http: | ||
method: get | ||
path: hello | ||
handler: handler.hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters