state_machines-rspec 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6e29d42cf05c34dd89a4f9a83cab5cda02896975
4
- data.tar.gz: 4accb078af5da5f2f3a3b57e8db1a08407c76403
2
+ SHA256:
3
+ metadata.gz: 98d4e336e6771bbaa4ea39e7c4919512dd8829a3bb29948edf281b3330c1f937
4
+ data.tar.gz: cbf1fa5b36598b94db42e2e5c4d3ff0626e889780b5735e4f8827c6628adf189
5
5
  SHA512:
6
- metadata.gz: dfcd917683bff42df889f18a99876d298e11b084184f4ba80ccd93414fd9baa04000e69bb19d074cbbe848aa02576b36dad57ed9ecf8dae8105a02cdfbc69747
7
- data.tar.gz: 4f19549dedaf05e44e6e83de7bf8c9a15b9c78cc6ce0f7be519a5de1e1d2f04f0d90a68fcfe8069fb9b7ad68cf209495e904147944e8a143ddbb7757f31be5e7
6
+ metadata.gz: ec3075ce6ace2e3ee349516d5576f7b2962e0828c72cb0c9ddbdebbe19fe560b20564dfcd8918582ea5104e579a92da49ddda4ecf6b7429998c9f3a3fb1bf559
7
+ data.tar.gz: 508420369eaae022e22a8966bfa7303f9ca2d8f9fd628182ed624daec089777eddd4f4a50b77ec91bddce1b0ef0ae632a7fdf9be53da7c946c448a4d56443205
@@ -1 +1 @@
1
- 2.4.1
1
+ 2.6.3
@@ -0,0 +1,2 @@
1
+ ruby 2.5.1
2
+
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ script: "bundle exec rake"
3
+ cache: bundler
4
+ rvm:
5
+ - 2.2
6
+ - 2.3.8
7
+ - 2.4.6
8
+ - 2.5.5
9
+ - 2.6.3
10
+ - jruby
11
+ - rbx-2
12
+ matrix:
13
+ allow_failures:
14
+ - rvm: rbx-2
15
+ - rvm: jruby
data/README.md CHANGED
@@ -44,6 +44,7 @@ describe Vehicle do
44
44
  to_state: :parked, on_event: :park }
45
45
  it { is_expected.to transition_from :active, to_state: :off,
46
46
  on_event: :disable_alarm, on: :alarm_state }
47
+ it { is_expected.to transition_from :_any_, to_state: :stoped, on_event: :stop }
47
48
  end
48
49
  ```
49
50
 
@@ -21,6 +21,7 @@ module StateMachinesRspec
21
21
  def matches?(subject)
22
22
  @subject = subject
23
23
  @introspector = StateMachinesIntrospector.new(@subject, state_machine_scope)
24
+ @from_states = @introspector.all_states if from_states == [:_any_]
24
25
  from_states.each do |from_state|
25
26
  @from_state = from_state
26
27
  enter_from_state
@@ -32,7 +33,7 @@ module StateMachinesRspec
32
33
 
33
34
  def description
34
35
  message = "transition state to :#{options[:to_state]} from "
35
- message << from_states.map{ |state| ":#{state}" }.join(', ')
36
+ message << from_states.map { |state| ":#{state}" }.join(', ')
36
37
  message << " on event :#{options[:on_event]}"
37
38
  message << " on #{state_machine_scope.inspect}" if state_machine_scope
38
39
  message
@@ -12,6 +12,10 @@ class StateMachinesIntrospector
12
12
  @subject.send(state_machine_attribute)
13
13
  end
14
14
 
15
+ def all_states
16
+ state_machine.states.to_a.map(&:name)
17
+ end
18
+
15
19
  def state(name)
16
20
  state_machine.states.find { |s| s.name == name }
17
21
  end
@@ -1,3 +1,3 @@
1
1
  module StateMachinesRspec
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -84,6 +84,7 @@ describe Vehicle do
84
84
 
85
85
  it { is_expected.to transition_from :idling, :first_gear, to_state: :parked, on_event: :park }
86
86
  it { is_expected.to transition_from :idling, to_state: :parked, on_event: :park }
87
+ it { is_expected.to transition_from :_any_, to_state: :stopped, on_event: :stop }
87
88
 
88
89
  it 'has an initial state of "parked"' do
89
90
  expect(vehicle).to be_parked
@@ -20,6 +20,8 @@ class Vehicle
20
20
  vehicle.time_used += Time.now - start
21
21
  end
22
22
 
23
+ transition any => :stopped, :on => :stop
24
+
23
25
  event :park do
24
26
  transition [:idling, :first_gear] => :parked
25
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: state_machines-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JohnSmall
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-07-10 00:00:00.000000000 Z
12
+ date: 2019-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -177,6 +177,8 @@ files:
177
177
  - ".gitignore"
178
178
  - ".rspec"
179
179
  - ".ruby-version"
180
+ - ".tool-versions"
181
+ - ".travis.yml"
180
182
  - CHANGELOG.md
181
183
  - Gemfile
182
184
  - Guardfile
@@ -223,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
225
  version: '0'
224
226
  requirements: []
225
227
  rubyforge_project:
226
- rubygems_version: 2.6.11
228
+ rubygems_version: 2.7.6
227
229
  signing_key:
228
230
  specification_version: 4
229
231
  summary: RSpec matchers for state-machines/state_machines.