state_machines 0.2.1 → 0.2.2

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: f123850eec3147fde773d5de1a37d441e66bc508
4
- data.tar.gz: 90b393b44ab22bbb3b6756c38a782dd2aab4f0ed
3
+ metadata.gz: 592765d98fcb41a672f7aab26d298b350095f2f1
4
+ data.tar.gz: f5b1d1c24d1d6fef21593c9cccd1a284999f13f5
5
5
  SHA512:
6
- metadata.gz: 32c68af9e7ead0940fa99a590f73175dd4a9c332d94a682b16c8a2e0bdc45563e2f7b11f49e08f03377278a7066be1f64025f02737e1cbfef28882f9a4446655
7
- data.tar.gz: 48a4cbe90cfa0362c4344d011b631bd226fdf3ccb08707e927012f693367f54e3c26d643c899c5e7454a18d21d4bf2f5818b6cc9fa8926272b543ed5d894133b
6
+ metadata.gz: 6c2fca5379dd4adeac3f69560bacb568117ed3a41c0d65bba0c716c25655cf3a05b958d73db464479e16ecfd9ee4ab269ad37808a74551a8b5e86332a1557154
7
+ data.tar.gz: 6ec09db4711dad2e998e87ce9d5a645e26429d498c50c5a739ae6911b1ce9e2b23a3176962226ef92d40d19aaf2bad5734f4d3ec82d7a8709a3275ec2774f280
@@ -27,7 +27,7 @@ module StateMachines
27
27
 
28
28
  each_value do |machine|
29
29
  unless machine.dynamic_initial_state?
30
- force = options[:static] == :force || !attributes.keys.include?(machine.attribute)
30
+ force = options[:static] == :force || !attributes.keys.map(&:to_sym).include?(machine.attribute)
31
31
  machine.initialize_state(object, force: force, :to => options[:to])
32
32
  end
33
33
  end if options[:static]
@@ -1,3 +1,3 @@
1
1
  module StateMachines
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -98,4 +98,14 @@ class MachineCollectionStateInitializationTest < StateMachinesTest
98
98
  @machines.initialize_states(@object, dynamic: true)
99
99
  assert_equal 'inactive', @object.alarm_state
100
100
  end
101
+
102
+ def test_shouldnt_force_state_given_either_as_string_or_symbol
103
+ @object.state = 'notparked'
104
+
105
+ @machines.initialize_states(@object, {}, { state: "parked" })
106
+ assert_equal 'notparked', @object.state
107
+
108
+ @machines.initialize_states(@object, {}, { "state" => "parked" })
109
+ assert_equal 'notparked', @object.state
110
+ end
101
111
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: state_machines
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-04 00:00:00.000000000 Z
12
+ date: 2015-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler