hsume2-state_machine 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/gempackagetask'
6
6
 
7
7
  spec = Gem::Specification.new do |s|
8
8
  s.name = 'hsume2-state_machine'
9
- s.version = '1.0.2'
9
+ s.version = '1.0.3'
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.summary = 'Adds support for creating state machines for attributes on any Ruby class'
12
12
  s.description = s.summary
@@ -16,10 +16,9 @@ spec = Gem::Specification.new do |s|
16
16
  s.has_rdoc = true
17
17
  s.test_files = Dir['test/**/*_test.rb']
18
18
 
19
- s.author = 'Aaron Pfeifer'
20
- s.email = 'aaron@pluginaweek.org'
21
- s.homepage = 'http://www.pluginaweek.org'
22
- s.rubyforge_project = 'pluginaweek'
19
+ s.author = 'Henry Hsu'
20
+ s.email = 'hhsu@zendesk.com'
21
+ s.homepage = 'http://github.com/hsume2/state_machine'
23
22
  end
24
23
 
25
24
  desc 'Default: run all tests.'
@@ -328,7 +328,7 @@ module StateMachine
328
328
  end
329
329
 
330
330
  # Evaluate DSL
331
- machine.evaluate_with_syntax(&block) if block_given?
331
+ machine.evaluate_with_syntax(options[:syntax], &block) if block_given?
332
332
  else
333
333
  # No existing machine: create a new one
334
334
  machine = new(owner_class, name, options, &block)
@@ -461,7 +461,7 @@ module StateMachine
461
461
  after_initialize
462
462
 
463
463
  # Evaluate DSL
464
- evaluate_with_syntax(&block) if block_given?
464
+ evaluate_with_syntax(@syntax, &block) if block_given?
465
465
  end
466
466
 
467
467
  # Creates a copy of this machine in addition to copies of each associated
@@ -477,8 +477,8 @@ module StateMachine
477
477
  @callbacks = {:before => @callbacks[:before].dup, :after => @callbacks[:after].dup, :failure => @callbacks[:failure].dup}
478
478
  end
479
479
 
480
- def evaluate_with_syntax(&block)
481
- if @syntax == :alternate
480
+ def evaluate_with_syntax(syntax, &block)
481
+ if syntax == :alternate
482
482
  instance_eval(&alternate_syntax_eval(&block))
483
483
  else
484
484
  instance_eval(&block)
@@ -79,6 +79,19 @@ class AlternateAutoShopAvailableTest < Test::Unit::TestCase
79
79
  assert @auto_shop.closed?
80
80
  end
81
81
 
82
+ def test_should_append_to_machine_in_default_syntax
83
+ AlternateAutoShop.class_eval do
84
+ state_machine :initial => :available do
85
+ event :restart do
86
+ transition any => :restarted
87
+ end
88
+ end
89
+ end
90
+
91
+ assert @auto_shop.restart
92
+ assert @auto_shop.restarted?
93
+ end
94
+
82
95
  def test_should_not_allow_event_outside_state
83
96
  assert_raises(StateMachine::AlternateMachine::InvalidEventError) do
84
97
  AlternateAutoShop.class_eval do
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hsume2-state_machine
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
- - Aaron Pfeifer
13
+ - Henry Hsu
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
@@ -20,7 +20,7 @@ default_executable:
20
20
  dependencies: []
21
21
 
22
22
  description: Adds support for creating state machines for attributes on any Ruby class
23
- email: aaron@pluginaweek.org
23
+ email: hhsu@zendesk.com
24
24
  executables: []
25
25
 
26
26
  extensions: []
@@ -138,7 +138,7 @@ files:
138
138
  - Rakefile
139
139
  - README.rdoc
140
140
  has_rdoc: true
141
- homepage: http://www.pluginaweek.org
141
+ homepage: http://github.com/hsume2/state_machine
142
142
  licenses: []
143
143
 
144
144
  post_install_message:
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  version: "0"
167
167
  requirements: []
168
168
 
169
- rubyforge_project: pluginaweek
169
+ rubyforge_project:
170
170
  rubygems_version: 1.5.3
171
171
  signing_key:
172
172
  specification_version: 3