rspec-terraform 0.1.0.pre.30 → 0.1.0.pre.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b023d70b2108c48cd8043ce090e91a5232d32df7cef1b14c0045bd29a5742196
4
- data.tar.gz: c335a6a00992aa894ede64d821be06033727ae056182f475244d77e720b23b35
3
+ metadata.gz: 7dea956c8c5abc31548bcb8f4eaa21fd8e16525bf4c42e0781642d97727f75ca
4
+ data.tar.gz: bb4a391fd05d49ba05358601d23b7009d2ebdff65c2f6d74c3a2f3dbfc60d6f1
5
5
  SHA512:
6
- metadata.gz: 922d9f5a1ca42a48a49cca3880d3bd3e36530bd0311d90e431a113c4eec359af133a7a5f1c24be311dd85d026584aeebf05f103ac88e6adf2ae021b2639a8648
7
- data.tar.gz: e344912487fe48386df455ae61ef00d9e22075211f6317f7b45ccbb4905938811187394daac4ec04800f9b9934dc3bbb06c8755f523a9a44e4c620e825a1d28d
6
+ metadata.gz: '04383fb4bdd8db184a3b6eed0bee9e60c505dcc8c5d019a65b2d605c12be2fa4f704da2f9a0f0e09759c0c68810df28ea01832045283a24ba0a131cb300ba9e7'
7
+ data.tar.gz: 50e0c7064dd23172e417773b4f3bd0d9017e1517d8128a26b76304b929604d0a6d41493b2cf38a444fd9a9ee5d8febdc3c310907a18beb60ae59a179f9a6df5b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-terraform (0.1.0.pre.30)
4
+ rspec-terraform (0.1.0.pre.33)
5
5
  confidante (>= 0.27)
6
6
  rspec (>= 3.0)
7
7
  ruby-terraform (= 1.7.0.pre.15)
@@ -7,6 +7,7 @@ module RSpec
7
7
  module Configuration
8
8
  module Providers
9
9
  class Base
10
+ def resolve(_ = {}); end
10
11
  def reset; end
11
12
  end
12
13
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby_terraform'
4
+
5
+ require_relative './base'
6
+
7
+ module RSpec
8
+ module Terraform
9
+ module Configuration
10
+ module Providers
11
+ class Chain < Base
12
+ attr_reader(:providers)
13
+
14
+ def initialize(opts = {})
15
+ super()
16
+ @providers = opts[:providers] || []
17
+ end
18
+
19
+ def resolve(overrides = {})
20
+ providers.reduce(overrides) do |acc, provider|
21
+ provider.resolve(acc)
22
+ end
23
+ end
24
+
25
+ def reset
26
+ providers.each { |provider| provider.reset }
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -4,6 +4,7 @@ require_relative 'providers/identity'
4
4
  require_relative 'providers/in_memory'
5
5
  require_relative 'providers/confidante'
6
6
  require_relative 'providers/seed'
7
+ require_relative 'providers/chain'
7
8
 
8
9
  module RSpec
9
10
  module Terraform
@@ -12,13 +12,21 @@ module RSpec
12
12
  Providers::Identity.new
13
13
  end
14
14
 
15
- def in_memory_provider(opts)
15
+ def in_memory_provider(opts = {})
16
16
  Providers::InMemory.new(opts)
17
17
  end
18
18
 
19
- def confidante_provider(opts)
19
+ def confidante_provider(opts = {})
20
20
  Providers::Confidante.new(opts)
21
21
  end
22
+
23
+ def seed_provider(opts = {})
24
+ Providers::Seed.new(opts)
25
+ end
26
+
27
+ def chain_provider(opts = {})
28
+ Providers::Chain.new(opts)
29
+ end
22
30
  end
23
31
  end
24
32
  end
@@ -9,18 +9,17 @@ module RSpec
9
9
  module Helpers
10
10
  class Apply
11
11
  attr_reader(
12
- :overrides, :configuration_provider, :binary, :execution_mode
12
+ :configuration_provider, :binary, :execution_mode
13
13
  )
14
14
 
15
- def initialize(overrides = {}, configuration_provider = nil)
16
- @overrides = overrides
15
+ def initialize(opts = {})
17
16
  @configuration_provider =
18
- configuration_provider || Configuration.identity_provider
17
+ opts[:configuration_provider] || Configuration.identity_provider
19
18
  @binary = RSpec.configuration.terraform_binary
20
19
  @execution_mode = RSpec.configuration.terraform_execution_mode
21
20
  end
22
21
 
23
- def execute(&block)
22
+ def execute(overrides = {}, &block)
24
23
  parameters = with_configuration_provider_parameters(overrides)
25
24
  parameters = with_resolved_vars(parameters, &block)
26
25
  parameters = with_mandatory_parameters(parameters)
@@ -9,18 +9,17 @@ module RSpec
9
9
  module Helpers
10
10
  class Destroy
11
11
  attr_reader(
12
- :overrides, :configuration_provider, :binary, :execution_mode
12
+ :configuration_provider, :binary, :execution_mode
13
13
  )
14
14
 
15
- def initialize(overrides = {}, configuration_provider = nil)
16
- @overrides = overrides
15
+ def initialize(opts = {})
17
16
  @configuration_provider =
18
- configuration_provider || Configuration.identity_provider
17
+ opts[:configuration_provider] || Configuration.identity_provider
19
18
  @binary = RSpec.configuration.terraform_binary
20
19
  @execution_mode = RSpec.configuration.terraform_execution_mode
21
20
  end
22
21
 
23
- def execute(&block)
22
+ def execute(overrides = {}, &block)
24
23
  parameters = with_configuration_provider_parameters(overrides)
25
24
  parameters = with_resolved_vars(parameters, &block)
26
25
 
@@ -7,18 +7,17 @@ module RSpec
7
7
  module Helpers
8
8
  class Output
9
9
  attr_reader(
10
- :overrides, :configuration_provider, :binary, :execution_mode
10
+ :configuration_provider, :binary, :execution_mode
11
11
  )
12
12
 
13
- def initialize(overrides = {}, configuration_provider = nil)
14
- @overrides = overrides
13
+ def initialize(opts = {})
15
14
  @configuration_provider =
16
- configuration_provider || Configuration.identity_provider
15
+ opts[:configuration_provider] || Configuration.identity_provider
17
16
  @binary = RSpec.configuration.terraform_binary
18
17
  @execution_mode = RSpec.configuration.terraform_execution_mode
19
18
  end
20
19
 
21
- def execute
20
+ def execute(overrides = {})
22
21
  parameters = with_configuration_provider_parameters(overrides)
23
22
  parameters = with_mandatory_parameters(parameters)
24
23
 
@@ -12,18 +12,17 @@ module RSpec
12
12
  # rubocop:disable Metrics/ClassLength
13
13
  class Plan
14
14
  attr_reader(
15
- :overrides, :configuration_provider, :binary, :execution_mode
15
+ :configuration_provider, :binary, :execution_mode
16
16
  )
17
17
 
18
- def initialize(overrides = {}, configuration_provider = nil)
19
- @overrides = overrides
18
+ def initialize(opts = {})
20
19
  @configuration_provider =
21
- configuration_provider || Configuration.identity_provider
20
+ opts[:configuration_provider] || Configuration.identity_provider
22
21
  @binary = RSpec.configuration.terraform_binary
23
22
  @execution_mode = RSpec.configuration.terraform_execution_mode
24
23
  end
25
24
 
26
- def execute(&block)
25
+ def execute(overrides = {}, &block)
27
26
  parameters = with_configuration_provider_parameters(overrides)
28
27
  parameters = with_resolved_vars(parameters, &block)
29
28
 
@@ -6,15 +6,14 @@ module RSpec
6
6
  module Terraform
7
7
  module Helpers
8
8
  class Var
9
- attr_reader(:overrides, :configuration_provider)
9
+ attr_reader(:configuration_provider)
10
10
 
11
- def initialize(overrides = {}, configuration_provider = nil)
12
- @overrides = overrides
11
+ def initialize(opts = {})
13
12
  @configuration_provider =
14
- configuration_provider || Configuration.identity_provider
13
+ opts[:configuration_provider] || Configuration.identity_provider
15
14
  end
16
15
 
17
- def execute(&block)
16
+ def execute(overrides = {}, &block)
18
17
  parameters = with_configuration_provider_parameters(overrides)
19
18
  parameters = with_resolved_vars(parameters, &block)
20
19
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Terraform
5
- VERSION = '0.1.0.pre.30'
5
+ VERSION = '0.1.0.pre.33'
6
6
  end
7
7
  end
@@ -8,6 +8,17 @@ require_relative 'terraform/configuration'
8
8
  require_relative 'terraform/matchers'
9
9
  require_relative 'terraform/helpers'
10
10
 
11
+ # TODO
12
+ # ====
13
+ #
14
+ # * Helper functions
15
+ # * Logging
16
+ # * Test session
17
+ # * Before support in matchers
18
+ # * Reference support in matchers
19
+ # * Sensitive support in matchers
20
+ #
21
+
11
22
  RSpec.configure do |config|
12
23
  config.include(RSpec::Terraform::Matchers)
13
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.30
4
+ version: 0.1.0.pre.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfraBlocks Maintainers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-26 00:00:00.000000000 Z
11
+ date: 2022-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: confidante
@@ -297,6 +297,7 @@ files:
297
297
  - lib/rspec/terraform/configuration/merger.rb
298
298
  - lib/rspec/terraform/configuration/providers.rb
299
299
  - lib/rspec/terraform/configuration/providers/base.rb
300
+ - lib/rspec/terraform/configuration/providers/chain.rb
300
301
  - lib/rspec/terraform/configuration/providers/confidante.rb
301
302
  - lib/rspec/terraform/configuration/providers/identity.rb
302
303
  - lib/rspec/terraform/configuration/providers/in_memory.rb