state_machine_rspec 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ ## [0.1.1](https://github.com/modocache/state_machine_rspec/compare/v0.1.0...v0.1.1)
2
+
3
+ - `StateMachineRspec::Matchers::Events` conform to `Matchers::States` API, and now
4
+ take a `:on` parameter when specifying a non-default state_machine attribute. This
5
+ used to be specified with a `:state` parameter.
6
+ - Add Travis-CI build status image to README.
7
+ - Update README with instructions on including module in during RSpec configuration.
8
+
9
+ ## [0.1.0](https://github.com/modocache/state_machine_rspec/tree/v0.1.0)
10
+
11
+ - Initial release.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # state_machine_rspec
2
2
 
3
+ [![Build Status](https://travis-ci.org/modocache/state_machine_rspec.png?branch=master)](https://travis-ci.org/modocache/state_machine_rspec)
4
+
3
5
  Custom matchers for [pluginaweek/state_machine](https://github.com/pluginaweek/state_machine).
4
6
 
5
7
 
@@ -24,6 +26,8 @@ end
24
26
  ```ruby
25
27
  describe Vehicle do
26
28
  it { should handle_events :shift_down, :crash, when: :third_gear }
29
+ it { should handle_events :enable_alarm, :disable_alarm,
30
+ when: :active, on: :alarm_state }
27
31
  it { should reject_events :park, :ignite, :idle, :shift_up, :repair,
28
32
  when: :third_gear }
29
33
  end
@@ -34,17 +38,19 @@ end
34
38
 
35
39
  Add these lines to your application's Gemfile:
36
40
 
37
- group :test do
38
- gem 'state_machine_rspec'
39
- end
40
-
41
- And then execute:
42
-
43
- $ bundle
41
+ ```ruby
42
+ group :test do
43
+ gem 'state_machine_rspec'
44
+ end
45
+ ```
44
46
 
45
- Or install it yourself as:
47
+ And include the matchers in `spec/spec_helper.rb`:
46
48
 
47
- $ gem install state_machine_rspec
49
+ ```ruby
50
+ RSpec.configure do |config|
51
+ config.include StateMachineRspec::Matchers
52
+ end
53
+ ```
48
54
 
49
55
 
50
56
  ## Contributing
@@ -14,7 +14,7 @@ module StateMachineRspec
14
14
  def matches?(subject)
15
15
  @subject = subject
16
16
  @introspector = StateMachineIntrospector.new(@subject,
17
- @options.fetch(:state, nil))
17
+ @options.fetch(:on, nil))
18
18
  enter_when_state
19
19
  return false if undefined_events?
20
20
  return false unless matches_events?(@events)
@@ -1,3 +1,3 @@
1
1
  module StateMachineRspec
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -283,9 +283,9 @@ describe Vehicle do
283
283
  it { should reject_states :broken, :ringing, on: :alarm_state }
284
284
 
285
285
  it { should handle_events :enable_alarm, :disable_alarm,
286
- when: :active, state: :alarm_state }
286
+ when: :active, on: :alarm_state }
287
287
  it { should handle_events :enable_alarm, :disable_alarm,
288
- when: :off, state: :alarm_state }
288
+ when: :off, on: :alarm_state }
289
289
 
290
290
  it 'has an initial state of activated' do
291
291
  vehicle.alarm_active?.should be_true
@@ -39,12 +39,12 @@ describe StateMachineRspec::Matchers::HandleEventMatcher do
39
39
  context 'when subject can perform events' do
40
40
  before do
41
41
  matcher_class = Class.new do
42
- state_machine :state, initial: :mathy do
42
+ state_machine :mathiness, initial: :mathy do
43
43
  event(:mathematize) { transition any => same }
44
44
  end
45
45
  end
46
46
  @matcher_subject = matcher_class.new
47
- @matcher = described_class.new([:mathematize])
47
+ @matcher = described_class.new([:mathematize, on: :mathiness])
48
48
  end
49
49
 
50
50
  it 'does not set a failure message' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: state_machine_rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-17 00:00:00.000000000 Z
12
+ date: 2013-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -165,6 +165,7 @@ files:
165
165
  - .gitignore
166
166
  - .rspec
167
167
  - .rvmrc
168
+ - CHANGELOG.md
168
169
  - Gemfile
169
170
  - Guardfile
170
171
  - LICENSE.txt
@@ -202,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
203
  version: '0'
203
204
  segments:
204
205
  - 0
205
- hash: 980135428736391408
206
+ hash: -1850982440411231615
206
207
  required_rubygems_version: !ruby/object:Gem::Requirement
207
208
  none: false
208
209
  requirements:
@@ -211,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
212
  version: '0'
212
213
  segments:
213
214
  - 0
214
- hash: 980135428736391408
215
+ hash: -1850982440411231615
215
216
  requirements: []
216
217
  rubyforge_project:
217
218
  rubygems_version: 1.8.25