yasm 0.0.9 → 0.0.10

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.0.10
2
+ -- you can now access the context from the state
3
+
1
4
  v0.0.8
2
5
  -- requires symbolism 0.0.1 or greater
3
6
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yasm (0.0.8)
4
+ yasm (0.0.9)
5
5
  activesupport (~> 3.0)
6
6
  i18n (~> 0.5.0)
7
7
  symbolism (~> 0.0.1)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.10
@@ -0,0 +1,5 @@
1
+ Feature: States should know their Context
2
+
3
+ Scenario: Accessing the context
4
+ Given a context with a state
5
+ Then I should be able to access the context from the state
@@ -19,6 +19,9 @@ Given /^a couchrest model context$/ do
19
19
  include Yasm::Context
20
20
 
21
21
  start :couch_state1
22
+ property :user
23
+
24
+ view_by :user
22
25
  end
23
26
  class CouchState1
24
27
  include Yasm::State
@@ -30,10 +33,11 @@ Given /^a couchrest model context$/ do
30
33
  include Yasm::Action
31
34
  triggers :couch_state2
32
35
  end
33
- @couch_context = CouchContext.new
36
+ @couch_context = CouchContext.create! :user => "moonmaster9000"
34
37
  end
35
38
 
36
39
  When /^I save that context to CouchDB$/ do
40
+ @couch_context.save
37
41
  @couch_context.do! GoToState2
38
42
  @state_start_time = @couch_context.state.value.instantiated_at
39
43
  @couch_context.save
@@ -0,0 +1,15 @@
1
+ Given /^a context with a state$/ do
2
+ class ContextWithState
3
+ include Yasm::Context
4
+ start :some_state
5
+ end
6
+
7
+ class SomeState
8
+ include Yasm::State
9
+ end
10
+ @context_with_state = ContextWithState.new
11
+ end
12
+
13
+ Then /^I should be able to access the context from the state$/ do
14
+ @context_with_state.state.value.context.should == @context_with_state
15
+ end
@@ -9,6 +9,7 @@ module Yasm
9
9
 
10
10
  new_state = get_instance new_state
11
11
  new_state.instantiated_at = state_time
12
+ new_state.context = state_container.context
12
13
  state_container.state = new_state
13
14
  end
14
15
 
@@ -54,6 +54,7 @@ module Yasm
54
54
  end
55
55
  end
56
56
 
57
+ attr_accessor :context
57
58
  attr_accessor :instantiated_at
58
59
 
59
60
  def to_s
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: yasm
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.9
5
+ version: 0.0.10
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matt Parker
@@ -89,12 +89,14 @@ files:
89
89
  - features/final_states.feature
90
90
  - features/persistance/couchrest_model_persistance.feature
91
91
  - features/state_with_limited_actions.feature
92
+ - features/states_with_context.feature
92
93
  - features/states_with_time_limits.feature
93
94
  - features/step_definitions/action_callback_steps.rb
94
95
  - features/step_definitions/action_steps.rb
95
96
  - features/step_definitions/final_state_steps.rb
96
97
  - features/step_definitions/persistence/couchrest_model_persistence_steps.rb
97
98
  - features/step_definitions/state_with_limited_actions_steps.rb
99
+ - features/step_definitions/states_with_context_steps.rb
98
100
  - features/step_definitions/states_with_time_limits_steps.rb
99
101
  - features/support/setup.rb
100
102
  - lib/yasm.rb
@@ -148,11 +150,13 @@ test_files:
148
150
  - features/final_states.feature
149
151
  - features/persistance/couchrest_model_persistance.feature
150
152
  - features/state_with_limited_actions.feature
153
+ - features/states_with_context.feature
151
154
  - features/states_with_time_limits.feature
152
155
  - features/step_definitions/action_callback_steps.rb
153
156
  - features/step_definitions/action_steps.rb
154
157
  - features/step_definitions/final_state_steps.rb
155
158
  - features/step_definitions/persistence/couchrest_model_persistence_steps.rb
156
159
  - features/step_definitions/state_with_limited_actions_steps.rb
160
+ - features/step_definitions/states_with_context_steps.rb
157
161
  - features/step_definitions/states_with_time_limits_steps.rb
158
162
  - features/support/setup.rb