stack_master 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -0
  3. data/lib/stack_master/commands/terminal_helper.rb +14 -1
  4. data/lib/stack_master/parameter_resolvers/secret.rb +7 -2
  5. data/lib/stack_master/version.rb +1 -1
  6. metadata +21 -216
  7. data/.gitignore +0 -18
  8. data/.rspec +0 -2
  9. data/.travis.yml +0 -12
  10. data/CODE_OF_CONDUCT.md +0 -73
  11. data/Gemfile +0 -4
  12. data/LICENSE.txt +0 -22
  13. data/Rakefile +0 -27
  14. data/apply_demo.gif +0 -0
  15. data/example/simple/Gemfile +0 -3
  16. data/example/simple/parameters/myapp_vpc.yml +0 -1
  17. data/example/simple/parameters/myapp_web.yml +0 -2
  18. data/example/simple/stack_master.yml +0 -13
  19. data/example/simple/templates/myapp_vpc.rb +0 -39
  20. data/example/simple/templates/myapp_web.rb +0 -16
  21. data/features/apply.feature +0 -392
  22. data/features/apply_with_compile_time_parameters.feature +0 -93
  23. data/features/apply_with_env_parameters.feature +0 -49
  24. data/features/apply_with_parameter_store_parameters.feature +0 -47
  25. data/features/apply_with_s3.feature +0 -106
  26. data/features/delete.feature +0 -29
  27. data/features/diff.feature +0 -179
  28. data/features/events.feature +0 -33
  29. data/features/init.feature +0 -6
  30. data/features/outputs.feature +0 -45
  31. data/features/region_aliases.feature +0 -62
  32. data/features/resources.feature +0 -42
  33. data/features/stack_defaults.feature +0 -82
  34. data/features/status.feature +0 -118
  35. data/features/step_definitions/parameter_store_steps.rb +0 -14
  36. data/features/step_definitions/stack_steps.rb +0 -71
  37. data/features/support/env.rb +0 -16
  38. data/features/validate.feature +0 -46
  39. data/logo.png +0 -0
  40. data/script/buildkite/bundle.sh +0 -5
  41. data/script/buildkite/clean.sh +0 -3
  42. data/script/buildkite_rspec.sh +0 -27
  43. data/spec/fixtures/parameters/myapp_vpc.yml +0 -1
  44. data/spec/fixtures/parameters/myapp_vpc_with_secrets.yml +0 -3
  45. data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/my_sparkle_pack.rb +0 -1
  46. data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/sparkleformation/dynamics/my_dynamic.rb +0 -5
  47. data/spec/fixtures/sparkle_pack_integration/templates/dynamics/local_dynamic.rb +0 -5
  48. data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic.rb +0 -3
  49. data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic_from_pack.rb +0 -3
  50. data/spec/fixtures/stack_master.yml +0 -49
  51. data/spec/fixtures/templates/json/valid_myapp_vpc.json +0 -53
  52. data/spec/fixtures/templates/myapp_vpc.json +0 -1
  53. data/spec/fixtures/templates/rb/cfndsl/sample.json +0 -28
  54. data/spec/fixtures/templates/rb/cfndsl/sample.rb +0 -16
  55. data/spec/fixtures/templates/yml/valid_myapp_vpc.yml +0 -35
  56. data/spec/fixtures/test/.gitkeep +0 -0
  57. data/spec/spec_helper.rb +0 -102
  58. data/spec/stack_master/aws_driver/s3_spec.rb +0 -130
  59. data/spec/stack_master/change_set_spec.rb +0 -70
  60. data/spec/stack_master/command_spec.rb +0 -66
  61. data/spec/stack_master/commands/apply_spec.rb +0 -259
  62. data/spec/stack_master/commands/delete_spec.rb +0 -40
  63. data/spec/stack_master/commands/init_spec.rb +0 -17
  64. data/spec/stack_master/commands/status_spec.rb +0 -44
  65. data/spec/stack_master/commands/validate_spec.rb +0 -27
  66. data/spec/stack_master/config_spec.rb +0 -153
  67. data/spec/stack_master/paged_response_accumulator_spec.rb +0 -39
  68. data/spec/stack_master/parameter_loader_spec.rb +0 -110
  69. data/spec/stack_master/parameter_resolver_spec.rb +0 -148
  70. data/spec/stack_master/parameter_resolvers/ami_finder_spec.rb +0 -68
  71. data/spec/stack_master/parameter_resolvers/env_spec.rb +0 -35
  72. data/spec/stack_master/parameter_resolvers/latest_ami_by_tags_spec.rb +0 -33
  73. data/spec/stack_master/parameter_resolvers/latest_ami_spec.rb +0 -46
  74. data/spec/stack_master/parameter_resolvers/parameter_store_spec.rb +0 -50
  75. data/spec/stack_master/parameter_resolvers/secret_spec.rb +0 -66
  76. data/spec/stack_master/parameter_resolvers/security_group_spec.rb +0 -19
  77. data/spec/stack_master/parameter_resolvers/security_groups_spec.rb +0 -32
  78. data/spec/stack_master/parameter_resolvers/sns_topic_name_spec.rb +0 -43
  79. data/spec/stack_master/parameter_resolvers/stack_output_spec.rb +0 -127
  80. data/spec/stack_master/prompter_spec.rb +0 -23
  81. data/spec/stack_master/resolver_array_spec.rb +0 -42
  82. data/spec/stack_master/security_group_finder_spec.rb +0 -49
  83. data/spec/stack_master/sns_topic_finder_spec.rb +0 -25
  84. data/spec/stack_master/sparkle_formation/compile_time/allowed_pattern_validator_spec.rb +0 -47
  85. data/spec/stack_master/sparkle_formation/compile_time/allowed_values_validator_spec.rb +0 -47
  86. data/spec/stack_master/sparkle_formation/compile_time/definitions_validator_spec.rb +0 -36
  87. data/spec/stack_master/sparkle_formation/compile_time/empty_validator_spec.rb +0 -47
  88. data/spec/stack_master/sparkle_formation/compile_time/max_length_validator_spec.rb +0 -37
  89. data/spec/stack_master/sparkle_formation/compile_time/max_size_validator_spec.rb +0 -27
  90. data/spec/stack_master/sparkle_formation/compile_time/min_length_validator_spec.rb +0 -36
  91. data/spec/stack_master/sparkle_formation/compile_time/min_size_validator_spec.rb +0 -28
  92. data/spec/stack_master/sparkle_formation/compile_time/number_validator_spec.rb +0 -41
  93. data/spec/stack_master/sparkle_formation/compile_time/parameters_validator_spec.rb +0 -65
  94. data/spec/stack_master/sparkle_formation/compile_time/state_builder_spec.rb +0 -28
  95. data/spec/stack_master/sparkle_formation/compile_time/string_validator_spec.rb +0 -35
  96. data/spec/stack_master/sparkle_formation/compile_time/value_build_spec.rb +0 -52
  97. data/spec/stack_master/sparkle_formation/compile_time/value_validator_factory_spec.rb +0 -40
  98. data/spec/stack_master/sparkle_formation/template_file_spec.rb +0 -147
  99. data/spec/stack_master/stack_definition_spec.rb +0 -70
  100. data/spec/stack_master/stack_differ_spec.rb +0 -46
  101. data/spec/stack_master/stack_events/fetcher_spec.rb +0 -40
  102. data/spec/stack_master/stack_events/presenter_spec.rb +0 -18
  103. data/spec/stack_master/stack_events/streamer_spec.rb +0 -47
  104. data/spec/stack_master/stack_spec.rb +0 -184
  105. data/spec/stack_master/template_compiler_spec.rb +0 -39
  106. data/spec/stack_master/template_compilers/cfndsl_spec.rb +0 -22
  107. data/spec/stack_master/template_compilers/json_spec.rb +0 -32
  108. data/spec/stack_master/template_compilers/sparkle_formation_spec.rb +0 -116
  109. data/spec/stack_master/template_compilers/yaml_spec.rb +0 -20
  110. data/spec/stack_master/template_utils_spec.rb +0 -21
  111. data/spec/stack_master/test_driver/cloud_formation_spec.rb +0 -64
  112. data/spec/stack_master/test_driver/s3_spec.rb +0 -17
  113. data/spec/stack_master/utils_spec.rb +0 -30
  114. data/spec/stack_master/validator_spec.rb +0 -56
  115. data/spec/stack_master_spec.rb +0 -81
  116. data/spec/support/gemfiles/Gemfile.activesupport-4.0.0 +0 -5
  117. data/spec/support/validator_spec.rb +0 -23
  118. data/stack_master.gemspec +0 -46
  119. data/stacktemplates/parameter_region.yml +0 -3
  120. data/stacktemplates/parameter_stack_name.yml +0 -3
  121. data/stacktemplates/stack.json.erb +0 -20
  122. data/stacktemplates/stack_master.yml.erb +0 -6
@@ -1,23 +0,0 @@
1
- RSpec.describe StackMaster::Prompter do
2
- include StackMaster::Prompter
3
-
4
- context 'when STDIN is not a TTY' do
5
- before do
6
- allow(StackMaster.stdin).to receive(:tty?).and_return(false)
7
- end
8
-
9
- it 'defaults to no and outputs info about -y' do
10
- expect { ask?('blah') }.to output(/To force yes use -y/).to_stdout
11
- end
12
- end
13
-
14
- context 'when STDOUT is not a TTY' do
15
- before do
16
- allow(StackMaster.stdout).to receive(:tty?).and_return(false)
17
- end
18
-
19
- it 'defaults to no and outputs info about -y' do
20
- expect { ask?('blah') }.to output(/To force yes use -y/).to_stdout
21
- end
22
- end
23
- end
@@ -1,42 +0,0 @@
1
- require 'stack_master/resolver_array'
2
-
3
- RSpec.shared_examples_for 'a resolver' do
4
- it 'should create a TestResolvers class' do
5
- expect(array_resolver_class).to be_a Class
6
- end
7
-
8
- it 'should have TestResolver as a resolver class' do
9
- expect(array_resolver_instance).to respond_to :resolver_class
10
- expect(array_resolver_instance.resolver_class).to be TestResolver
11
- end
12
- end
13
-
14
- RSpec.describe 'StackMaster::ParameterResolvers::Resolver' do
15
- let(:array_resolver_instance) { array_resolver_class.new(nil, nil) }
16
-
17
- describe '.array_resolver' do
18
- context 'when using a default name' do
19
- before do
20
- class TestResolver < StackMaster::ParameterResolvers::Resolver
21
- array_resolver
22
- end
23
- end
24
-
25
- let(:array_resolver_class) { StackMaster::ParameterResolvers::TestResolvers }
26
-
27
- it_behaves_like 'a resolver'
28
- end
29
-
30
- context 'when using a specific name' do
31
- before do
32
- class TestResolver < StackMaster::ParameterResolvers::Resolver
33
- array_resolver class_name: 'SpecificResolver'
34
- end
35
- end
36
-
37
- let(:array_resolver_class) { StackMaster::ParameterResolvers::SpecificResolver }
38
-
39
- it_behaves_like 'a resolver'
40
- end
41
- end
42
- end
@@ -1,49 +0,0 @@
1
- RSpec.describe StackMaster::SecurityGroupFinder do
2
- subject(:finder) { described_class.new(region) }
3
- let(:region) { 'us-east-1' }
4
- let(:group_name) { "our-api-BeanstalkSg-T4RKD99YOY2F" }
5
- let(:filter) do
6
- {
7
- filters: [
8
- {
9
- name: "group-name",
10
- values: [group_name],
11
- },
12
- ],
13
- }
14
- end
15
-
16
- describe "#find" do
17
- before do
18
- allow_any_instance_of(Aws::EC2::Resource).to receive(:security_groups).with(filter).and_return(security_groups)
19
- end
20
-
21
- context "one sg match" do
22
- let(:security_groups) { [
23
- double(id: 'sg-a7d2ccc0')
24
- ] }
25
- it "returns the id" do
26
- expect(finder.find(group_name)).to eq 'sg-a7d2ccc0'
27
- end
28
- end
29
-
30
- context "more than one sg matches" do
31
- let(:security_groups) { [
32
- double(id: 'sg-a7d2ccc0'),
33
- double(id: 'sg-a7d2ccc2'),
34
- ] }
35
- it "returns the id" do
36
- err = StackMaster::SecurityGroupFinder::MultipleSecurityGroupsFound
37
- expect { finder.find(group_name) }.to raise_error(err)
38
- end
39
- end
40
-
41
- context "no matches" do
42
- let(:security_groups) { [] }
43
- it "returns the id" do
44
- err = StackMaster::SecurityGroupFinder::SecurityGroupNotFound
45
- expect { finder.find(group_name) }.to raise_error(err)
46
- end
47
- end
48
- end
49
- end
@@ -1,25 +0,0 @@
1
- RSpec.describe StackMaster::SnsTopicFinder do
2
-
3
- subject(:finder) { described_class.new(region) }
4
- let(:region) { 'us-east-1' }
5
- let(:topics) do
6
- [
7
- double(arn: 'arn:aws:sns:us-east-1:581634149801:topic1name'),
8
- double(arn: 'arn:aws:sns:us-east-1:581634149801:topic2name'),
9
- ]
10
- end
11
- before do
12
- allow_any_instance_of(Aws::SNS::Resource).to receive(:topics).and_return topics
13
- end
14
-
15
- describe '#find' do
16
- it 'finds the topics that exist' do
17
- expect(finder.find('topic1name')).to eq 'arn:aws:sns:us-east-1:581634149801:topic1name'
18
- expect(finder.find('topic2name')).to eq 'arn:aws:sns:us-east-1:581634149801:topic2name'
19
- end
20
-
21
- it 'raises an exception for topics that do not exist' do
22
- expect { finder.find('unknowntopics') }.to raise_error StackMaster::SnsTopicFinder::TopicNotFound
23
- end
24
- end
25
- end
@@ -1,47 +0,0 @@
1
- RSpec.describe StackMaster::SparkleFormation::CompileTime::AllowedPatternValidator do
2
-
3
- describe '#validate' do
4
- let(:name) { 'name' }
5
- let(:error_message) { -> (error, definition) { "#{name}:#{error} does not match allowed_pattern:#{definition[:allowed_pattern]}" } }
6
-
7
- context 'string validation' do
8
- let(:definition) { {type: :string, allowed_pattern: '^a'} }
9
- validate_valid_parameter('a')
10
- validate_valid_parameter(['a'])
11
- validate_invalid_parameter('b', ['b'])
12
- validate_invalid_parameter(['b'], ['b'])
13
- end
14
-
15
- context 'string validation with default' do
16
- let(:definition) { {type: :string, allowed_pattern: '^a', default: 'a'} }
17
- validate_valid_parameter(nil)
18
- end
19
-
20
- context 'string validation with multiple' do
21
- let(:definition) { {type: :string, allowed_pattern: '^a', multiple: true} }
22
- validate_valid_parameter('a,ab')
23
- validate_invalid_parameter('a,,ab', [''])
24
- validate_invalid_parameter('a, ,ab', [''])
25
- end
26
-
27
- context 'string validation with multiple default values' do
28
- let(:definition) { {type: :string, allowed_pattern: '^a', multiple: true, default:'a,a'} }
29
- validate_valid_parameter(nil)
30
- end
31
-
32
- context 'numerical validation' do
33
- let(:definition) { {type: :number, allowed_pattern: '^1'} }
34
- validate_valid_parameter(1)
35
- validate_valid_parameter('1')
36
- validate_valid_parameter([1])
37
- validate_valid_parameter(['1'])
38
- validate_invalid_parameter(2, [2])
39
- validate_invalid_parameter('2', ['2'])
40
- end
41
-
42
- context 'validation with default value' do
43
- let(:definition) { {type: :number, allowed_pattern: '^1', default: '1'} }
44
- validate_valid_parameter(nil)
45
- end
46
- end
47
- end
@@ -1,47 +0,0 @@
1
- RSpec.describe StackMaster::SparkleFormation::CompileTime::AllowedValuesValidator do
2
-
3
- describe '#validate' do
4
- let(:name) { 'name' }
5
- let(:error_message) { -> (error, definition) { "#{name}:#{error} is not in allowed_values:#{definition[:allowed_values]}" } }
6
-
7
- context 'string validation' do
8
- let(:definition) { {type: :string, allowed_values: ['a']} }
9
- validate_valid_parameter('a')
10
- validate_valid_parameter(['a'])
11
- validate_invalid_parameter('b', ['b'])
12
- validate_invalid_parameter(['b'], ['b'])
13
- end
14
-
15
- context 'string validation with default' do
16
- let(:definition) { {type: :string, allowed_values: ['a'], default:'a'} }
17
- validate_valid_parameter(nil)
18
- end
19
-
20
- context 'string validation with multiple' do
21
- let(:definition) { {type: :string, allowed_values: ['a'], multiple: true} }
22
- validate_valid_parameter('a,a')
23
- validate_invalid_parameter( 'a,, a', [''])
24
- validate_invalid_parameter( 'a,,b', ['', 'b'])
25
- end
26
-
27
- context 'string validation with multiple default values' do
28
- let(:definition) { {type: :string, allowed_values: ['a'], multiple: true, default: 'a,a'} }
29
- validate_valid_parameter(nil)
30
- end
31
-
32
- context 'numerical validation' do
33
- let(:definition) { {type: :number, allowed_values: [1]} }
34
- validate_valid_parameter(1)
35
- validate_valid_parameter('1')
36
- validate_valid_parameter([1])
37
- validate_valid_parameter(['1'])
38
- validate_invalid_parameter(2, [2])
39
- validate_invalid_parameter('2', ['2'])
40
- end
41
-
42
- context 'numerical validation with default value' do
43
- let(:definition) { {type: :number, allowed_values: [1], default: 1} }
44
- validate_valid_parameter(nil)
45
- end
46
- end
47
- end
@@ -1,36 +0,0 @@
1
- RSpec.describe StackMaster::SparkleFormation::CompileTime::DefinitionsValidator do
2
-
3
- describe '#validate' do
4
-
5
- let(:key) {:key}
6
- let(:definition){ {key: {type: type}} }
7
-
8
- subject {described_class.new(definition)}
9
-
10
- [:string, :number].each do |type|
11
-
12
- context "with :#{type} type definition" do
13
-
14
- let(:type) {type}
15
-
16
- it 'should not raise an exception' do
17
- expect {subject.validate}.to_not raise_error
18
- end
19
-
20
- end
21
-
22
- end
23
-
24
- context 'with other type definition' do
25
-
26
- let(:type) {:other}
27
-
28
- it 'should not raise an exception' do
29
- expect {subject.validate}.to raise_error(ArgumentError, "Unknown compile time parameter type: #{key}:#{type} valid types are #{[:string, :number]}")
30
- end
31
-
32
- end
33
-
34
- end
35
-
36
- end
@@ -1,47 +0,0 @@
1
- RSpec.describe StackMaster::SparkleFormation::CompileTime::EmptyValidator do
2
-
3
- describe '#validate' do
4
- let(:name) { 'name' }
5
- let(:error_message) { -> (error, _definition) { "#{name} cannot contain empty parameters:#{error.inspect}" } }
6
-
7
- context 'string validation' do
8
- let(:definition) { {type: :string} }
9
- validate_valid_parameter('a')
10
- validate_valid_parameter(['a'])
11
- validate_invalid_parameter(nil, nil)
12
- validate_invalid_parameter(['a', nil], ['a', nil])
13
- end
14
-
15
- context 'string validation with default' do
16
- let(:definition) { {type: :string, default: 'a'} }
17
- validate_valid_parameter(nil)
18
- end
19
-
20
- context 'string validation with multiples' do
21
- let(:definition) { {type: :string, multiple: true} }
22
- validate_valid_parameter('a,b')
23
- validate_invalid_parameter('a,,b', 'a,,b')
24
- end
25
-
26
- context 'string validation with multiples and defaults' do
27
- let(:definition) { {type: :string, multiple: true, default: 'a,b'} }
28
- validate_valid_parameter(nil)
29
- end
30
-
31
- context 'numerical validation' do
32
- let(:definition) { {type: :number} }
33
- validate_valid_parameter(1)
34
- validate_valid_parameter('1')
35
- validate_valid_parameter([1])
36
- validate_valid_parameter(['1'])
37
- validate_invalid_parameter(nil, nil)
38
- validate_invalid_parameter([1, nil], [1, nil])
39
- validate_invalid_parameter(['1', nil], ['1', nil])
40
- end
41
-
42
- context 'numerical validation with default' do
43
- let(:definition) { {type: :number, default: '1'} }
44
- validate_valid_parameter(nil)
45
- end
46
- end
47
- end
@@ -1,37 +0,0 @@
1
- RSpec.describe StackMaster::SparkleFormation::CompileTime::MaxLengthValidator do
2
-
3
- describe '#validate' do
4
- let(:name) { 'name' }
5
- let(:error_message) { -> (error, definition) { "#{name}:#{error} must not exceed max_length:#{definition[:max_length]} characters" } }
6
-
7
- context 'string validation' do
8
- let(:definition) { {type: :string, max_length: 1} }
9
- validate_valid_parameter('a')
10
- validate_valid_parameter(['a'])
11
- validate_invalid_parameter('ab', ['ab'])
12
- validate_invalid_parameter(['ab'], ['ab'])
13
- end
14
-
15
- context 'string validation with default value' do
16
- let(:definition) { {type: :string, max_length: 1, default: 'a'} }
17
- validate_valid_parameter(nil)
18
- end
19
-
20
- context 'string validation with multiples' do
21
- let(:definition) { {type: :string, max_length: 1, multiple: true} }
22
- validate_valid_parameter('a,a')
23
- validate_valid_parameter('a,,a')
24
- validate_invalid_parameter('a,, ab', ['ab'])
25
- end
26
-
27
- context 'string validation wtih multiples and default' do
28
- let(:definition) { {type: :string, max_length: 1, multiple: true, default: 'a,a'} }
29
- validate_valid_parameter(nil)
30
- end
31
-
32
- context 'numerical validation' do
33
- let(:definition) { {type: :number, max_length: 1} }
34
- validate_valid_parameter('ab')
35
- end
36
- end
37
- end
@@ -1,27 +0,0 @@
1
- RSpec.describe StackMaster::SparkleFormation::CompileTime::MaxSizeValidator do
2
-
3
- describe '#validate' do
4
- let(:name) { 'name' }
5
- let(:error_message) { -> (error, definition) { "#{name}:#{error} must not be greater than max_size:#{definition[:max_size]}" } }
6
-
7
- context 'numerical validation' do
8
- let(:definition) { {type: :number, max_size: 1} }
9
- validate_valid_parameter(1)
10
- validate_valid_parameter('1')
11
- validate_valid_parameter([1])
12
- validate_valid_parameter(['1'])
13
- validate_invalid_parameter(2, [2])
14
- validate_invalid_parameter('2', ['2'])
15
- end
16
-
17
- context 'numerical validation with default' do
18
- let(:definition) { {type: :number, max_size: 1, default: 1} }
19
- validate_valid_parameter(nil)
20
- end
21
-
22
- context 'string validation' do
23
- let(:definition) { {type: :string, max_size: 1} }
24
- validate_valid_parameter(2)
25
- end
26
- end
27
- end
@@ -1,36 +0,0 @@
1
- RSpec.describe StackMaster::SparkleFormation::CompileTime::MinLengthValidator do
2
-
3
- describe '#validate' do
4
- let(:name) { 'name' }
5
- let(:error_message) { -> (error, definition) { "#{name}:#{error} must be at least min_length:#{definition[:min_length]} characters" } }
6
-
7
- context 'string validation' do
8
- let(:definition) { {type: :string, min_length: 2} }
9
- validate_valid_parameter('ab')
10
- validate_valid_parameter(['ab'])
11
- validate_invalid_parameter('a', ['a'])
12
- validate_invalid_parameter(['a'], ['a'])
13
- end
14
-
15
- context 'string validation with default value' do
16
- let(:definition) { {type: :string, min_length: 2, default: 'ab'} }
17
- validate_valid_parameter(nil)
18
- end
19
-
20
- context 'string validation with multiples' do
21
- let(:definition) { {type: :string, min_length: 2, multiple: true} }
22
- validate_valid_parameter('ab,cd')
23
- validate_invalid_parameter('a,, cd', ['a', ''])
24
- end
25
-
26
- context 'string validation with multiples and default' do
27
- let(:definition) { {type: :string, min_length: 2, multiple: true, default: 'ab,cd'} }
28
- validate_valid_parameter(nil)
29
- end
30
-
31
- context 'numerical validation' do
32
- let(:definition) { {type: :number, min_length: 2} }
33
- validate_valid_parameter('a')
34
- end
35
- end
36
- end
@@ -1,28 +0,0 @@
1
- RSpec.describe StackMaster::SparkleFormation::CompileTime::MinSizeValidator do
2
-
3
- describe '#validate' do
4
- let(:name) { 'name' }
5
- let(:error_message) { -> (error, definition) { "#{name}:#{error} must not be lesser than min_size:#{definition[:min_size]}" } }
6
-
7
- context 'numerical validation' do
8
- let(:definition) { {type: :number, min_size: 1} }
9
- validate_valid_parameter(1)
10
- validate_valid_parameter('1')
11
- validate_valid_parameter([1])
12
- validate_valid_parameter(['1'])
13
- validate_invalid_parameter(0, [0])
14
- validate_invalid_parameter('0', ['0'])
15
- end
16
-
17
- context 'numerical validation with default value' do
18
- let(:definition) { {type: :number, min_size: 1, default: 1} }
19
- validate_valid_parameter(nil)
20
- end
21
-
22
- context 'string validation' do
23
- let(:definition) { {type: :string, min_size: 1} }
24
- validate_valid_parameter(0)
25
- end
26
-
27
- end
28
- end