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 +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/lib/statesman/exceptions.rb +10 -5
- data/lib/statesman/version.rb +1 -1
- data/spec/statesman/exceptions_spec.rb +88 -0
- data/statesman.gemspec +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3c4334aeb972468799292be667b537dddf997d9fe065521cfe9454ed938b2a7
|
4
|
+
data.tar.gz: d78b8accf1d41e1da296d4e815c660df4889320bd2d40e85ee680061e9c2d947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 582292d37d4cd51742ad15894a2c1fe0b93894d1337d9631ecc7fd4ca0f6ff7e33c0ce9889729cad4d10490def304b4336ea843121bb751d89256ef0b034c647
|
7
|
+
data.tar.gz: 129e07afb181e19af2b89443740449b799616aaacf07e4bf3224417ae3c97cae376ba923ac979c2ada15111d54f844036e3e0ea8b9e7870e0300258736138e2a
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
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
data/lib/statesman/exceptions.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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))
|
data/lib/statesman/version.rb
CHANGED
@@ -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
|
data/statesman.gemspec
CHANGED
@@ -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.
|
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
|
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-
|
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.
|
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.
|
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
|