-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add command awspec generate lambda
#127
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module Awspec::Generator | ||
module Spec | ||
class Lambda | ||
include Awspec::Helper::Finder | ||
def generate_all | ||
lambda_functions = select_all_lambda_functions | ||
raise 'Not Found lambda' if lambda_functions.empty? | ||
ERB.new(lambda_spec_template, nil, '-').result(binding).chomp | ||
end | ||
|
||
def lambda_spec_template | ||
template = <<-'EOF' | ||
<% lambda_functions.each do |function| %> | ||
describe lambda('<%= function.function_name %>') do | ||
it { should exist } | ||
its(:description) { should eq '<%= function.description %>' } | ||
its(:runtime) { should eq '<%= function.runtime %>' } | ||
its(:handler) { should eq '<%= function.handler %>' } | ||
its(:code_size) { should eq <%= function.code_size %> } | ||
its(:timeout) { should eq <%= function.timeout %> } | ||
its(:memory_size) { should eq <%= function.memory_size %> } | ||
end | ||
<% end %> | ||
EOF | ||
template | ||
end | ||
end | ||
end | ||
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'spec_helper' | ||
|
||
describe Awspec::Generator::Spec::Lambda do | ||
before do | ||
Awspec::Stub.load 'lambda' | ||
end | ||
let(:lambda) { Awspec::Generator::Spec::Lambda.new } | ||
it 'generates spec' do | ||
spec = <<-'EOF' | ||
|
||
describe lambda('my-lambda-function-name') do | ||
it { should exist } | ||
its(:description) { should eq 'My Lambda Function' } | ||
its(:runtime) { should eq 'pyhton2.7' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo |
||
its(:handler) { should eq 'lambda_function.lambda_handler' } | ||
its(:code_size) { should eq 1234 } | ||
its(:timeout) { should eq 5 } | ||
its(:memory_size) { should eq 256 } | ||
end | ||
EOF | ||
expect(lambda.generate_all.to_s).to eq spec | ||
end | ||
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 |
---|---|---|
|
@@ -3,8 +3,10 @@ | |
|
||
describe lambda('my-lambda-function-name') do | ||
it { should exist } | ||
its(:function_name) { should eq 'my-lambda-function-name' } | ||
its(:runtime) { should eq 'nodejs' } | ||
its(:description) { should eq 'My Lambda Function' } | ||
its(:runtime) { should eq 'pyhton2.7' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And again. If it's intentional, add a comment or use something that is less similar to a real word. |
||
its(:handler) { should eq 'lambda_function.lambda_handler' } | ||
its(:code_size) { should eq 1234 } | ||
its(:timeout) { should eq 5 } | ||
its(:memory_size) { should eq 256 } | ||
end | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opps!! Thank you!