rspec-terraform 0.1.0.pre.13 → 0.1.0.pre.14

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: 3cc8147616146ae0fde066315865ff6c1bfb32ac516da81783cbbbe9c17be24e
4
- data.tar.gz: 58186f1efbcac84c1bccd3760ef667ea390c909dcb91e5421844b9dbab6bba3b
3
+ metadata.gz: 91f52906b222af912b150dfe8adeccfcf2a96c6397a925b16e010fe95fdedc7f
4
+ data.tar.gz: 5f8339be7af3ef1e8734e4eb20114f9da5a92a7bf01d12ccc8b25c29918b39fa
5
5
  SHA512:
6
- metadata.gz: 18228da814d613820107ea17d2abf5df5d22028c4ee701a29e14638c51261e2a4050a48f5eb447027cdcb860467c4e69f84897fb4a2747c15693f0fa08fb8c60
7
- data.tar.gz: 73361b336ce497361eb27d3c6867e29dca996d0477ba74466b0a2b13a7bce96f8d3b41ec5d2eec1902900339872b497fd4d5759478c01c75f0af36b0d3fccfed
6
+ metadata.gz: 0fc145bf6e79e9a925ede3dee1f01ff0e9d8f645da18edad9ba825d31788cb663cd018b181ea4b2a18c19051690cb4354e6267e0b6775cd06215d400c744303b
7
+ data.tar.gz: 5593bf9db223bce19a841beb644043b6d9395bb37102aa0e56a39bb7e6b7dd64c36aa6ab1e9f3e2e41c16a3027c46486e78bded63954027dddfd9fda09c950ee
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-terraform (0.1.0.pre.13)
4
+ rspec-terraform (0.1.0.pre.14)
5
5
  rspec (>= 3.0)
6
6
  ruby-terraform (= 1.7.0.pre.9)
7
7
 
@@ -21,7 +21,7 @@ GEM
21
21
  diff-lcs (1.5.0)
22
22
  docile (1.4.0)
23
23
  excon (0.92.4)
24
- faker (2.21.0)
24
+ faker (2.22.0)
25
25
  i18n (>= 1.8.11, < 2)
26
26
  faraday (2.3.0)
27
27
  faraday-net_http (~> 2.0)
@@ -142,4 +142,4 @@ DEPENDENCIES
142
142
  simplecov
143
143
 
144
144
  BUNDLED WITH
145
- 2.3.18
145
+ 2.3.19
@@ -138,16 +138,26 @@ module RSpec
138
138
  "a plan including #{amount} matching " \
139
139
  "resource change#{plurality}."
140
140
 
141
- unless attributes.empty?
142
- got_line =
143
- "#{got_line}\n relevant resource changes are:" \
144
- "\n#{relevant_resource_change_lines}"
145
- end
141
+ with_available_resource_changes(
142
+ maybe_with_relevant_resource_changes(got_line)
143
+ )
144
+ end
145
+ end
146
146
 
147
- "#{got_line}\n available resource changes are:" \
148
- "\n#{available_resource_change_lines}"
147
+ def with_available_resource_changes(got_line)
148
+ "#{got_line}\n available resource changes are:" \
149
+ "\n#{available_resource_change_lines}"
150
+ end
151
+
152
+ def maybe_with_relevant_resource_changes(got_line)
153
+ unless attributes.empty?
154
+ got_line =
155
+ "#{got_line}\n relevant resource changes are:" \
156
+ "\n#{relevant_resource_change_lines}"
149
157
  end
158
+ got_line
150
159
  end
160
+
151
161
  # rubocop:enable Metrics/MethodLength
152
162
 
153
163
  def cardinality_fragment
@@ -185,7 +195,9 @@ module RSpec
185
195
  def expected_attribute_lines
186
196
  paths = attributes.collect { |attribute| attribute[:path] }
187
197
  path_set = RubyTerraform::Models::PathSet.new(paths)
188
- values = attributes.collect { |attribute| attribute[:value] }
198
+ values = attributes.collect do |attribute|
199
+ with_matcher_renderable(attribute[:value])
200
+ end
189
201
  object = RubyTerraform::Models::Objects.object(path_set, values)
190
202
  object.render(level: 6, bare: true)
191
203
  end
@@ -210,6 +222,16 @@ module RSpec
210
222
  end
211
223
  available_lines.join("\n")
212
224
  end
225
+
226
+ def with_matcher_renderable(value)
227
+ return value if value.respond_to?(:render)
228
+
229
+ value.define_singleton_method(:render) do |_|
230
+ "a value satisfying: #{value.description}"
231
+ end
232
+
233
+ value
234
+ end
213
235
  end
214
236
 
215
237
  # rubocop:enable Metrics/ClassLength
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Terraform
5
- VERSION = '0.1.0.pre.13'
5
+ VERSION = '0.1.0.pre.14'
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.13
4
+ version: 0.1.0.pre.14
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-26 00:00:00.000000000 Z
11
+ date: 2022-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec