tracing-matchers 1.2.1 → 1.3.0

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
  SHA1:
3
- metadata.gz: 13262221ac4749a6525e802b613b6397aaefd9de
4
- data.tar.gz: 1f08045a9afc6643d5c7e3b705ec0535b70871ac
3
+ metadata.gz: e36744b462688ff29eec076751f1b195b5803d9b
4
+ data.tar.gz: 20c88ccb3e32bc48f522772ff15ca81bc6ff0680
5
5
  SHA512:
6
- metadata.gz: fb0ff790e51285ac9c4838dbd595df6307725f7d5980c69bf6512b20cc418c7eccb7d110e75cf7a6b1693fff9591d0ba26ac743bae3ea547472b8b22ac514f1f
7
- data.tar.gz: c21205c8a3889c4ca4d3e85509f7dd273d7e558338cbe3f768174419c264a7aeecf805ed2427c4b4bd0b3b4ada50ae7dd104002c24bad05b1597895524cb4593
6
+ metadata.gz: b7e9dd2a5e20bccbda470c4b17fdd43f33fb87717448d5dde27699d2c200a4040ee4ee83f8f579f0bcaba7018ebd15b924febdd2234de7f998ad0f42eba92bd5
7
+ data.tar.gz: 334a86f84866721b5cec15be43507f3f04f9687dfe33037f3ca8c6fa08d1374928ff48d3f8d5a47b2371164c5e01e25ee7e442f1ecfea25d63656fa981ddc876
@@ -16,7 +16,7 @@ module Tracing
16
16
  if any?
17
17
  @actual.any?
18
18
  else
19
- @expected.all? { |k, v| @actual.key?(k) && v == @actual[k] }
19
+ @expected.all? { |k, v| @actual.key?(k) && values_match?(v, @actual[k]) }
20
20
  end
21
21
  end
22
22
 
@@ -44,6 +44,10 @@ module Tracing
44
44
  def any?
45
45
  @expected.empty?
46
46
  end
47
+
48
+ def values_match?(expected, actual)
49
+ expected.is_a?(Regexp) ? expected.match(actual) : expected == actual
50
+ end
47
51
  end
48
52
  end
49
53
  end
@@ -16,7 +16,7 @@ module Tracing
16
16
  @actual.any?
17
17
  else
18
18
  @actual.any? do |log|
19
- @expected.all? { |k, v| log.key?(k) && v == log[k] }
19
+ @expected.all? { |k, v| log.key?(k) && values_match?(v, log[k]) }
20
20
  end
21
21
  end
22
22
  end
@@ -45,6 +45,10 @@ module Tracing
45
45
  def any?
46
46
  @expected.empty?
47
47
  end
48
+
49
+ def values_match?(expected, actual)
50
+ expected.is_a?(Regexp) ? expected.match(actual) : expected == actual
51
+ end
48
52
  end
49
53
  end
50
54
  end
@@ -16,7 +16,7 @@ module Tracing
16
16
  if any?
17
17
  @actual.any?
18
18
  else
19
- @expected.all? { |k, v| @actual.key?(k) && v == @actual[k] }
19
+ @expected.all? { |k, v| @actual.key?(k) && values_match?(v, @actual[k]) }
20
20
  end
21
21
  end
22
22
 
@@ -44,6 +44,10 @@ module Tracing
44
44
  def any?
45
45
  @expected.empty?
46
46
  end
47
+
48
+ def values_match?(expected, actual)
49
+ expected.is_a?(Regexp) ? expected.match(actual) : expected == actual
50
+ end
47
51
  end
48
52
  end
49
53
  end
@@ -15,6 +15,7 @@ module Tracing
15
15
  # # Passes if span includes a tag with "tag" key, and "value" value
16
16
  # expect(span).to have_tag("key", "value")
17
17
  # expect(span).to have_tag("key" => "value")
18
+ # expect(span).to have_tag("key", /value/)
18
19
  #
19
20
  # @return [HaveTag]
20
21
  def have_tag(*args)
@@ -30,6 +31,7 @@ module Tracing
30
31
  #
31
32
  # # Passes if span includes a log entry with event: "error"
32
33
  # expect(span).to have_log(event: "error")
34
+ # expect(span).to have_log(message: /description/)
33
35
  #
34
36
  # @return [HaveTag]
35
37
  def have_log(**fields)
@@ -46,6 +48,7 @@ module Tracing
46
48
  # # Passes if span includes a baggage item with "tag" key, and "value" value
47
49
  # expect(span).to have_baggage("key", "value")
48
50
  # expect(span).to have_baggage("key" => "value")
51
+ # expect(span).to have_baggage("key", /value/)
49
52
  #
50
53
  # @return [HaveBaggage]
51
54
  def have_baggage(*args)
@@ -1,5 +1,5 @@
1
1
  module Tracing
2
2
  module Matchers
3
- VERSION = "1.2.1"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracing-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - iaintshine