mattsnyder-stately 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stately (0.2.0)
4
+ mattsnyder-stately (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -26,9 +26,9 @@ PLATFORMS
26
26
  ruby
27
27
 
28
28
  DEPENDENCIES
29
+ mattsnyder-stately!
29
30
  rake
30
31
  rdoc
31
32
  redcarpet (~> 2.2.2)
32
33
  rspec (~> 2.0)
33
- stately!
34
34
  yard (~> 0.8.3)
data/lib/stately/state.rb CHANGED
@@ -56,7 +56,7 @@ module Stately
56
56
  :saving => :save, :searching => :search, :started => :start, :stopped => :stop }
57
57
 
58
58
  def guess_action_for(name)
59
- ACTIONS[name.to_sym]
59
+ ACTIONS.fetch(name.to_sym, name)
60
60
  end
61
61
 
62
62
  class StateConfigurator
@@ -1,3 +1,3 @@
1
1
  module Stately
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -4,8 +4,8 @@ require 'spec_helper'
4
4
  describe Stately do
5
5
  before do
6
6
  @order_class = Class.new(OpenStruct) do
7
- stately :start => :processing do
8
- state :completed do
7
+ stately :start => :processing, :attr => :state do
8
+ state :completed, :action => :complete do
9
9
  prevent_from :refunded
10
10
 
11
11
  before_transition :from => :processing, :do => :before_completed
@@ -16,7 +16,7 @@ describe Stately do
16
16
  validate :validates_credit_card
17
17
  end
18
18
 
19
- state :invalid do
19
+ state :invalid, :action => :invalidate do
20
20
  prevent_from :completed, :refunded
21
21
  end
22
22
 
@@ -2,6 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe Stately::State do
4
4
  describe 'initialize' do
5
+ describe 'with an unrecognized action' do
6
+ it 'should not have an empty string for an action' do
7
+ state = Stately::State.new :pending
8
+ state.action.should == "pending"
9
+ end
10
+ end
11
+
5
12
  describe 'with a block given' do
6
13
  describe 'new' do
7
14
  before do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mattsnyder-stately
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Twomey