rails-workflow 1.4.15 → 1.4.16

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
  SHA1:
3
- metadata.gz: 496511a22669487248da6270b1cb4de7f972f567
4
- data.tar.gz: bf4495a61f0c5cc6e1d10933422c8daa089b411b
3
+ metadata.gz: 583ee5eba2d338478a47f49f720fc041f503d0e9
4
+ data.tar.gz: d5a7b0285e181674f31d58f695cf495dd58f5dc3
5
5
  SHA512:
6
- metadata.gz: 4ff9cc3fb0a6bedfa00fbcb201dc49e5e96eef4ff6d89dfa316806feae5add98d66e76eeec521d7cf304666252a827a7ad6d58846fd88bda0fecd5f7ab0b96ba
7
- data.tar.gz: 7bba5a9e6b29770087c65a568516fd5b837ce291c9c53b012f39f13e1f537980e726f8fc563ad85f3eed464108de6488d2a786f8ecaa6e08abe37060b9c16fd4
6
+ metadata.gz: 6a3b067942dd1c66ff78269117b8f5e4cae1dc96d3946c9f8c06a2648ebcb00d10b811090bcf33101f0df13a92c8d6153defddee8b7f1177f918238e8e3a1c5b
7
+ data.tar.gz: dc71f92fd5a70ab7360ee6784914d24400f518105a5741f0c0a59d9b1cf1baa85154d6c2036c0dcb3b7b66906e104367ed1a840d63a87ae1f2b0951d33eeea64
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -35,9 +35,8 @@ module Workflow
35
35
  end
36
36
 
37
37
  class StateComparisonError < StandardError
38
- def initialize(state)
39
- super("Other State #{state} is a #{state.class}.
40
- I can only be compared with a Workflow::State.".squish)
38
+ def initialize(state, other)
39
+ super("Can't compare #{state} with #{other} bc [#{other}] is not a defined state.")
41
40
  end
42
41
  end
43
42
 
@@ -114,6 +114,10 @@ module Workflow
114
114
  "<State name=#{name.inspect} events(#{events.length})=#{events.inspect}>"
115
115
  end
116
116
 
117
+ def to_s
118
+ name.to_s
119
+ end
120
+
117
121
  # Overloaded comparison operator. Workflow states are sorted according to the order
118
122
  # in which they were defined.
119
123
  #
@@ -121,7 +125,9 @@ module Workflow
121
125
  # @return [Integer]
122
126
  def <=>(other)
123
127
  if other.is_a?(Symbol)
124
- other = all_states.find { |state| state.name == other }
128
+ state = all_states.find { |s| s.name == other }
129
+ raise Errors::StateComparisonError.new(self, other) unless state
130
+ other = state
125
131
  end
126
132
  all_states.index(self) <=> all_states.index(other)
127
133
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Workflow
3
- VERSION = '1.4.15'
3
+ VERSION = '1.4.16'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.15
4
+ version: 1.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Gannon
@@ -211,6 +211,7 @@ files:
211
211
  - asdf
212
212
  - bin/console
213
213
  - bin/deploy
214
+ - bin/rspec
214
215
  - bin/setup
215
216
  - gemfiles/Gemfile.rails-3.x
216
217
  - gemfiles/Gemfile.rails-4.0