rspec-terraform 0.1.0.pre.5 → 0.1.0.pre.6

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: c06106892455a71f5b806b4fa05c3127fed7fe1de42a780b22544a14704e37fd
4
- data.tar.gz: 948a06ff35e8bc83065ccd45d8b00ca90e3e06a646caaa85201325cd12ff1021
3
+ metadata.gz: 2cbb4df56947d1db97fd3a8dc56702f1a54549775d48a01c24aa2ca6d3466b44
4
+ data.tar.gz: 9aae54a4a4e1f9d0586a3da995b1cd522bd1b49fdbd6ace31be7c3e145eba567
5
5
  SHA512:
6
- metadata.gz: 11b85d1fd0a354b73cf2cd04c54ac3851de3ce5c9f193a33c7d6dd1906bb71d995f62dda9e641b0d045403a60305ec6f88c0eb989e77dd9dbf3cd805863b3fe8
7
- data.tar.gz: ced24b8238a9117f8d07049271c3d7f37e5b1f700096a00d373ee6a82e7f1972d3cf6201a1bae17aa91bb14ea31c536e50c04e0707d33a8601750a9777391810
6
+ metadata.gz: 1a383a45a80f7058b11c565e91bc783337d2b6f6a2e1d741492d9c159676f039a3e42cd25cb229939b93a82d174132da05810caa7be8310b2418675c79a0d445
7
+ data.tar.gz: a30d834d32b46b724e4222dbb657a9151378ad775b6089cd40422d8844c328aad0c591078327ff8d5aef0c333988663bf2ec9e4b22e2e03773ab2bb850d70bb9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-terraform (0.1.0.pre.5)
4
+ rspec-terraform (0.1.0.pre.6)
5
5
  rspec (>= 3.0)
6
6
  ruby-terraform (= 1.7.0.pre.3)
7
7
 
data/Rakefile CHANGED
@@ -84,7 +84,7 @@ RakeCircleCI.define_project_tasks(
84
84
  t.environment_variables = {
85
85
  ENCRYPTION_PASSPHRASE:
86
86
  File.read('config/secrets/ci/encryption.passphrase')
87
- .chomp
87
+ .chomp
88
88
  }
89
89
  t.checkout_keys = []
90
90
  t.ssh_keys = [
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'rspec/core'
4
+ require 'rspec/matchers'
5
+ require 'rspec/matchers/built_in/eq'
3
6
  require 'rspec/matchers/built_in/count_expectation'
4
7
 
5
8
  module RSpec
@@ -44,12 +47,29 @@ module RSpec
44
47
  change = resource_change.change
45
48
  after = change.after_object
46
49
  @attributes.all? do |attribute|
47
- expected = RubyTerraform::Models::Objects.box(attribute[:value])
48
- actual = after.dig(*attribute[:path])
49
- actual == expected
50
+ matcher = attribute_matcher(attribute)
51
+ value = attribute_value(after, attribute)
52
+ matcher.matches?(value)
50
53
  end
51
54
  end
52
55
  end
56
+
57
+ def attribute_matcher(attribute)
58
+ expected = attribute[:value]
59
+ return expected if expected.respond_to?(:matches?)
60
+
61
+ RSpec::Matchers::BuiltIn::Eq.new(
62
+ RubyTerraform::Models::Objects.box(expected)
63
+ )
64
+ end
65
+
66
+ def attribute_value(object, attribute)
67
+ expected = attribute[:value]
68
+ actual = object.dig(*attribute[:path])
69
+ return actual&.value if expected.respond_to?(:matches?)
70
+
71
+ actual
72
+ end
53
73
  end
54
74
  end
55
75
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Terraform
5
- VERSION = '0.1.0.pre.5'
5
+ VERSION = '0.1.0.pre.6'
6
6
  end
7
7
  end
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.5
4
+ version: 0.1.0.pre.6
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-07-14 00:00:00.000000000 Z
11
+ date: 2022-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec