stable 1.15.1 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b69520993a3ba3808f876dc99277ea8f55d35780057ca2496159959380608e43
4
- data.tar.gz: 3045dd9cc18163dfc34a3689e84c93c735a67c9c15eab1c97dbf59c1ddcd6319
3
+ metadata.gz: bee710d1902211e78d390587e4dbfb6a197d656ee093287eee10b5ed4c1549cc
4
+ data.tar.gz: 427b058e39221b1eaef983927fc385256e525107299b2807de876a69c185a4b7
5
5
  SHA512:
6
- metadata.gz: 334ae0568b719fa1ab54fb490156bfa0294d698694b4b37696cc66c062a811d42650948f033a520825590a708463aa19e464afa7894d191ccdcd1572c45b7fb3
7
- data.tar.gz: bbc04681f7685be55dbae01634184694dae2b20b7819b760ae13a1fa314a6b8d31a530171a6a3c128b8c9478088a2e6def994184379f3dc26ba884e885aea5cc
6
+ metadata.gz: c0bd7a7133974f3fc1875e68fd438739bd003177ccf037c2a88f6deb628896a8db6f0faf628e9927d534e79fb083ed6a855ad1fa11d7492e31bd0eb68453563c
7
+ data.tar.gz: 714045c3e52f275f036b5fdc9a72d63152ce6f4222190bb99e648e83106f175094fb176d28472b66262ecd30161c03159f42805ba5b79531d47cf495dd4a2f3a
data/lib/stable/fact.rb CHANGED
@@ -8,9 +8,9 @@ module Stable
8
8
  # outputs. it's a self-contained, serializable representation of a method's
9
9
  # behavior at a specific point in time.
10
10
  class Fact
11
- attr_reader :class_name, :method_name, :args, :result, :error, :actual_result, :actual_error, :status, :uuid, :signature, :name
11
+ attr_reader :class_name, :method_name, :args, :result, :error, :actual_result, :actual_error, :status, :uuid, :signature, :name, :source_file
12
12
 
13
- def initialize(class_name:, method_name:, args:, result: nil, error: nil, uuid: SecureRandom.uuid, name: nil)
13
+ def initialize(class_name:, method_name:, args:, result: nil, error: nil, uuid: SecureRandom.uuid, name: nil, source_file: nil)
14
14
  @class_name = class_name
15
15
  @method_name = method_name
16
16
  @args = args
@@ -19,7 +19,8 @@ module Stable
19
19
  @status = :pending
20
20
  @uuid = uuid
21
21
  @signature = Digest::SHA256.hexdigest("#{class_name}##{method_name}:#{args.to_json}")
22
- @name = name || SecureRandom.hex(8)
22
+ @name = name || uuid.split('-').last
23
+ @source_file = source_file
23
24
  end
24
25
 
25
26
  def name=(new_name)
@@ -51,6 +52,21 @@ module Stable
51
52
  self
52
53
  end
53
54
 
55
+ def update!
56
+ if actual_error
57
+ @error = {
58
+ class: actual_error.class.name,
59
+ message: actual_error.message,
60
+ backtrace: actual_error.backtrace
61
+ }
62
+ @result = nil
63
+ else
64
+ @result = actual_result
65
+ @error = nil
66
+ end
67
+ @status = :passed
68
+ end
69
+
54
70
 
55
71
 
56
72
  def to_jsonl
@@ -66,7 +82,7 @@ module Stable
66
82
  }.compact.to_json
67
83
  end
68
84
 
69
- def self.from_jsonl(jsonl_string)
85
+ def self.from_jsonl(jsonl_string, source_file = nil)
70
86
  data = JSON.parse(jsonl_string)
71
87
  new(
72
88
  class_name: data['class'],
@@ -75,7 +91,8 @@ module Stable
75
91
  result: data['result'],
76
92
  error: data['error'],
77
93
  uuid: data['uuid'],
78
- name: data['name']
94
+ name: data['name'],
95
+ source_file: source_file
79
96
  )
80
97
  end
81
98
 
@@ -1,3 +1,3 @@
1
1
  module Stable
2
- VERSION = "1.15.1"
2
+ VERSION = "1.16.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.1
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Lunt
@@ -13,18 +13,17 @@ dependencies:
13
13
  name: rake
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
18
  version: '13.0'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ">="
23
+ - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '13.0'
26
- description: an automatic unit test system that captures your usage and records it
27
- for future playback
26
+ description: regression testing is all you need
28
27
  email: jefflunt@gmail.com
29
28
  executables: []
30
29
  extensions: []
@@ -57,6 +56,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
56
  requirements: []
58
57
  rubygems_version: 3.6.9
59
58
  specification_version: 4
60
- summary: an automatic unit test system that captures your usage and records it for
61
- future playback
59
+ summary: an automatic unit/regression test system that captures your usage and records
60
+ it for future playback
62
61
  test_files: []