statesman 0.5.0 → 0.6.0

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: 7705af0277715fcc157ab5d750e870c03ff589fb
4
- data.tar.gz: e05d77943df6c572a9ea9d45b59f94f2c758cb6c
3
+ metadata.gz: b92fb09eece2e17c27b82fcca631fe7104352d64
4
+ data.tar.gz: 5d998f484ea553dfc739090859711185f6d2b79d
5
5
  SHA512:
6
- metadata.gz: ed5f485322fd9c0a906d0a010812e72a704db3669bc915c2aba8b942f6a9f98ff8145907adc5ab023440b997b0f9fdf9758aa7e0e67568afc391df505b7c7476
7
- data.tar.gz: bd202c6eafdbb989545e5b0f361a9713ef95fe78bb3b7454856a20e266fdd1f5a1b5242d1cc593123bf310aac202be47ccbef4f624c9d12a5dc59129dc6f1649
6
+ metadata.gz: c7d61e91e81cab512c7535ff42dc04428554c99db767d7efd43817119fe8387d385d005602b4bd69d10fe1f98c8e037e02ba3bd276aa0f0527a379ce3b3f8b06
7
+ data.tar.gz: 790bb168d54c53c16bf86290614ad78963484d1577a17f3d03e945a69dc87d1e61f4dea5b3e3be51014c5c6ff091d108ad52f331eba61bc1d76a3d572119ec23
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  *.rbc
3
3
  .bundle
4
4
  .config
5
+ .rspec
5
6
  .yardoc
6
7
  Gemfile.lock
7
8
  InstalledFiles
@@ -27,3 +27,6 @@ MethodLength:
27
27
  # Don't require utf-8 encoding comment
28
28
  Encoding:
29
29
  Enabled: false
30
+
31
+ LineLength:
32
+ Max: 80
@@ -1,3 +1,10 @@
1
+ ## v0.6.0, 19 May 2014
2
+ *Additions*
3
+ - Generators now handle namespaced classes (patch by [@hrmrebecca](https://github.com/hrmrebecca))
4
+
5
+ *Changes*
6
+ - `Machine#transition_to` now only swallows Statesman generated errors. An exception in your guard or callback will no longer be caught by Statesman (patch by [@paulspringett](https://github.com/paulspringett))
7
+
1
8
  ## v0.5.0, 27 March 2014
2
9
  *Additions*
3
10
  - Scope methods. Adds a module which can be mixed in to an ActiveRecord model to provide `.in_state` and `.not_in_state` query scopes.
data/README.md CHANGED
@@ -63,7 +63,7 @@ class Order < ActiveRecord::Base
63
63
 
64
64
  private
65
65
 
66
- def transition_class
66
+ def self.transition_class
67
67
  OrderTransition
68
68
  end
69
69
  end
@@ -231,7 +231,8 @@ Transition to the passed state, returning `true` on success. Raises
231
231
 
232
232
  #### `Machine#transition_to(:state)`
233
233
  Transition to the passed state, returning `true` on success. Swallows all
234
- exceptions and returns false on failure.
234
+ Statesman exceptions and returns false on failure. (NB. if your guard or
235
+ callback code throws an exception, it will not be caught.)
235
236
 
236
237
  ## Model scopes
237
238
 
@@ -245,7 +246,7 @@ class Order < ActiveRecord::Base
245
246
 
246
247
  private
247
248
 
248
- def transition_class
249
+ def self.transition_class
249
250
  OrderTransition
250
251
  end
251
252
  end
@@ -1,12 +1,15 @@
1
1
  require "rails/generators"
2
+ require "generators/statesman/generator_helpers"
2
3
 
3
4
  module Statesman
4
5
  class ActiveRecordTransitionGenerator < Rails::Generators::Base
6
+ include Statesman::GeneratorHelpers
7
+
5
8
  desc "Create an ActiveRecord-based transition model"\
6
9
  "with the required attributes"
7
10
 
8
11
  argument :parent, type: :string, desc: "Your parent model name"
9
- argument :klass, type: :string, desc: "Your transition model name"
12
+ argument :klass, type: :string, desc: "Your transition model name"
10
13
 
11
14
  source_root File.expand_path('../templates', __FILE__)
12
15
 
@@ -17,26 +20,10 @@ module Statesman
17
20
 
18
21
  private
19
22
 
20
- def next_migration_number
21
- Time.now.utc.strftime("%Y%m%d%H%M%S")
22
- end
23
-
24
23
  def migration_file_name
25
24
  "db/migrate/#{next_migration_number}_create_#{table_name}.rb"
26
25
  end
27
26
 
28
- def model_file_name
29
- "app/models/#{klass.underscore}.rb"
30
- end
31
-
32
- def table_name
33
- klass.underscore.pluralize
34
- end
35
-
36
- def parent_id
37
- parent.underscore + "_id"
38
- end
39
-
40
27
  def rails_4?
41
28
  Rails.version.split(".").map(&:to_i).first >= 4
42
29
  end
@@ -0,0 +1,31 @@
1
+ module Statesman
2
+ module GeneratorHelpers
3
+ def class_name_option
4
+ ", class_name: '#{parent}'" unless parent.underscore == parent_name
5
+ end
6
+
7
+ def model_file_name
8
+ "app/models/#{klass.underscore}.rb"
9
+ end
10
+
11
+ def migration_class_name
12
+ klass.gsub(/::/, '').pluralize
13
+ end
14
+
15
+ def next_migration_number
16
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
17
+ end
18
+
19
+ def parent_name
20
+ parent.demodulize.underscore
21
+ end
22
+
23
+ def parent_id
24
+ parent_name + "_id"
25
+ end
26
+
27
+ def table_name
28
+ klass.demodulize.underscore.pluralize
29
+ end
30
+ end
31
+ end
@@ -1,8 +1,11 @@
1
1
  require "rails/generators"
2
+ require "generators/statesman/generator_helpers"
2
3
 
3
4
  # Add statesman attributes to a pre-existing transition class
4
5
  module Statesman
5
6
  class MigrationGenerator < Rails::Generators::Base
7
+ include Statesman::GeneratorHelpers
8
+
6
9
  desc "Add the required Statesman attributes to your transition model"
7
10
 
8
11
  argument :parent, type: :string, desc: "Your parent model name"
@@ -16,20 +19,8 @@ module Statesman
16
19
 
17
20
  private
18
21
 
19
- def next_migration_number
20
- Time.now.utc.strftime("%Y%m%d%H%M%S")
21
- end
22
-
23
22
  def file_name
24
23
  "db/migrate/#{next_migration_number}_add_statesman_to_#{table_name}.rb"
25
24
  end
26
-
27
- def table_name
28
- klass.underscore.pluralize
29
- end
30
-
31
- def parent_id
32
- parent.underscore + "_id"
33
- end
34
25
  end
35
26
  end
@@ -1,7 +1,10 @@
1
1
  require "rails/generators"
2
+ require "generators/statesman/generator_helpers"
2
3
 
3
4
  module Statesman
4
5
  class MongoidTransitionGenerator < Rails::Generators::Base
6
+ include Statesman::GeneratorHelpers
7
+
5
8
  desc "Create a Mongoid-based transition model with the required attributes"
6
9
 
7
10
  argument :parent, type: :string, desc: "Your parent model name"
@@ -15,16 +18,8 @@ module Statesman
15
18
 
16
19
  private
17
20
 
18
- def model_file_name
19
- "app/models/#{klass.underscore}.rb"
20
- end
21
-
22
21
  def collection_name
23
22
  klass.underscore.pluralize
24
23
  end
25
-
26
- def parent_id
27
- parent.underscore + "_id"
28
- end
29
24
  end
30
25
  end
@@ -4,5 +4,5 @@ class <%= klass %> < ActiveRecord::Base
4
4
  <% unless rails_4? %>
5
5
  attr_accessible :to_state, :metadata, :sort_key
6
6
  <% end %>
7
- belongs_to :<%= parent.underscore %>, inverse_of: :<%= table_name %>
7
+ belongs_to :<%= parent_name %><%= class_name_option %>, inverse_of: :<%= table_name %>
8
8
  end
@@ -1,10 +1,11 @@
1
- class Create<%= klass.pluralize %> < ActiveRecord::Migration
1
+ class Create<%= migration_class_name %> < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :<%= table_name %> do |t|
4
4
  t.string :to_state
5
5
  t.text :metadata, default: "{}"
6
6
  t.integer :sort_key
7
7
  t.integer :<%= parent_id %>
8
+ t.timestamps
8
9
  end
9
10
 
10
11
  add_index :<%= table_name %>, :<%= parent_id %>
@@ -1,5 +1,6 @@
1
1
  class <%= klass %>
2
2
  include Mongoid::Document
3
+ include Mongoid::Timestamps
3
4
  include Statesman::Adapters::MongoidTransition
4
5
 
5
6
  field :to_state, type: String
@@ -8,6 +9,6 @@ class <%= klass %>
8
9
 
9
10
  index({ sort_key: 1 })
10
11
 
11
- belongs_to :<%= parent.underscore %>, index: true
12
+ belongs_to :<%= parent %><%= class_name_option %>, index: true
12
13
 
13
14
  end
@@ -1,9 +1,11 @@
1
- class AddStatesmanTo<%= klass.pluralize %> < ActiveRecord::Migration
1
+ class AddStatesmanTo<%= migration_class_name %> < ActiveRecord::Migration
2
2
  def change
3
3
  add_column :<%= table_name %>, :to_state, :string
4
4
  add_column :<%= table_name %>, :metadata, :text, default: "{}"
5
5
  add_column :<%= table_name %>, :sort_key, :integer
6
6
  add_column :<%= table_name %>, :<%= parent_id %>, :integer
7
+ add_column :<%= table_name %>, :created_at, :datetime
8
+ add_column :<%= table_name %>, :updated_at, :datetime
7
9
 
8
10
  add_index :<%= table_name %>, :<%= parent_id %>
9
11
  add_index :<%= table_name %>, [:sort_key, :<%= parent_id %>], unique: true
@@ -33,11 +33,15 @@ module Statesman
33
33
  end
34
34
 
35
35
  def history
36
- transitions_for_parent.order(:sort_key)
36
+ if transitions_for_parent.loaded?
37
+ transitions_for_parent.sort_by(&:sort_key)
38
+ else
39
+ transitions_for_parent.order(:sort_key)
40
+ end
37
41
  end
38
42
 
39
43
  def last
40
- @last_transition ||= transitions_for_parent.order(:sort_key).last
44
+ @last_transition ||= history.last
41
45
  end
42
46
 
43
47
  private
@@ -9,14 +9,14 @@ module Statesman
9
9
  def in_state(*states)
10
10
  joins(transition_name)
11
11
  .joins(transition_join)
12
- .where("#{transition_name}.to_state" => states)
12
+ .where("#{transition_name}.to_state" => states.map(&:to_s))
13
13
  .where("transition2.id" => nil)
14
14
  end
15
15
 
16
16
  def not_in_state(*states)
17
17
  joins(transition_name)
18
18
  .joins(transition_join)
19
- .where("#{transition_name}.to_state NOT IN (?)", states)
19
+ .where("#{transition_name}.to_state NOT IN (?)", states.map(&:to_s))
20
20
  .where("transition2.id" => nil)
21
21
  end
22
22
 
@@ -2,12 +2,14 @@ module Statesman
2
2
  module Adapters
3
3
  class MemoryTransition
4
4
  attr_accessor :created_at
5
+ attr_accessor :updated_at
5
6
  attr_accessor :to_state
6
7
  attr_accessor :sort_key
7
8
  attr_accessor :metadata
8
9
 
9
10
  def initialize(to, sort_key, metadata = nil)
10
11
  @created_at = Time.now
12
+ @updated_at = Time.now
11
13
  @to_state = to
12
14
  @sort_key = sort_key
13
15
  @metadata = metadata
@@ -196,7 +196,7 @@ module Statesman
196
196
 
197
197
  def transition_to(new_state, metadata = nil)
198
198
  self.transition_to!(new_state, metadata)
199
- rescue
199
+ rescue TransitionFailedError, GuardFailedError
200
200
  false
201
201
  end
202
202
 
@@ -224,16 +224,16 @@ module Statesman
224
224
  from = to_s_or_nil(options[:from])
225
225
  to = to_s_or_nil(options[:to])
226
226
 
227
- # Call all guards, they raise exceptions if they fail
228
- guards_for(from: from, to: to).each do |guard|
229
- guard.call(@object, last_transition, options[:metadata])
230
- end
231
-
232
227
  successors = self.class.successors[from] || []
233
228
  unless successors.include?(to)
234
229
  raise TransitionFailedError,
235
230
  "Cannot transition from '#{from}' to '#{to}'"
236
231
  end
232
+
233
+ # Call all guards, they raise exceptions if they fail
234
+ guards_for(from: from, to: to).each do |guard|
235
+ guard.call(@object, last_transition, options[:metadata])
236
+ end
237
237
  end
238
238
 
239
239
  def to_s_or_nil(input)
@@ -1,3 +1,3 @@
1
1
  module Statesman
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -0,0 +1,28 @@
1
+ require "spec_helper"
2
+ require "support/generators_shared_examples"
3
+ require "generators/statesman/active_record_transition_generator"
4
+
5
+ describe Statesman::ActiveRecordTransitionGenerator, type: :generator do
6
+
7
+ it_behaves_like "a generator" do
8
+ let(:migration_name) { 'db/migrate/create_bacon_transitions.rb' }
9
+ end
10
+
11
+ describe 'properly adds class names' do
12
+ before { run_generator %w[Yummy::Bacon Yummy::BaconTransition] }
13
+ subject { file('app/models/yummy/bacon_transition.rb') }
14
+
15
+ it { should contain(/:bacon_transition/) }
16
+ it { should_not contain(/:yummy\/bacon/) }
17
+ it { should contain(/class_name: 'Yummy::Bacon'/) }
18
+ end
19
+
20
+ describe 'properly formats without class names' do
21
+ before { run_generator %w[Bacon BaconTransition] }
22
+ subject { file('app/models/bacon_transition.rb') }
23
+
24
+ it { should_not contain(/class_name:/) }
25
+ it { should contain(/class BaconTransition/) }
26
+ end
27
+
28
+ end
@@ -0,0 +1,32 @@
1
+ require "spec_helper"
2
+ require "support/generators_shared_examples"
3
+ require "generators/statesman/migration_generator"
4
+
5
+ describe Statesman::MigrationGenerator, type: :generator do
6
+
7
+ it_behaves_like "a generator" do
8
+ let(:migration_name) { 'db/migrate/add_statesman_to_bacon_transitions.rb' }
9
+ end
10
+
11
+ describe 'the model contains the correct words' do
12
+ let(:migration_number) { '5678309' }
13
+
14
+ let(:mock_time) do
15
+ double('Time', utc: double('UTCTime', strftime: migration_number))
16
+ end
17
+
18
+ subject do
19
+ file(
20
+ "db/migrate/#{migration_number}_add_statesman_to_bacon_transitions.rb"
21
+ )
22
+ end
23
+
24
+ before do
25
+ Time.stub(:now).and_return(mock_time)
26
+ run_generator %w[Yummy::Bacon Yummy::BaconTransition]
27
+ end
28
+
29
+ it { should contain(/:bacon_transition/) }
30
+ it { should_not contain(/:yummy\/bacon/) }
31
+ end
32
+ end
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+ require "support/generators_shared_examples"
3
+ require "generators/statesman/mongoid_transition_generator"
4
+
5
+ describe Statesman::MongoidTransitionGenerator, type: :generator do
6
+
7
+ describe 'the model contains the correct words' do
8
+ before { run_generator %w[Yummy::Bacon Yummy::BaconTransition] }
9
+ subject { file('app/models/yummy/bacon_transition.rb') }
10
+
11
+ it { should_not contain(/:yummy\/bacon/) }
12
+ it { should contain(/class_name: 'Yummy::Bacon'/) }
13
+ end
14
+
15
+ describe 'the model contains the correct words' do
16
+ before { run_generator %w[Bacon BaconTransition] }
17
+ subject { file('app/models/bacon_transition.rb') }
18
+
19
+ it { should_not contain(/class_name:/) }
20
+ it { should_not contain(/CreateYummy::Bacon/) }
21
+ end
22
+
23
+ end
@@ -35,9 +35,12 @@ describe Statesman::Adapters::ActiveRecord do
35
35
  described_class.new(MyActiveRecordModelTransition, model, observer)
36
36
  end
37
37
 
38
+ before do
39
+ adapter.create(:x, :y)
40
+ end
41
+
38
42
  context "with a previously looked up transition" do
39
43
  before do
40
- adapter.create(:x, :y)
41
44
  adapter.last
42
45
  end
43
46
 
@@ -54,5 +57,17 @@ describe Statesman::Adapters::ActiveRecord do
54
57
  end
55
58
  end
56
59
  end
60
+
61
+ context "with a pre-fetched transition history" do
62
+ before do
63
+ # inspect the transitions to coerce a [pre-]load
64
+ model.my_active_record_model_transitions.inspect
65
+ end
66
+
67
+ it "doesn't query the database" do
68
+ MyActiveRecordModelTransition.should_not_receive(:connection)
69
+ expect(adapter.last.to_state).to eq("y")
70
+ end
71
+ end
57
72
  end
58
73
  end
@@ -295,7 +295,9 @@ describe Statesman::Machine do
295
295
  machine.class_eval do
296
296
  state :x, initial: true
297
297
  state :y
298
+ state :z
298
299
  transition from: :x, to: :y
300
+ transition from: :y, to: :z
299
301
  end
300
302
  end
301
303
 
@@ -313,6 +315,17 @@ describe Statesman::Machine do
313
315
  let(:new_state) { :y }
314
316
  it { should be_false }
315
317
  end
318
+
319
+ context "and is guarded" do
320
+ let(:guard_cb) { -> { false } }
321
+ let(:new_state) { :z }
322
+ before { machine.guard_transition(to: new_state, &guard_cb) }
323
+
324
+ it "does not fire guard" do
325
+ guard_cb.should_not_receive(:call)
326
+ should be_false
327
+ end
328
+ end
316
329
  end
317
330
 
318
331
  context "when the transition valid" do
@@ -427,6 +440,21 @@ describe Statesman::Machine do
427
440
  end
428
441
  it { should be_false }
429
442
  end
443
+
444
+ context "when a non statesman exception is raised" do
445
+ before do
446
+ instance.stub(:transition_to!).and_raise(RuntimeError,
447
+ 'user defined exception')
448
+ end
449
+
450
+ it "should not rescue the exception" do
451
+ expectation = expect do
452
+ instance.transition_to(:some_state, metadata)
453
+ end
454
+
455
+ expectation.to raise_error(RuntimeError, 'user defined exception')
456
+ end
457
+ end
430
458
  end
431
459
 
432
460
  shared_examples "a callback filter" do |definer, phase|
@@ -9,6 +9,7 @@ describe Statesman::Adapters::MemoryTransition do
9
9
 
10
10
  specify { expect(create.to_state).to equal(to) }
11
11
  specify { expect(create.created_at).to be_a(Time) }
12
+ specify { expect(create.updated_at).to be_a(Time) }
12
13
  specify { expect(create.sort_key).to be(sort_key) }
13
14
 
14
15
  context "with metadata passed" do
@@ -0,0 +1,33 @@
1
+ require "rails/version"
2
+ require "ammeter/init"
3
+
4
+ TMP_GENERATOR_PATH = File.expand_path('../generator-tmp', __FILE__)
5
+
6
+ shared_examples 'a generator' do
7
+ destination TMP_GENERATOR_PATH
8
+ before { prepare_destination }
9
+ let(:gen) { generator %w[Yummy::Bacon Yummy::BaconTransition] }
10
+
11
+ it 'invokes create_model_file method' do
12
+ expect(gen).to receive(:create_model_file)
13
+ capture(:stdout) { gen.invoke_all }
14
+ end
15
+
16
+ describe 'it runs the generator and check things out' do
17
+
18
+ before { run_generator %w[Yummy::Bacon Yummy::BaconTransition] }
19
+
20
+ describe 'it generates a correctly named file' do
21
+ subject { file(migration_name) }
22
+ it { should be_a_migration }
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+ RSpec.configure do |config|
30
+ config.after :all do
31
+ FileUtils.rm_rf(TMP_GENERATOR_PATH)
32
+ end
33
+ end
@@ -18,13 +18,14 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec", "~> 2.14.1"
24
- spec.add_development_dependency "guard-rspec", "~> 3.0.2"
25
- spec.add_development_dependency "rubocop", "~> 0.18.1"
23
+ spec.add_development_dependency "rspec", "~> 2.14.1"
24
+ spec.add_development_dependency "guard-rspec", "~> 3.0.2"
25
+ spec.add_development_dependency "rubocop", "~> 0.18.1"
26
26
  spec.add_development_dependency "guard-rubocop", "~> 0.2.2"
27
- spec.add_development_dependency "activerecord", "~> 3.2"
28
- spec.add_development_dependency "sqlite3", "~> 1.3.8"
29
- spec.add_development_dependency "mongoid", "~> 3.1.5"
27
+ spec.add_development_dependency "sqlite3", "~> 1.3.8"
28
+ spec.add_development_dependency "mongoid", "~> 3.1.5"
29
+ spec.add_development_dependency "rails", "~> 3.2"
30
+ spec.add_development_dependency "ammeter", "~> 1.0.0"
30
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statesman
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
  - Harry Marr
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-27 00:00:00.000000000 Z
12
+ date: 2014-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -96,47 +96,61 @@ dependencies:
96
96
  - !ruby/object:Gem::Version
97
97
  version: 0.2.2
98
98
  - !ruby/object:Gem::Dependency
99
- name: activerecord
99
+ name: sqlite3
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ~>
103
103
  - !ruby/object:Gem::Version
104
- version: '3.2'
104
+ version: 1.3.8
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - ~>
110
110
  - !ruby/object:Gem::Version
111
- version: '3.2'
111
+ version: 1.3.8
112
112
  - !ruby/object:Gem::Dependency
113
- name: sqlite3
113
+ name: mongoid
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - ~>
117
117
  - !ruby/object:Gem::Version
118
- version: 1.3.8
118
+ version: 3.1.5
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 1.3.8
125
+ version: 3.1.5
126
126
  - !ruby/object:Gem::Dependency
127
- name: mongoid
127
+ name: rails
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - ~>
131
131
  - !ruby/object:Gem::Version
132
- version: 3.1.5
132
+ version: '3.2'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ~>
138
138
  - !ruby/object:Gem::Version
139
- version: 3.1.5
139
+ version: '3.2'
140
+ - !ruby/object:Gem::Dependency
141
+ name: ammeter
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ~>
145
+ - !ruby/object:Gem::Version
146
+ version: 1.0.0
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ~>
152
+ - !ruby/object:Gem::Version
153
+ version: 1.0.0
140
154
  description: A statesmanlike state machine library
141
155
  email:
142
156
  - developers@gocardless.com
@@ -155,6 +169,7 @@ files:
155
169
  - Rakefile
156
170
  - circle.yml
157
171
  - lib/generators/statesman/active_record_transition_generator.rb
172
+ - lib/generators/statesman/generator_helpers.rb
158
173
  - lib/generators/statesman/migration_generator.rb
159
174
  - lib/generators/statesman/mongoid_transition_generator.rb
160
175
  - lib/generators/statesman/templates/active_record_transition_model.rb.erb
@@ -175,6 +190,9 @@ files:
175
190
  - lib/statesman/guard.rb
176
191
  - lib/statesman/machine.rb
177
192
  - lib/statesman/version.rb
193
+ - spec/generators/statesman/active_record_transition_generator_spec.rb
194
+ - spec/generators/statesman/migration_generator_spec.rb
195
+ - spec/generators/statesman/mongoid_transition_generator_spec.rb
178
196
  - spec/spec_helper.rb
179
197
  - spec/statesman/adapters/active_record_model_spec.rb
180
198
  - spec/statesman/adapters/active_record_spec.rb
@@ -188,6 +206,7 @@ files:
188
206
  - spec/statesman/machine_spec.rb
189
207
  - spec/statesman/transition_spec.rb
190
208
  - spec/support/active_record.rb
209
+ - spec/support/generators_shared_examples.rb
191
210
  - spec/support/mongoid.rb
192
211
  - statesman.gemspec
193
212
  homepage: https://github.com/gocardless/statesman
@@ -210,11 +229,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
229
  version: '0'
211
230
  requirements: []
212
231
  rubyforge_project:
213
- rubygems_version: 2.0.3
232
+ rubygems_version: 2.2.2
214
233
  signing_key:
215
234
  specification_version: 4
216
235
  summary: A statesmanlike state machine library
217
236
  test_files:
237
+ - spec/generators/statesman/active_record_transition_generator_spec.rb
238
+ - spec/generators/statesman/migration_generator_spec.rb
239
+ - spec/generators/statesman/mongoid_transition_generator_spec.rb
218
240
  - spec/spec_helper.rb
219
241
  - spec/statesman/adapters/active_record_model_spec.rb
220
242
  - spec/statesman/adapters/active_record_spec.rb
@@ -228,4 +250,5 @@ test_files:
228
250
  - spec/statesman/machine_spec.rb
229
251
  - spec/statesman/transition_spec.rb
230
252
  - spec/support/active_record.rb
253
+ - spec/support/generators_shared_examples.rb
231
254
  - spec/support/mongoid.rb