lono 4.2.7 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cody/README.md +6 -0
- data/.cody/acceptance.sh +30 -0
- data/.cody/buildspec.yml +21 -0
- data/.cody/demo.rb +38 -0
- data/.cody/project.rb +12 -0
- data/.cody/role.rb +1 -0
- data/.gitignore +2 -0
- data/.gitmodules +6 -3
- data/.travis.yml +7 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +0 -1
- data/LICENSE.txt +1 -22
- data/README.md +46 -55
- data/lib/lono.rb +20 -27
- data/lib/lono/app_file.rb +5 -0
- data/lib/lono/app_file/base.rb +19 -0
- data/lib/lono/app_file/build.rb +78 -0
- data/lib/lono/app_file/registry.rb +14 -0
- data/lib/lono/app_file/registry/item.rb +46 -0
- data/lib/lono/app_file/upload.rb +39 -0
- data/lib/lono/autoloader.rb +22 -0
- data/lib/lono/aws_services.rb +46 -0
- data/lib/lono/aws_services/util.rb +49 -0
- data/lib/lono/blueprint.rb +113 -0
- data/lib/lono/blueprint/find.rb +90 -0
- data/lib/lono/blueprint/helper.rb +18 -0
- data/lib/lono/blueprint/info.rb +10 -0
- data/lib/lono/blueprint/list.rb +14 -0
- data/lib/lono/blueprint/root.rb +43 -0
- data/lib/lono/cfn.rb +31 -19
- data/lib/lono/cfn/aws_service.rb +16 -0
- data/lib/lono/cfn/base.rb +244 -261
- data/lib/lono/cfn/create.rb +36 -32
- data/lib/lono/cfn/current.rb +1 -1
- data/lib/lono/cfn/delete.rb +2 -2
- data/lib/lono/cfn/deploy.rb +11 -0
- data/lib/lono/cfn/diff.rb +1 -1
- data/lib/lono/cfn/preview.rb +3 -3
- data/lib/lono/cfn/rollback.rb +26 -0
- data/lib/lono/cfn/status.rb +2 -203
- data/lib/lono/cfn/suffix.rb +67 -0
- data/lib/lono/cfn/update.rb +61 -53
- data/lib/lono/cli.rb +42 -23
- data/lib/lono/completer.rb +0 -2
- data/lib/lono/configure.rb +37 -0
- data/lib/lono/configure/aws_services.rb +18 -0
- data/lib/lono/configure/base.rb +94 -0
- data/lib/lono/configure/helpers.rb +128 -0
- data/lib/lono/conventions.rb +11 -0
- data/lib/lono/core.rb +42 -12
- data/lib/lono/core/config.rb +5 -4
- data/lib/lono/default/settings.yml +0 -11
- data/lib/lono/file_uploader.rb +9 -4
- data/lib/lono/help.rb +1 -2
- data/lib/lono/help/blueprint.md +46 -0
- data/lib/lono/help/cfn.md +5 -4
- data/lib/lono/help/cfn/create.md +14 -9
- data/lib/lono/help/cfn/deploy.md +92 -0
- data/lib/lono/help/cfn/diff.md +0 -1
- data/lib/lono/help/cfn/update.md +16 -15
- data/lib/lono/help/completion.md +3 -3
- data/lib/lono/help/generate.md +0 -1
- data/lib/lono/help/new.md +40 -34
- data/lib/lono/help/param.md +1 -1
- data/lib/lono/help/param/generate.md +1 -1
- data/lib/lono/help/template.md +2 -2
- data/lib/lono/help/xgraph.md +1 -1
- data/lib/lono/inspector.rb +1 -1
- data/lib/lono/inspector/base.rb +26 -10
- data/lib/lono/inspector/graph.rb +7 -3
- data/lib/lono/inspector/summary.rb +15 -3
- data/lib/lono/md5.rb +46 -0
- data/lib/lono/new.rb +40 -28
- data/lib/lono/new/helper.rb +2 -3
- data/lib/lono/param.rb +12 -11
- data/lib/lono/param/generator.rb +96 -42
- data/lib/lono/project_checker.rb +27 -8
- data/lib/lono/s3.rb +23 -0
- data/lib/lono/s3/bucket.rb +123 -0
- data/lib/lono/script.rb +4 -8
- data/lib/lono/script/base.rb +7 -2
- data/lib/lono/script/build.rb +7 -8
- data/lib/lono/script/upload.rb +4 -20
- data/lib/lono/sequence.rb +19 -16
- data/lib/lono/setting.rb +19 -27
- data/lib/lono/template.rb +22 -26
- data/lib/lono/template/base.rb +13 -0
- data/lib/lono/template/context.rb +4 -56
- data/lib/lono/template/context/loader.rb +70 -0
- data/lib/lono/template/dsl.rb +15 -151
- data/lib/lono/template/dsl/builder.rb +60 -0
- data/lib/lono/template/dsl/builder/base.rb +14 -0
- data/lib/lono/template/dsl/builder/condition.rb +26 -0
- data/lib/lono/template/dsl/builder/fn.rb +114 -0
- data/lib/lono/template/dsl/builder/helper.rb +64 -0
- data/lib/lono/template/dsl/builder/mapping.rb +24 -0
- data/lib/lono/template/dsl/builder/output.rb +37 -0
- data/lib/lono/template/dsl/builder/parameter.rb +39 -0
- data/lib/lono/template/dsl/builder/resource.rb +38 -0
- data/lib/lono/template/dsl/builder/section.rb +12 -0
- data/lib/lono/template/dsl/builder/syntax.rb +58 -0
- data/lib/lono/template/erb.rb +82 -0
- data/lib/lono/template/evaluate.rb +39 -0
- data/lib/lono/template/generator.rb +29 -0
- data/lib/lono/template/helper.rb +7 -29
- data/lib/lono/template/post_processor.rb +69 -0
- data/lib/lono/template/template.rb +4 -9
- data/lib/lono/template/upload.rb +103 -133
- data/lib/lono/template/util.rb +48 -0
- data/lib/lono/upgrade.rb +5 -3
- data/lib/lono/upgrade/upgrade5.rb +55 -0
- data/lib/lono/user_data.rb +4 -4
- data/lib/lono/version.rb +1 -1
- data/lib/templates/blueprint/%blueprint_name%.gemspec.tt +44 -0
- data/lib/templates/blueprint/.gitignore +14 -0
- data/lib/templates/blueprint/.lono/config.yml.tt +3 -0
- data/lib/templates/blueprint/.meta/config.yml.tt +3 -0
- data/lib/templates/blueprint/CHANGELOG.md +7 -0
- data/lib/templates/blueprint/Gemfile +4 -0
- data/lib/templates/blueprint/README.md +37 -0
- data/lib/templates/blueprint/Rakefile +6 -0
- data/lib/templates/blueprint/setup/configs.rb +54 -0
- data/lib/templates/blueprint_configs/configs/%blueprint_name%/params/base.txt +2 -0
- data/lib/{starter_projects/skeleton/app/definitions/base.rb → templates/blueprint_configs/configs/%blueprint_name%/params/development.txt} +0 -0
- data/lib/templates/blueprint_configs/configs/%blueprint_name%/variables/base.rb +2 -0
- data/lib/templates/blueprint_configs/configs/%blueprint_name%/variables/development.rb +0 -0
- data/lib/templates/blueprint_types/dsl/app/templates/%blueprint_name%.rb +37 -0
- data/lib/templates/blueprint_types/dsl/app/user_data/bootstrap.sh +2 -0
- data/lib/templates/blueprint_types/erb/app/definitions/base.rb.tt +1 -0
- data/lib/templates/blueprint_types/erb/app/templates/%blueprint_name%.yml +8 -0
- data/lib/{starter_projects/autoscaling → templates/skeleton}/.gitignore +1 -0
- data/lib/templates/skeleton/Gemfile +3 -0
- data/lib/{starter_projects/autoscaling → templates/skeleton}/Guardfile +2 -2
- data/lib/templates/skeleton/README.md +58 -0
- data/lib/templates/skeleton/configs/settings.yml +17 -0
- data/lib/templates/upgrade5/blueprints/main/.lono/config.yml +3 -0
- data/lib/templates/upgrade5/blueprints/main/.meta/config.yml +3 -0
- data/lono.gemspec +12 -8
- data/vendor/cfn-status/CHANGELOG.md +10 -0
- data/vendor/cfn-status/Gemfile +4 -0
- data/vendor/cfn-status/LICENSE.txt +21 -0
- data/vendor/cfn-status/README.md +56 -0
- data/vendor/cfn-status/Rakefile +6 -0
- data/vendor/cfn-status/bin/console +14 -0
- data/vendor/cfn-status/bin/setup +8 -0
- data/vendor/cfn-status/cfn-status.gemspec +30 -0
- data/vendor/cfn-status/lib/cfn-status.rb +1 -0
- data/vendor/cfn-status/lib/cfn/aws_service.rb +51 -0
- data/vendor/cfn-status/lib/cfn/status.rb +219 -0
- data/vendor/cfn-status/lib/cfn/status/version.rb +5 -0
- data/vendor/cfn-status/spec/cfn/status_spec.rb +81 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
- data/vendor/cfn-status/spec/spec_helper.rb +14 -0
- data/vendor/cfn_camelizer/CHANGELOG.md +20 -0
- data/vendor/cfn_camelizer/Gemfile +4 -0
- data/vendor/cfn_camelizer/LICENSE.txt +21 -0
- data/vendor/cfn_camelizer/README.md +40 -0
- data/vendor/cfn_camelizer/Rakefile +6 -0
- data/vendor/cfn_camelizer/bin/console +14 -0
- data/vendor/cfn_camelizer/bin/setup +8 -0
- data/vendor/cfn_camelizer/cfn_camelizer.gemspec +32 -0
- data/vendor/cfn_camelizer/lib/camelizer.yml +37 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +94 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +3 -0
- data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +86 -0
- data/vendor/cfn_camelizer/spec/spec_helper.rb +14 -0
- metadata +189 -62
- data/.circleci/bin/commit_docs.sh +0 -26
- data/.circleci/config.yml +0 -72
- data/bin/release +0 -9
- data/lib/lono/help/import.md +0 -54
- data/lib/lono/importer.rb +0 -134
- data/lib/lono/new/message.rb +0 -35
- data/lib/starter_projects/autoscaling/Gemfile +0 -3
- data/lib/starter_projects/autoscaling/README.md +0 -118
- data/lib/starter_projects/autoscaling/app/definitions/base.rb +0 -2
- data/lib/starter_projects/autoscaling/app/templates/autoscaling.yml +0 -682
- data/lib/starter_projects/autoscaling/config/params/base/autoscaling.txt +0 -6
- data/lib/starter_projects/autoscaling/config/settings.yml +0 -33
- data/lib/starter_projects/ec2/.gitignore +0 -2
- data/lib/starter_projects/ec2/Gemfile +0 -3
- data/lib/starter_projects/ec2/Guardfile +0 -12
- data/lib/starter_projects/ec2/README.md +0 -86
- data/lib/starter_projects/ec2/app/definitions/base.rb +0 -2
- data/lib/starter_projects/ec2/app/definitions/development.rb +0 -1
- data/lib/starter_projects/ec2/app/definitions/production.rb +0 -1
- data/lib/starter_projects/ec2/app/helpers/my_custom_helper.rb +0 -17
- data/lib/starter_projects/ec2/app/partials/user_data/bootstrap.sh +0 -4
- data/lib/starter_projects/ec2/app/templates/example.yml +0 -430
- data/lib/starter_projects/ec2/config/params/base/example.txt +0 -2
- data/lib/starter_projects/ec2/config/params/development/example.txt +0 -3
- data/lib/starter_projects/ec2/config/params/production/example.txt +0 -2
- data/lib/starter_projects/ec2/config/settings.yml +0 -33
- data/lib/starter_projects/ec2/config/variables/base.rb +0 -3
- data/lib/starter_projects/ec2/config/variables/development.rb +0 -2
- data/lib/starter_projects/ec2/config/variables/production.rb +0 -2
- data/lib/starter_projects/ec2/welcome.txt +0 -8
- data/lib/starter_projects/skeleton/.gitignore +0 -2
- data/lib/starter_projects/skeleton/Gemfile +0 -3
- data/lib/starter_projects/skeleton/Guardfile +0 -12
- data/lib/starter_projects/skeleton/README.md +0 -53
- data/lib/starter_projects/skeleton/config/settings.yml +0 -33
- data/lib/starter_projects/skeleton/welcome.txt +0 -7
- data/vendor/plissken/Gemfile +0 -14
- data/vendor/plissken/LICENSE.txt +0 -20
- data/vendor/plissken/README.md +0 -46
- data/vendor/plissken/Rakefile +0 -56
- data/vendor/plissken/VERSION +0 -1
- data/vendor/plissken/lib/plissken.rb +0 -1
- data/vendor/plissken/lib/plissken/ext/hash/to_snake_keys.rb +0 -45
- data/vendor/plissken/plissken.gemspec +0 -61
- data/vendor/plissken/spec/lib/to_snake_keys_spec.rb +0 -177
- data/vendor/plissken/spec/spec_helper.rb +0 -90
- data/vendor/plissken/test/helper.rb +0 -20
- data/vendor/plissken/test/plissken/ext/hash/to_snake_keys_test.rb +0 -184
- data/vendor/plissken/test/test_plissken.rb +0 -2
@@ -1,177 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../lib/plissken')
|
4
|
-
|
5
|
-
RSpec.describe 'A Hash' do
|
6
|
-
describe 'with camelBack keys' do
|
7
|
-
describe 'which are JSON-style strings' do
|
8
|
-
describe 'in the simplest case' do
|
9
|
-
let(:hash) { [{ 'firstKey' => 'fooBar' }] }
|
10
|
-
|
11
|
-
describe 'non-destructive snakification' do
|
12
|
-
let(:snaked) { hash.map(&:to_snake_keys) }
|
13
|
-
it 'snakifies the key' do
|
14
|
-
expect(snaked.first).to have_key(:first_key)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'leaves the key as a string' do
|
18
|
-
expect(snaked.first.keys).to eq([:first_key])
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'leaves the value untouched' do
|
22
|
-
expect(hash.first.values).to eq(['fooBar'])
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'leaves the original hash untouched' do
|
26
|
-
expect(hash.first.keys).to eq(['firstKey'])
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe 'containing an array of other hashes' do
|
32
|
-
let(:hash) do
|
33
|
-
{
|
34
|
-
'appleType' => 'Granny Smith',
|
35
|
-
'vegetableTypes' => [
|
36
|
-
{ 'potatoType' => 'Golden delicious' },
|
37
|
-
{ 'otherTuberType' => 'peanut' },
|
38
|
-
{ 'peanutNamesAndSpouses' => [
|
39
|
-
{ 'billThePeanut' => 'sallyPeanut' },
|
40
|
-
{ 'sammyThePeanut' => 'jillPeanut' }
|
41
|
-
] }
|
42
|
-
] }
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'non-destructive snakification' do
|
46
|
-
subject(:snaked) { hash.to_snake_keys }
|
47
|
-
#
|
48
|
-
it 'recursively snakifies the keys on the top level of the hash' do
|
49
|
-
expect(snaked.include?(:apple_type)).to be_truthy
|
50
|
-
expect(snaked.include?(:vegetable_types)).to be_truthy
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'leaves the values on the top level alone' do
|
54
|
-
expect(snaked[:apple_type]).to eq('Granny Smith')
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'converts second-level keys' do
|
58
|
-
expect(snaked[:vegetable_types].first)
|
59
|
-
.to have_key(:potato_type)
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'leaves second-level values alone' do
|
63
|
-
expect(snaked[:vegetable_types].first)
|
64
|
-
.to have_value('Golden delicious')
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'converts third-level keys' do
|
68
|
-
expect(snaked[:vegetable_types].last[:peanut_names_and_spouses]
|
69
|
-
.last).to have_value('jillPeanut')
|
70
|
-
expect(snaked[:vegetable_types]
|
71
|
-
.last[:peanut_names_and_spouses]
|
72
|
-
.last).to have_key(:sammy_the_peanut)
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'leaves third-level values alone' do
|
76
|
-
expect(snaked[:vegetable_types]
|
77
|
-
.last[:peanut_names_and_spouses]
|
78
|
-
.first[:bill_the_peanut]).to eq('sallyPeanut')
|
79
|
-
expect(snaked[:vegetable_types]
|
80
|
-
.last[:peanut_names_and_spouses]
|
81
|
-
.last[:sammy_the_peanut]).to eq('jillPeanut')
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
describe 'which are symbols' do
|
88
|
-
describe 'in the simplest case' do
|
89
|
-
let(:hash) { { :firstKey => 'fooBar' } }
|
90
|
-
|
91
|
-
describe 'non-destructive snakification' do
|
92
|
-
subject(:snaked) { hash.to_snake_keys }
|
93
|
-
|
94
|
-
it 'snakifies the key' do
|
95
|
-
expect(snaked).to have_key(:first_key)
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'leaves the key as a symbol' do
|
99
|
-
expect(:first_key).to eq(snaked.keys.first)
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'leaves the value untouched' do
|
103
|
-
expect(snaked.values.first).to eq('fooBar')
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'leaves the original hash untouched' do
|
107
|
-
expect(hash).to have_key(:firstKey)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
#
|
112
|
-
describe 'containing an array of other hashes' do
|
113
|
-
let(:hash) do
|
114
|
-
{
|
115
|
-
:appleType => 'Granny Smith',
|
116
|
-
:vegetableTypes => [
|
117
|
-
{ :potatoType => 'Golden delicious' },
|
118
|
-
{ :otherTuberType => 'peanut' },
|
119
|
-
{ :peanutNamesAndSpouses => [
|
120
|
-
{ :billThePeanut => 'sallyPeanut' },
|
121
|
-
{ :sammyThePeanut => 'jillPeanut' }
|
122
|
-
] }
|
123
|
-
] }
|
124
|
-
end
|
125
|
-
#
|
126
|
-
describe 'non-destructive snakification' do
|
127
|
-
subject(:snaked) { hash.to_snake_keys }
|
128
|
-
#
|
129
|
-
it 'recursively snakifies the keys on the top level of the hash' do
|
130
|
-
expect(snaked.include?(:apple_type)).to be_truthy
|
131
|
-
expect(snaked.include?(:vegetable_types)).to be_truthy
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'leaves the values on the top level alone' do
|
135
|
-
expect(snaked[:apple_type]).to eq('Granny Smith')
|
136
|
-
end
|
137
|
-
|
138
|
-
it 'converts second-level keys' do
|
139
|
-
expect(snaked[:vegetable_types].first)
|
140
|
-
.to have_key(:potato_type)
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'leaves second-level values alone' do
|
144
|
-
expect(snaked[:vegetable_types].first)
|
145
|
-
.to have_value('Golden delicious')
|
146
|
-
end
|
147
|
-
|
148
|
-
it 'converts third-level keys' do
|
149
|
-
expect(snaked[:vegetable_types].last[:peanut_names_and_spouses]
|
150
|
-
.last).to have_value('jillPeanut')
|
151
|
-
expect(snaked[:vegetable_types]
|
152
|
-
.last[:peanut_names_and_spouses]
|
153
|
-
.last).to have_key(:sammy_the_peanut)
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'leaves third-level values alone' do
|
157
|
-
expect(snaked[:vegetable_types]
|
158
|
-
.last[:peanut_names_and_spouses]
|
159
|
-
.first[:bill_the_peanut]).to eq('sallyPeanut')
|
160
|
-
expect(snaked[:vegetable_types]
|
161
|
-
.last[:peanut_names_and_spouses]
|
162
|
-
.last[:sammy_the_peanut]).to eq('jillPeanut')
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
describe 'strings with spaces in them' do
|
170
|
-
let(:hash) { { 'With Spaces' => 'FooBar' } }
|
171
|
-
subject { hash.to_snake_keys }
|
172
|
-
|
173
|
-
it "doesn't get snaked, although it does get downcased" do
|
174
|
-
is_expected.to have_key(:'with spaces')
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
-
# The generated `.rspec` file contains `--require spec_helper`
|
4
|
-
# which will cause this file to always be loaded,
|
5
|
-
# without a need to explicitly require it in any files.
|
6
|
-
#
|
7
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
-
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
-
# a separate helper file that requires the additional dependencies and performs
|
12
|
-
# the additional setup, and require it from the spec
|
13
|
-
# files that actually need it.
|
14
|
-
#
|
15
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
-
# users commonly want.
|
17
|
-
#
|
18
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
-
RSpec.configure do |config|
|
20
|
-
# rspec-expectations config goes here. You can use an alternate
|
21
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
-
# assertions if you prefer.
|
23
|
-
config.expect_with :rspec do |expectations|
|
24
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
|
-
# and `failure_message` of custom matchers include text for helper methods
|
26
|
-
# defined using `chain`, e.g.:
|
27
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
28
|
-
# # => "be bigger than 2 and smaller than 4"
|
29
|
-
# ...rather than:
|
30
|
-
# # => "be bigger than 2"
|
31
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
32
|
-
end
|
33
|
-
|
34
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
35
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
36
|
-
config.mock_with :rspec do |mocks|
|
37
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
38
|
-
# a real object. This is generally recommended, and will default to
|
39
|
-
# `true` in RSpec 4.
|
40
|
-
mocks.verify_partial_doubles = true
|
41
|
-
end
|
42
|
-
|
43
|
-
# The settings below are suggested to provide a good initial experience
|
44
|
-
# with RSpec, but feel free to customize to your heart's content.
|
45
|
-
# # These two settings work together to allow you to limit a spec run
|
46
|
-
# # to individual examples or groups you care about by tagging them with
|
47
|
-
# # `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
48
|
-
# # get run.
|
49
|
-
# config.filter_run :focus
|
50
|
-
# config.run_all_when_everything_filtered = true
|
51
|
-
#
|
52
|
-
# # Limits the available syntax to the non-monkey
|
53
|
-
# patched syntax that is recommended.
|
54
|
-
# # For more details, see:
|
55
|
-
#
|
56
|
-
# config.disable_monkey_patching!
|
57
|
-
#
|
58
|
-
# # This setting enables warnings. It's recommended, but in some cases may
|
59
|
-
# # be too noisy due to issues in dependencies.
|
60
|
-
# config.warnings = true
|
61
|
-
#
|
62
|
-
# # Many RSpec users commonly either run the entire suite or an individual
|
63
|
-
# # file, and it's useful to allow more verbose output when running an
|
64
|
-
# # individual spec file.
|
65
|
-
# if config.files_to_run.one?
|
66
|
-
# # Use the documentation formatter for detailed output,
|
67
|
-
# # unless a formatter has already been configured
|
68
|
-
# # (e.g. via a command-line flag).
|
69
|
-
# config.default_formatter = 'doc'
|
70
|
-
# end
|
71
|
-
#
|
72
|
-
# # Print the 10 slowest examples and example groups at the
|
73
|
-
# # end of the spec run, to help surface which specs are running
|
74
|
-
# # particularly slow.
|
75
|
-
# config.profile_examples = 10
|
76
|
-
#
|
77
|
-
# # Run specs in random order to surface order dependencies. If you find an
|
78
|
-
# # order dependency and want to debug it,
|
79
|
-
# you can fix the order by providing
|
80
|
-
# # the seed, which is printed after each run.
|
81
|
-
# # --seed 1234
|
82
|
-
# config.order = :random
|
83
|
-
#
|
84
|
-
# # Seed global randomization in this process using the `--seed` CLI option.
|
85
|
-
# # Setting this allows you to use `--seed` to deterministically reproduce
|
86
|
-
# # test failures related to randomization by
|
87
|
-
# # passing the same `--seed` value
|
88
|
-
# # as the one that triggered the failure.
|
89
|
-
# Kernel.srand config.seed
|
90
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts 'Run `bundle install` to install missing gems'
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'minitest/spec'
|
11
|
-
# require 'debugger'
|
12
|
-
|
13
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
14
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
15
|
-
require 'plissken'
|
16
|
-
|
17
|
-
class MiniTest::Unit::TestCase
|
18
|
-
end
|
19
|
-
|
20
|
-
MiniTest::Unit.autorun
|
@@ -1,184 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../test_plissken.rb')
|
2
|
-
|
3
|
-
describe 'A Hash' do
|
4
|
-
describe 'with camelBack keys' do
|
5
|
-
describe 'which are JSON-style strings' do
|
6
|
-
describe 'in the simplest case' do
|
7
|
-
before do
|
8
|
-
@hash = { 'firstKey' => 'fooBar' }
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'non-destructive snakification' do
|
12
|
-
before do
|
13
|
-
@snaked = @hash.to_snake_keys
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'snakifies the key' do
|
17
|
-
assert_equal(@snaked.keys.first, 'first_key')
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'leaves the key as a string' do
|
21
|
-
assert_equal('first_key', @snaked.keys.first)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'leaves the value untouched' do
|
25
|
-
assert_equal(@snaked.values.first, 'fooBar')
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'leaves the original hash untouched' do
|
29
|
-
assert_equal(@hash.keys.first, 'firstKey')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe 'containing an array of other hashes' do
|
35
|
-
before do
|
36
|
-
@hash = {
|
37
|
-
'appleType' => 'Granny Smith',
|
38
|
-
'vegetableTypes' => [
|
39
|
-
{ 'potatoType' => 'Golden delicious' },
|
40
|
-
{ 'otherTuberType' => 'peanut' },
|
41
|
-
{ 'peanutNamesAndSpouses' => [
|
42
|
-
{ 'billThePeanut' => 'sallyPeanut' },
|
43
|
-
{ 'sammyThePeanut' => 'jillPeanut' }
|
44
|
-
] }
|
45
|
-
] }
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'non-destructive snakification' do
|
49
|
-
before do
|
50
|
-
@snaked = @hash.to_snake_keys
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'recursively snakifies the keys on the top level of the hash' do
|
54
|
-
assert @snaked.keys.include?('apple_type')
|
55
|
-
assert @snaked.keys.include?('vegetable_types')
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'leaves the values on the top level alone' do
|
59
|
-
assert_equal(@snaked['apple_type'], 'Granny Smith')
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'converts second-level keys' do
|
63
|
-
assert @snaked['vegetable_types'].first.key? 'potato_type'
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'leaves second-level values alone' do
|
67
|
-
assert @snaked['vegetable_types'].first.value? 'Golden delicious'
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'converts third-level keys' do
|
71
|
-
assert @snaked['vegetable_types'].last['peanut_names_and_spouses']
|
72
|
-
.first.key?('bill_the_peanut')
|
73
|
-
assert @snaked['vegetable_types'].last['peanut_names_and_spouses']
|
74
|
-
.last.key?('sammy_the_peanut')
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'leaves third-level values alone' do
|
78
|
-
assert_equal 'sallyPeanut', @snaked['vegetable_types']
|
79
|
-
.last['peanut_names_and_spouses']
|
80
|
-
.first['bill_the_peanut']
|
81
|
-
assert_equal 'jillPeanut', @snaked['vegetable_types']
|
82
|
-
.last['peanut_names_and_spouses']
|
83
|
-
.last['sammy_the_peanut']
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe 'which are symbols' do
|
90
|
-
describe 'in the simplest case' do
|
91
|
-
before do
|
92
|
-
@hash = { :firstKey => 'fooBar' }
|
93
|
-
end
|
94
|
-
|
95
|
-
describe 'non-destructive snakification' do
|
96
|
-
before do
|
97
|
-
@snaked = @hash.to_snake_keys
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'snakifies the key' do
|
101
|
-
assert_equal(@snaked.keys.first, :first_key)
|
102
|
-
end
|
103
|
-
|
104
|
-
it 'leaves the key as a symbol' do
|
105
|
-
assert_equal(:first_key, @snaked.keys.first)
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'leaves the value untouched' do
|
109
|
-
assert_equal(@snaked.values.first, 'fooBar')
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'leaves the original hash untouched' do
|
113
|
-
assert_equal(@hash.keys.first, :firstKey)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe 'containing an array of other hashes' do
|
119
|
-
before do
|
120
|
-
@hash = {
|
121
|
-
:appleType => 'Granny Smith',
|
122
|
-
:vegetableTypes => [
|
123
|
-
{ :potatoType => 'Golden delicious' },
|
124
|
-
{ :otherTuberType => 'peanut' },
|
125
|
-
{ :peanutNamesAndSpouses => [
|
126
|
-
{ :billThePeanut => 'sallyPeanut' },
|
127
|
-
{ :sammyThePeanut => 'jillPeanut' }
|
128
|
-
] }
|
129
|
-
] }
|
130
|
-
end
|
131
|
-
|
132
|
-
describe 'non-destructive snakification' do
|
133
|
-
before do
|
134
|
-
@snaked = @hash.to_snake_keys
|
135
|
-
end
|
136
|
-
|
137
|
-
it 'recursively snakifies the keys on the top level of the hash' do
|
138
|
-
assert @snaked.keys.include?(:apple_type)
|
139
|
-
assert @snaked.keys.include?(:vegetable_types)
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'leaves the values on the top level alone' do
|
143
|
-
assert_equal(@snaked[:apple_type], 'Granny Smith')
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'converts second-level keys' do
|
147
|
-
assert @snaked[:vegetable_types].first.key? :potato_type
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'leaves second-level values alone' do
|
151
|
-
assert @snaked[:vegetable_types].first.value? 'Golden delicious'
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'converts third-level keys' do
|
155
|
-
assert @snaked[:vegetable_types].last[:peanut_names_and_spouses]
|
156
|
-
.first.key?(:bill_the_peanut)
|
157
|
-
assert @snaked[:vegetable_types].last[:peanut_names_and_spouses]
|
158
|
-
.last.key?(:sammy_the_peanut)
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'leaves third-level values alone' do
|
162
|
-
assert_equal 'sallyPeanut', @snaked[:vegetable_types]
|
163
|
-
.last[:peanut_names_and_spouses]
|
164
|
-
.first[:bill_the_peanut]
|
165
|
-
assert_equal 'jillPeanut', @snaked[:vegetable_types]
|
166
|
-
.last[:peanut_names_and_spouses]
|
167
|
-
.last[:sammy_the_peanut]
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
describe 'strings with spaces in them' do
|
175
|
-
before do
|
176
|
-
@hash = { 'With Spaces' => 'FooBar' }
|
177
|
-
@snaked = @hash.to_snake_keys
|
178
|
-
end
|
179
|
-
|
180
|
-
it "doesn't get snaked, although it does get downcased" do
|
181
|
-
assert @snaked.keys.include? 'with spaces'
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|