statesman 0.6.0 → 0.6.1

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: b92fb09eece2e17c27b82fcca631fe7104352d64
4
- data.tar.gz: 5d998f484ea553dfc739090859711185f6d2b79d
3
+ metadata.gz: eb317c62d61044bf3d15ec90a14682f330f4ea86
4
+ data.tar.gz: df1622719c738cfdafd5925042a0ba8c0c4d612c
5
5
  SHA512:
6
- metadata.gz: c7d61e91e81cab512c7535ff42dc04428554c99db767d7efd43817119fe8387d385d005602b4bd69d10fe1f98c8e037e02ba3bd276aa0f0527a379ce3b3f8b06
7
- data.tar.gz: 790bb168d54c53c16bf86290614ad78963484d1577a17f3d03e945a69dc87d1e61f4dea5b3e3be51014c5c6ff091d108ad52f331eba61bc1d76a3d572119ec23
6
+ metadata.gz: ce715eb5662eb4758d9d637d0575d5cec80859b859400699f783088ec64cdad1a2a661cad2d816e8e14fc03f7b91ec4e4305b64d973eaad959c2112d0ea573b3
7
+ data.tar.gz: e649cc276449930c9e8615707cf993572a090635e3cdaea838d82c77f825a880243c644a368a76522b7da2c9debb2656d978e71e92538ef52240b74781fe24a3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v 0.6.1 21 May 2014
2
+ *Fixes*
3
+ - Fixes an issue where the wrong transition was passed to after_transition callbacks for the second and subsequent transition of a given state machine (patch by [@alan](https://github.com/alan))
4
+
1
5
  ## v0.6.0, 19 May 2014
2
6
  *Additions*
3
7
  - Generators now handle namespaced classes (patch by [@hrmrebecca](https://github.com/hrmrebecca))
@@ -24,6 +24,7 @@ module Statesman
24
24
  ::ActiveRecord::Base.transaction do
25
25
  @observer.execute(:before, from, to, transition)
26
26
  transition.save!
27
+ @last_transition = transition
27
28
  @observer.execute(:after, from, to, transition)
28
29
  @last_transition = nil
29
30
  end
@@ -22,6 +22,7 @@ module Statesman
22
22
 
23
23
  @observer.execute(:before, from, to, transition)
24
24
  transition.save!
25
+ @last_transition = transition
25
26
  @observer.execute(:after, from, to, transition)
26
27
  @observer.execute(:after_commit, from, to, transition)
27
28
  @last_transition = nil
@@ -1,3 +1,3 @@
1
1
  module Statesman
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -29,6 +29,7 @@ shared_examples_for "an adapter" do |adapter_class, transition_class|
29
29
  describe "#create" do
30
30
  let(:from) { :x }
31
31
  let(:to) { :y }
32
+ let(:there) { :z }
32
33
  let(:create) { adapter.create(from, to) }
33
34
  subject { -> { create } }
34
35
 
@@ -71,6 +72,16 @@ shared_examples_for "an adapter" do |adapter_class, transition_class|
71
72
  end.once
72
73
  adapter.create(from, to)
73
74
  end
75
+
76
+ it "exposes the new transition for subsequent transitions" do
77
+ adapter.create(from, to)
78
+
79
+ observer.should_receive(:execute).with do
80
+ |phase, from_state, to_state, transition|
81
+ expect(adapter.last).to eq(transition) if phase == :after
82
+ end.once
83
+ adapter.create(to, there)
84
+ end
74
85
  end
75
86
 
76
87
  context "with metadata" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statesman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Marr
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-19 00:00:00.000000000 Z
12
+ date: 2014-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler