spec/statesman/adapters/shared_examples.rb in statesman-0.6.0 vs spec/statesman/adapters/shared_examples.rb in statesman-0.6.1
- old
+ new
@@ -27,10 +27,11 @@
end
describe "#create" do
let(:from) { :x }
let(:to) { :y }
+ let(:there) { :z }
let(:create) { adapter.create(from, to) }
subject { -> { create } }
it { should change(adapter.history, :count).by(1) }
@@ -68,9 +69,19 @@
observer.should_receive(:execute).with do
|phase, from_state, to_state, transition|
expect(adapter.last).to eq(transition) if phase == :after
end.once
adapter.create(from, to)
+ end
+
+ it "exposes the new transition for subsequent transitions" do
+ adapter.create(from, to)
+
+ observer.should_receive(:execute).with do
+ |phase, from_state, to_state, transition|
+ expect(adapter.last).to eq(transition) if phase == :after
+ end.once
+ adapter.create(to, there)
end
end
context "with metadata" do
let(:metadata) { { "some" => "hash" } }