statesman 7.0.1 → 7.1.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
  SHA256:
3
- metadata.gz: 4e098c0148958526a38807f1019f76735c627dcd57124bd61108c52ec5d468a1
4
- data.tar.gz: 7ee21582573f6aa3887b5081e96850080ad450afeec1431365fcab492ef8fc1a
3
+ metadata.gz: d3c4334aeb972468799292be667b537dddf997d9fe065521cfe9454ed938b2a7
4
+ data.tar.gz: d78b8accf1d41e1da296d4e815c660df4889320bd2d40e85ee680061e9c2d947
5
5
  SHA512:
6
- metadata.gz: bcc7845c4fe7e31640bfa956f7aae786fd3bbbc395af0a5266e1b18c67cd309265e9b6076cd6ba75c90802f48a1e95c716cd39f5303e7410063b403cc0eec3d1
7
- data.tar.gz: b359e526717980326362978645a5abcd2c1fd8eeaa07ddb6ea41212100c05d4588e752791bf9592495abf6e30d06cb7ea488825266caf3440f66dbd4d22bc903
6
+ metadata.gz: 582292d37d4cd51742ad15894a2c1fe0b93894d1337d9631ecc7fd4ca0f6ff7e33c0ce9889729cad4d10490def304b4336ea843121bb751d89256ef0b034c647
7
+ data.tar.gz: 129e07afb181e19af2b89443740449b799616aaacf07e4bf3224417ae3c97cae376ba923ac979c2ada15111d54f844036e3e0ea8b9e7870e0300258736138e2a
@@ -1,3 +1,8 @@
1
+ ## v7.1.0, 10th Feb 2020
2
+
3
+ - Fix `to_s` on `TransitionFailedError` & `GuardFailedError`. `.message` and
4
+ `.to_s` diverged when `from` and `to` accessors where added in v4.1.3
5
+
1
6
  ## v7.0.1, 8th Jan 2020
2
7
 
3
8
  - Fix deprecation warning with Ruby 2.7 [#386](https://github.com/gocardless/statesman/pull/386)
data/Gemfile CHANGED
@@ -14,5 +14,5 @@ end
14
14
 
15
15
  group :development do
16
16
  # test/unit is no longer bundled with Ruby 2.2, but required by Rails
17
- gem "test-unit", "~> 3.0" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.2.0")
17
+ gem "test-unit", "~> 3.3" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.2.0")
18
18
  end
data/README.md CHANGED
@@ -30,7 +30,7 @@ protection.
30
30
  To get started, just add Statesman to your `Gemfile`, and then run `bundle`:
31
31
 
32
32
  ```ruby
33
- gem 'statesman', '~> 7.0.1'
33
+ gem 'statesman', '~> 7.1.0'
34
34
  ```
35
35
 
36
36
  ## Usage
@@ -4,16 +4,21 @@ module Statesman
4
4
  class InvalidStateError < StandardError; end
5
5
  class InvalidTransitionError < StandardError; end
6
6
  class InvalidCallbackError < StandardError; end
7
+ class TransitionConflictError < StandardError; end
8
+ class MissingTransitionAssociation < StandardError; end
7
9
 
8
10
  class TransitionFailedError < StandardError
9
11
  def initialize(from, to)
10
12
  @from = from
11
13
  @to = to
14
+ super(_message)
12
15
  end
13
16
 
14
17
  attr_reader :from, :to
15
18
 
16
- def message
19
+ private
20
+
21
+ def _message
17
22
  "Cannot transition from '#{from}' to '#{to}'"
18
23
  end
19
24
  end
@@ -22,18 +27,18 @@ module Statesman
22
27
  def initialize(from, to)
23
28
  @from = from
24
29
  @to = to
30
+ super(_message)
25
31
  end
26
32
 
27
33
  attr_reader :from, :to
28
34
 
29
- def message
35
+ private
36
+
37
+ def _message
30
38
  "Guard on transition from: '#{from}' to '#{to}' returned false"
31
39
  end
32
40
  end
33
41
 
34
- class TransitionConflictError < StandardError; end
35
- class MissingTransitionAssociation < StandardError; end
36
-
37
42
  class UnserializedMetadataError < StandardError
38
43
  def initialize(transition_class_name)
39
44
  super(_message(transition_class_name))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Statesman
4
- VERSION = "7.0.1"
4
+ VERSION = "7.1.0"
5
5
  end
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ describe Statesman do
6
+ describe "InvalidStateError" do
7
+ subject(:error) { Statesman::InvalidStateError.new }
8
+
9
+ its(:message) { is_expected.to eq("Statesman::InvalidStateError") }
10
+ its "string matches its message" do
11
+ expect(error.to_s).to eq(error.message)
12
+ end
13
+ end
14
+
15
+ describe "InvalidTransitionError" do
16
+ subject(:error) { Statesman::InvalidTransitionError.new }
17
+
18
+ its(:message) { is_expected.to eq("Statesman::InvalidTransitionError") }
19
+ its "string matches its message" do
20
+ expect(error.to_s).to eq(error.message)
21
+ end
22
+ end
23
+
24
+ describe "InvalidCallbackError" do
25
+ subject(:error) { Statesman::InvalidTransitionError.new }
26
+
27
+ its(:message) { is_expected.to eq("Statesman::InvalidTransitionError") }
28
+ its "string matches its message" do
29
+ expect(error.to_s).to eq(error.message)
30
+ end
31
+ end
32
+
33
+ describe "TransitionConflictError" do
34
+ subject(:error) { Statesman::TransitionConflictError.new }
35
+
36
+ its(:message) { is_expected.to eq("Statesman::TransitionConflictError") }
37
+ its "string matches its message" do
38
+ expect(error.to_s).to eq(error.message)
39
+ end
40
+ end
41
+
42
+ describe "MissingTransitionAssociation" do
43
+ subject(:error) { Statesman::MissingTransitionAssociation.new }
44
+
45
+ its(:message) { is_expected.to eq("Statesman::MissingTransitionAssociation") }
46
+ its "string matches its message" do
47
+ expect(error.to_s).to eq(error.message)
48
+ end
49
+ end
50
+
51
+ describe "TransitionFailedError" do
52
+ subject(:error) { Statesman::TransitionFailedError.new("from", "to") }
53
+
54
+ its(:message) { is_expected.to eq("Cannot transition from 'from' to 'to'") }
55
+ its "string matches its message" do
56
+ expect(error.to_s).to eq(error.message)
57
+ end
58
+ end
59
+
60
+ describe "GuardFailedError" do
61
+ subject(:error) { Statesman::GuardFailedError.new("from", "to") }
62
+
63
+ its(:message) do
64
+ is_expected.to eq("Guard on transition from: 'from' to 'to' returned false")
65
+ end
66
+ its "string matches its message" do
67
+ expect(error.to_s).to eq(error.message)
68
+ end
69
+ end
70
+
71
+ describe "UnserializedMetadataError" do
72
+ subject(:error) { Statesman::UnserializedMetadataError.new("foo") }
73
+
74
+ its(:message) { is_expected.to match(/foo#metadata is not serialized/) }
75
+ its "string matches its message" do
76
+ expect(error.to_s).to eq(error.message)
77
+ end
78
+ end
79
+
80
+ describe "IncompatibleSerializationError" do
81
+ subject(:error) { Statesman::IncompatibleSerializationError.new("foo") }
82
+
83
+ its(:message) { is_expected.to match(/foo#metadata column type cannot be json/) }
84
+ its "string matches its message" do
85
+ expect(error.to_s).to eq(error.message)
86
+ end
87
+ end
88
+ end
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "rspec-its", "~> 1.1"
34
34
  spec.add_development_dependency "rspec-rails", "~> 3.1"
35
35
  spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.0"
36
- spec.add_development_dependency "sqlite3", "~> 1.3.6"
36
+ spec.add_development_dependency "sqlite3", "~> 1.4.2"
37
37
  spec.add_development_dependency "timecop", "~> 0.9.1"
38
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statesman
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-08 00:00:00.000000000 Z
11
+ date: 2020-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ammeter
@@ -190,14 +190,14 @@ dependencies:
190
190
  requirements:
191
191
  - - "~>"
192
192
  - !ruby/object:Gem::Version
193
- version: 1.3.6
193
+ version: 1.4.2
194
194
  type: :development
195
195
  prerelease: false
196
196
  version_requirements: !ruby/object:Gem::Requirement
197
197
  requirements:
198
198
  - - "~>"
199
199
  - !ruby/object:Gem::Version
200
- version: 1.3.6
200
+ version: 1.4.2
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: timecop
203
203
  requirement: !ruby/object:Gem::Requirement
@@ -266,6 +266,7 @@ files:
266
266
  - spec/statesman/adapters/shared_examples.rb
267
267
  - spec/statesman/callback_spec.rb
268
268
  - spec/statesman/config_spec.rb
269
+ - spec/statesman/exceptions_spec.rb
269
270
  - spec/statesman/guard_spec.rb
270
271
  - spec/statesman/machine_spec.rb
271
272
  - spec/statesman/utils_spec.rb
@@ -310,6 +311,7 @@ test_files:
310
311
  - spec/statesman/adapters/shared_examples.rb
311
312
  - spec/statesman/callback_spec.rb
312
313
  - spec/statesman/config_spec.rb
314
+ - spec/statesman/exceptions_spec.rb
313
315
  - spec/statesman/guard_spec.rb
314
316
  - spec/statesman/machine_spec.rb
315
317
  - spec/statesman/utils_spec.rb