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 +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +1 -1
- data/lib/rspec/terraform/matchers/include_resource_change.rb +23 -3
- data/lib/rspec/terraform/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cbb4df56947d1db97fd3a8dc56702f1a54549775d48a01c24aa2ca6d3466b44
|
4
|
+
data.tar.gz: 9aae54a4a4e1f9d0586a3da995b1cd522bd1b49fdbd6ace31be7c3e145eba567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a383a45a80f7058b11c565e91bc783337d2b6f6a2e1d741492d9c159676f039a3e42cd25cb229939b93a82d174132da05810caa7be8310b2418675c79a0d445
|
7
|
+
data.tar.gz: a30d834d32b46b724e4222dbb657a9151378ad775b6089cd40422d8844c328aad0c591078327ff8d5aef0c333988663bf2ec9e4b22e2e03773ab2bb850d70bb9
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -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
|
-
|
48
|
-
|
49
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2022-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|