Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
Global Gemfile for tests. Gemfile in the function for use in tests.

Hat tip to lauratpa and her PR aws#860 which is the core of this part of
the change set.
  • Loading branch information
awood45 committed Dec 18, 2018
1 parent b159512 commit 8b34b83
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem "httparty"

group :test do
gem "test-unit"
gem "mocha"
end
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
source "https://rubygems.org"

gem "httparty"

group :test do
gem "test-unit"
gem "mocha"
end
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ def mock_response
end
end

def expected_result
{
statusCode: 200,
body: {
message: 'Hello World!',
location: '1.1.1.1'
}.to_json
}
end

def test_lambda_handler
HTTParty.expects(:get).with('http://checkip.amazonaws.com/').returns(mock_response)
assert_equal(lambda_handler(event: event, context: ''), expected_result)
Expand Down

0 comments on commit 8b34b83

Please sign in to comment.