rubycfn 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/rubycfn/version.rb +1 -1
- data/lib/rubycfn.rb +5 -2
- data/spec/lib/rubycfn_spec.rb +56 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19aba32d0480c42cbc8070c1c10e821b568f99a5
|
4
|
+
data.tar.gz: 16b03c2a0fb30a528d04981c1dc07d8de281f5b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7dcbeb1c60c17662e96bc5e53dfdcc735e10b79f30429829d87319f1c1cc8d22456284c1b988224b999e446c3ffcc43385c82a285eb14a12dde26883f450ec2
|
7
|
+
data.tar.gz: 94ce17cae7ff31af550b82ec0293a55ffb9ff7ff89f63ab668a3a1279e4ea586bb2a2afa21ca5267cd4c486e4c7339d842fb8f841af61b246d10a51d845c7af2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/rubycfn/version.rb
CHANGED
data/lib/rubycfn.rb
CHANGED
@@ -96,8 +96,10 @@ module Rubycfn
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
def self.description(description)
|
100
|
-
|
99
|
+
def self.description(description = "")
|
100
|
+
unless description.nil?
|
101
|
+
TOPLEVEL_BINDING.eval("@description = '#{description}'")
|
102
|
+
end
|
101
103
|
end
|
102
104
|
|
103
105
|
def self.parameter(name, arguments)
|
@@ -180,6 +182,7 @@ module Rubycfn
|
|
180
182
|
yield self, i if block_given?
|
181
183
|
res = {
|
182
184
|
"#{name.to_s}#{i == 0 ? "" : i+1}": {
|
185
|
+
DependsOn: TOPLEVEL_BINDING.eval("@depends_on"),
|
183
186
|
Properties: TOPLEVEL_BINDING.eval("@properties"),
|
184
187
|
Type: arguments[:type]
|
185
188
|
}
|
data/spec/lib/rubycfn_spec.rb
CHANGED
@@ -5,17 +5,70 @@ require "active_support/concern"
|
|
5
5
|
|
6
6
|
describe Rubycfn do
|
7
7
|
|
8
|
-
module
|
8
|
+
module RspecStack
|
9
|
+
extend ActiveSupport::Concern
|
9
10
|
include Rubycfn
|
11
|
+
|
12
|
+
included do
|
13
|
+
description "RSpec Test Stack"
|
14
|
+
|
15
|
+
resource :rspec_resource_name,
|
16
|
+
type: "Rspec::Test",
|
17
|
+
amount: 2 do |r|
|
18
|
+
r.property(:name) { "RSpec" }
|
19
|
+
end
|
20
|
+
end
|
10
21
|
end
|
11
22
|
|
23
|
+
CloudFormation = include RspecStack
|
24
|
+
RspecStack = CloudFormation.render_template
|
25
|
+
Given(:json) { JSON.parse(RspecStack) }
|
26
|
+
|
12
27
|
context "renders template" do
|
13
|
-
let(:template) {
|
28
|
+
let(:template) { json }
|
14
29
|
subject { template }
|
15
30
|
|
16
31
|
it { should_not have_key 'Parameters' }
|
17
32
|
it { should_not have_key 'Outputs' }
|
18
|
-
|
33
|
+
|
34
|
+
it { should have_key 'Description' }
|
35
|
+
it { should have_key 'Resources' }
|
19
36
|
it { should have_key 'AWSTemplateFormatVersion' }
|
37
|
+
|
38
|
+
context "has description" do
|
39
|
+
let(:description) { template["Description"] }
|
40
|
+
subject { description }
|
41
|
+
|
42
|
+
it { should eq "RSpec Test Stack" }
|
43
|
+
end
|
44
|
+
|
45
|
+
context "created resource" do
|
46
|
+
let(:resources) { template["Resources"] }
|
47
|
+
subject { resources }
|
48
|
+
|
49
|
+
it { should have_key "RspecResourceName" }
|
50
|
+
|
51
|
+
context "has resource type" do
|
52
|
+
let(:resource) { resources["RspecResourceName"] }
|
53
|
+
subject { resource }
|
54
|
+
|
55
|
+
it { should have_key "Type" }
|
56
|
+
it { should have_key "Properties" }
|
57
|
+
|
58
|
+
context "resource type is correct" do
|
59
|
+
let(:type) { resource["Type"] }
|
60
|
+
subject { type }
|
61
|
+
|
62
|
+
it { should eq "Rspec::Test" }
|
63
|
+
end
|
64
|
+
|
65
|
+
context "has name property" do
|
66
|
+
let(:properties) { resource["Properties"] }
|
67
|
+
subject { properties }
|
68
|
+
|
69
|
+
it { should have_key "Name" }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
20
73
|
end
|
21
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubycfn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Vink
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: neatjson
|