rspec-terraform 0.1.0.pre.39 → 0.1.0.pre.40

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: d9e77a423f915bda9a4d02a980a21a1755a6dde139dc3d1890414eacfa72c1c8
4
- data.tar.gz: 6e2ff10778fd5641f717fb2cf9e23d59e39312179a76cffa40d49ece0ae7a001
3
+ metadata.gz: 12e11f477f99fd41080131cf322d8d6dedf40645e04bb41b66de3b5cee3128b5
4
+ data.tar.gz: 47ccbe633464a8a414b9ea950a27c664bae5bef3e60155463b9a979f398900ac
5
5
  SHA512:
6
- metadata.gz: a74ba985ec614bcdf6bcf1c9d031d663341f5f41a40feb513d03313d41cbbd97104c784c806ca5a64b38dffeaf5eea822722a0db2e3f1f78bd402ab18a19093a
7
- data.tar.gz: e7c2d9563eb65a3931a4d51d775d1c07e9449a748b15cd1a06e1404a3c9d74d4f65634674d2a88ce736982a75642a3bfb2d6bcadeaef39db9f2182dacc3b3a51
6
+ metadata.gz: 19aa8f5adeedf3bc1a71129205363f7eca9a843d47462345c34ee8a36358ee35e9d4ad2ea9bf1ac63bb8846c789181c88039428cc1514bfbd1f500ce3ca7b145
7
+ data.tar.gz: 3c338a356d1ad4ff0264f1bcef7e756ea743c0f3582865bb62cfaadcc6bb539b4467a7c239836cb0c5f285362d313d9f1ab22aca62203d55816cdc8855c69287
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-terraform (0.1.0.pre.39)
4
+ rspec-terraform (0.1.0.pre.40)
5
5
  confidante (>= 0.27)
6
6
  rspec (>= 3.0)
7
7
  ruby-terraform (= 1.7.0.pre.16)
@@ -205,4 +205,4 @@ DEPENDENCIES
205
205
  terminal-notifier-guard
206
206
 
207
207
  BUNDLED WITH
208
- 2.3.21
208
+ 2.3.22
@@ -5,11 +5,15 @@ module RSpec
5
5
  module Logging
6
6
  class << self
7
7
  def resolve_streams(opts = {})
8
- streams = opts[:streams] || []
8
+ opts = resolve_opts(opts)
9
+ streams = opts[:streams]
10
+ level = opts[:level]
9
11
  devices = devices(opts)
10
12
 
13
+ resolve_opts(opts)
14
+
11
15
  {
12
- logger: resolve_logger(opts[:logger], streams, devices),
16
+ logger: resolve_logger(opts[:logger], streams, devices, level),
13
17
  stdout: resolve_stdout(opts[:stdout], streams, devices),
14
18
  stderr: resolve_stderr(opts[:stderr], streams, devices)
15
19
  }
@@ -17,14 +21,28 @@ module RSpec
17
21
 
18
22
  private
19
23
 
20
- def resolve_logger(logger, streams, devices)
24
+ def resolve_opts(opts)
25
+ streams = opts[:streams] || []
26
+ level = opts[:level] || Logger::INFO
27
+
28
+ if streams.include?(:file) && !opts[:file_path]
29
+ raise(
30
+ ArgumentError,
31
+ 'File logging requested but no file path provided'
32
+ )
33
+ end
34
+
35
+ opts.merge(streams: streams, level: level)
36
+ end
37
+
38
+ def resolve_logger(logger, streams, devices, level)
21
39
  return logger if logger
22
40
 
23
41
  log_devices = []
24
42
  log_devices << devices[:file] if streams.include?(:file)
25
43
  log_devices << devices[:stdout] if streams.include?(:standard)
26
44
 
27
- multi_io(log_devices)
45
+ Logger.new(multi_io(log_devices), level: level)
28
46
  end
29
47
 
30
48
  def resolve_stdout(stdout, streams, devices)
@@ -50,7 +68,7 @@ module RSpec
50
68
  def devices(opts)
51
69
  {
52
70
  file: log_device(opts[:file_path] || File::NULL),
53
- stdout: log_device($stdout),
71
+ stdout: log_device(opts[:stdout] || $stdout),
54
72
  stderr: log_device($stderr)
55
73
  }
56
74
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Terraform
5
- VERSION = '0.1.0.pre.39'
5
+ VERSION = '0.1.0.pre.40'
6
6
  end
7
7
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rspec/core'
4
4
  require 'ruby_terraform'
5
+ require 'logger'
5
6
 
6
7
  require_relative 'terraform/version'
7
8
  require_relative 'terraform/configuration'
@@ -12,7 +13,6 @@ require_relative 'terraform/logging'
12
13
  # TODO
13
14
  # ====
14
15
  #
15
- # * Logging
16
16
  # * Test session
17
17
  # * Before support in matchers
18
18
  # * Reference support in matchers
@@ -27,6 +27,7 @@ RSpec.configure do |config|
27
27
  config.add_setting(:terraform_binary, default: 'terraform')
28
28
 
29
29
  config.add_setting(:terraform_log_file_path, default: nil)
30
+ config.add_setting(:terraform_log_level, default: Logger::INFO)
30
31
  config.add_setting(:terraform_log_streams, default: [:standard])
31
32
 
32
33
  config.add_setting(:terraform_logger, default: nil)
@@ -44,6 +45,7 @@ RSpec.configure do |config|
44
45
  config.before(:suite) do
45
46
  resolved_streams = RSpec::Terraform::Logging.resolve_streams(
46
47
  file_path: RSpec.configuration.terraform_log_file_path,
48
+ level: RSpec.configuration.terraform_log_level,
47
49
  streams: RSpec.configuration.terraform_log_streams,
48
50
  logger: RSpec.configuration.terraform_logger,
49
51
  stdout: RSpec.configuration.terraform_stdout,
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.39
4
+ version: 0.1.0.pre.40
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-09-03 00:00:00.000000000 Z
11
+ date: 2022-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: confidante