aasm 4.0.8 → 4.1.1

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -2
  3. data/CHANGELOG.md +13 -2
  4. data/Gemfile +5 -2
  5. data/README.md +22 -5
  6. data/aasm.gemspec +0 -4
  7. data/gemfiles/rails_3.2.gemfile +3 -2
  8. data/gemfiles/rails_4.0.gemfile +2 -6
  9. data/gemfiles/rails_4.0_bson1.gemfile +14 -0
  10. data/gemfiles/rails_4.1.gemfile +2 -6
  11. data/gemfiles/rails_4.1_bson1.gemfile +14 -0
  12. data/gemfiles/rails_4.2.gemfile +1 -5
  13. data/gemfiles/rails_4.2_bson1.gemfile +14 -0
  14. data/lib/aasm/aasm.rb +13 -7
  15. data/lib/aasm/core/event.rb +1 -1
  16. data/lib/aasm/core/state.rb +8 -6
  17. data/lib/aasm/errors.rb +12 -1
  18. data/lib/aasm/persistence/active_record_persistence.rb +3 -3
  19. data/lib/aasm/persistence/base.rb +3 -0
  20. data/lib/aasm/persistence/mongo_mapper_persistence.rb +174 -0
  21. data/lib/aasm/persistence/mongoid_persistence.rb +1 -5
  22. data/lib/aasm/persistence/sequel_persistence.rb +1 -0
  23. data/lib/aasm/persistence.rb +2 -0
  24. data/lib/aasm/version.rb +1 -1
  25. data/spec/models/callbacks/with_args.rb +9 -9
  26. data/spec/models/mongo_mapper/no_scope_mongo_mapper.rb +10 -0
  27. data/spec/models/mongo_mapper/simple_mongo_mapper.rb +11 -0
  28. data/spec/models/mongo_mapper/simple_new_dsl_mongo_mapper.rb +12 -0
  29. data/spec/models/mongoid/simple_new_dsl_mongoid.rb +1 -1
  30. data/spec/models/validator.rb +8 -0
  31. data/spec/spec_helper.rb +2 -3
  32. data/spec/unit/callbacks_spec.rb +1 -1
  33. data/spec/unit/persistence/active_record_persistence_spec.rb +6 -1
  34. data/spec/unit/persistence/mongo_mapper_persistance_spec.rb +135 -0
  35. data/spec/unit/persistence/mongoid_persistance_spec.rb +4 -10
  36. data/spec/unit/persistence/sequel_persistence_spec.rb +15 -1
  37. data/spec/unit/transition_spec.rb +6 -1
  38. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9602429239af9631275cb2f9c1b3c175177aea51
4
- data.tar.gz: 1dc343974f7348d43882b5f15908440012dcd6e5
3
+ metadata.gz: e85a2c10a3cf49a548193c9634548eb38eb1578b
4
+ data.tar.gz: 9b87e33663caa939dbf4eeefad57ea6ebde01fac
5
5
  SHA512:
6
- metadata.gz: c0c7e3300ea262db0385d2f4f403a227968ecc42cd99c0cc13eba81b2f356881b9a42b24a33191b286e1573233ca5ff8a9abdacffd51874d763494e66caabb08
7
- data.tar.gz: f3ec766f78f6dd8bd9a781220764e35e28dbe0cd8217763a960675202e4001e3a647bb22db7be930a2079d0d832933bc4fc68da5aaa722a130369a2e12579942
6
+ metadata.gz: 1e2b255e2cae2cfae4a13c14ef8bd89f20c132ae5acf8260e68319f40646008304f05870e5cfbb2e4402b7cedc588552b777407c613b30f7e8b1787b9eac8faf
7
+ data.tar.gz: 41843dcb1cfa5c1147abea4420951ae3217349abd7a7918a1ef0014671218a520957c61d2d7f70ae5634514df5722466e83deb64549b463a5d3d51a323049da3
data/.travis.yml CHANGED
@@ -10,7 +10,7 @@ rvm:
10
10
  - 2.1
11
11
  - 2.2
12
12
  # - jruby-18mode # JRuby in 1.8 mode
13
- - jruby-19mode # JRuby in 1.9 mode
13
+ - jruby-1.7 # JRuby in 1.9 mode
14
14
  - rbx-2.2.1
15
15
 
16
16
  services: mongodb
@@ -18,13 +18,16 @@ services: mongodb
18
18
  gemfile:
19
19
  - gemfiles/rails_3.2.gemfile
20
20
  - gemfiles/rails_4.0.gemfile
21
+ - gemfiles/rails_4.0_bson1.gemfile
21
22
  - gemfiles/rails_4.1.gemfile
23
+ - gemfiles/rails_4.1_bson1.gemfile
22
24
  - gemfiles/rails_4.2.gemfile
25
+ - gemfiles/rails_4.2_bson1.gemfile
23
26
 
24
27
  matrix:
25
28
  allow_failures:
26
29
  - rvm: rbx-2.2.1
27
- - rvm: jruby-19mode
30
+ - rvm: jruby-1.7
28
31
  exclude:
29
32
  - rvm: 1.9.3
30
33
  gemfile: gemfiles/rails_4.1.gemfile
data/CHANGELOG.md CHANGED
@@ -1,13 +1,24 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 4.1.0 (not yet released)
3
+ ## 4.2.0 (not yet released)
4
4
 
5
+ ## 4.1.1
6
+
7
+ * support block notation for `:after_commit` event callbacks (see [issue #224](https://github.com/aasm/aasm/issues/224) for details)
8
+ * event arguments are now passed to state callbacks as well (not only to event callbacks) (see [issue #219](https://github.com/aasm/aasm/issues/219), thanks to [@tobithiel](https://github.com/tobithiel))
9
+ * `AASM::InvalidTransition` now references the current object (with the state machine) and the _AASM_ event name (see [issue #217](https://github.com/aasm/aasm/issues/217), thanks to [@awsmsrc](https://github.com/awsmsrc))
10
+ * bugfix: do not update unloaded state for [Sequel](http://sequel.jeremyevans.net/) (see [issue #218](https://github.com/aasm/aasm/issues/218), thanks to [@godfat](https://github.com/godfat))
11
+
12
+ ## 4.1.0
13
+
14
+ * bugfix: initialize the aasm state column after initialization of the _Mongoid_ instance (see [issue #206](https://github.com/aasm/aasm/issues/206), thanks to [@Shwetakale ](https://github.com/Shwetakale ))
15
+ * added support for mongomapper ORM (see [issue #203](https://github.com/aasm/aasm/issues/203), thanks to [@reidmorrison ](https://github.com/reidmorrison ))
5
16
  * `aasm_column` has been removed. Use `aasm.attribute_name` instead
6
17
  * `aasm_human_event_name` has been removed. Use `aasm.human_event_name` instead
7
18
 
8
19
  ## 4.0.8
9
20
 
10
- * bugfix: may_<event>? should return true or false only (see [issue #200](https://github.com/aasm/aasm/issues/200) for details)
21
+ * bugfix: may_event_name? should return true or false only (see [issue #200](https://github.com/aasm/aasm/issues/200) for details)
11
22
 
12
23
  ## 4.0.7
13
24
 
data/Gemfile CHANGED
@@ -1,12 +1,15 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "sqlite3", :platforms => :ruby
4
- gem "coveralls", :platforms => :ruby
5
4
  gem 'rubysl', :platforms => :rbx
6
5
  gem "jruby-openssl", :platforms => :jruby
7
6
  gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
8
7
  gem "rails", "~>4.1"
9
- gem 'mongoid' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
8
+ gem 'mongoid', '~>4.0' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
10
9
  gem 'sequel'
10
+ # Since mongoid V4 requires incompatible bson V2, cannot have mongoid (V4 or greater)
11
+ # and mongo_mapper ( or mongo ) in the same application
12
+ #gem 'mongo_mapper', '~> 0.13'
13
+ #gem 'bson_ext', :platforms => :ruby
11
14
 
12
15
  gemspec
data/README.md CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/aasm.svg)](http://badge.fury.io/rb/aasm)
4
4
  [![Build Status](https://travis-ci.org/aasm/aasm.svg?branch=master)](https://travis-ci.org/aasm/aasm)
5
+ [![Dependency Status](https://gemnasium.com/aasm/aasm.svg)](https://gemnasium.com/aasm/aasm)
5
6
  [![Code Climate](https://codeclimate.com/github/aasm/aasm/badges/gpa.svg)](https://codeclimate.com/github/aasm/aasm)
6
- [![Coverage Status](https://img.shields.io/coveralls/aasm/aasm.svg)](https://coveralls.io/r/aasm/aasm?branch=master)
7
7
 
8
8
  This package contains AASM, a library for adding finite state machines to Ruby classes.
9
9
 
10
10
  AASM started as the *acts_as_state_machine* plugin but has evolved into a more generic library
11
11
  that no longer targets only ActiveRecord models. It currently provides adapters for
12
- [ActiveRecord](http://api.rubyonrails.org/classes/ActiveRecord/Base.html) and
13
- [Mongoid](http://mongoid.org/), but it can be used for any Ruby class, no matter what
12
+ [ActiveRecord](http://api.rubyonrails.org/classes/ActiveRecord/Base.html),
13
+ [Mongoid](http://mongoid.org/), and [Mongomapper](http://mongomapper.com/) but it can be used for any Ruby class, no matter what
14
14
  parent class it has (if any).
15
15
 
16
16
  ## Upgrade from version 3 to 4
@@ -435,7 +435,7 @@ to ```false```.
435
435
 
436
436
  ### Sequel
437
437
 
438
- AASM also supports [Sequel](http://sequel.jeremyevans.net/) besides _ActiveRecord_ and _Mongoid_.
438
+ AASM also supports [Sequel](http://sequel.jeremyevans.net/) besides _ActiveRecord_, _Mongoid_, and _MongoMapper_.
439
439
 
440
440
  ```ruby
441
441
  class Job < Sequel::Model
@@ -466,6 +466,23 @@ class Job
466
466
  end
467
467
  ```
468
468
 
469
+ ### MongoMapper
470
+
471
+ AASM also supports persistence to Mongodb if you're using MongoMapper. Make sure
472
+ to include MongoMapper::Document before you include AASM.
473
+
474
+ ```ruby
475
+ class Job
476
+ include MongoMapper::Document
477
+ include AASM
478
+
479
+ key :aasm_state, Symbol
480
+ aasm do
481
+ ...
482
+ end
483
+ end
484
+ ```
485
+
469
486
  ### Automatic Scopes
470
487
 
471
488
  AASM will automatically create scope methods for each state in the model.
@@ -671,7 +688,7 @@ purpose.
671
688
 
672
689
  ## License ##
673
690
 
674
- Copyright (c) 2006-2014 Scott Barron
691
+ Copyright (c) 2006-2015 Scott Barron
675
692
 
676
693
  Permission is hereby granted, free of charge, to any person obtaining
677
694
  a copy of this software and associated documentation files (the
data/aasm.gemspec CHANGED
@@ -24,10 +24,6 @@ Gem::Specification.new do |s|
24
24
  # s.add_development_dependency 'debugger'
25
25
  s.add_development_dependency 'pry'
26
26
 
27
- # test coverage
28
- # s.add_development_dependency 'mime-types', '~> 1.25' # needed by coveralls (>= 2.0 needs Ruby >=1.9.2)
29
- # s.add_development_dependency 'coveralls'
30
-
31
27
  s.files = `git ls-files`.split("\n")
32
28
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
33
29
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -1,13 +1,14 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "sqlite3", :platforms => :ruby
4
- gem "coveralls"
5
4
  gem 'rubysl', :platforms => :rbx
6
5
  gem 'rubinius-developer_tools', :platforms => :rbx
7
6
  gem "jruby-openssl", :platforms => :jruby
8
7
  gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
9
8
  gem "rails", "3.2.21"
10
- gem 'mongoid' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
9
+ gem 'mongoid', '~>3.1' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
11
10
  gem 'sequel'
11
+ gem 'mongo_mapper', '~>0.13'
12
+ gem 'bson_ext', :platforms => :ruby
12
13
 
13
14
  gemspec :path => "../"
@@ -1,16 +1,12 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "sqlite3", :platforms => :ruby
4
- gem "coveralls"
5
4
  gem 'rubysl', :platforms => :rbx
6
5
  gem 'rubinius-developer_tools', :platforms => :rbx
7
6
  gem "jruby-openssl", :platforms => :jruby
8
7
  gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
9
- gem "rails", "4.0.12"
10
-
11
- # mongoid is not yet compatible with Rails >= 4
12
- # gem 'mongoid' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
13
-
8
+ gem "rails", "4.0.13"
9
+ gem 'mongoid', '~>4.0' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
14
10
  gem 'sequel'
15
11
 
16
12
  gemspec :path => "../"
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "sqlite3", :platforms => :ruby
4
+ gem "coveralls"
5
+ gem 'rubysl', :platforms => :rbx
6
+ gem 'rubinius-developer_tools', :platforms => :rbx
7
+ gem "jruby-openssl", :platforms => :jruby
8
+ gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
9
+ gem "rails", "4.0.13"
10
+ gem 'sequel'
11
+ gem 'mongo_mapper', '~>0.13'
12
+ gem 'bson_ext', :platforms => :ruby
13
+
14
+ gemspec :path => "../"
@@ -1,16 +1,12 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "sqlite3", :platforms => :ruby
4
- gem "coveralls"
5
4
  gem 'rubysl', :platforms => :rbx
6
5
  gem 'rubinius-developer_tools', :platforms => :rbx
7
6
  gem "jruby-openssl", :platforms => :jruby
8
7
  gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
9
- gem "rails", "4.1.8"
10
-
11
- # mongoid is not yet compatible with Rails >= 4
12
- # gem 'mongoid' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
13
-
8
+ gem "rails", "4.1.9"
9
+ gem 'mongoid', '~>4.0' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
14
10
  gem 'sequel'
15
11
 
16
12
  gemspec :path => "../"
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "sqlite3", :platforms => :ruby
4
+ gem "coveralls"
5
+ gem 'rubysl', :platforms => :rbx
6
+ gem 'rubinius-developer_tools', :platforms => :rbx
7
+ gem "jruby-openssl", :platforms => :jruby
8
+ gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
9
+ gem "rails", "4.1.9"
10
+ gem 'sequel'
11
+ gem 'mongo_mapper', '~> 0.13'
12
+ gem 'bson_ext', :platforms => :ruby
13
+
14
+ gemspec :path => "../"
@@ -1,16 +1,12 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "sqlite3", :platforms => :ruby
4
- gem "coveralls"
5
4
  gem 'rubysl', :platforms => :rbx
6
5
  gem 'rubinius-developer_tools', :platforms => :rbx
7
6
  gem "jruby-openssl", :platforms => :jruby
8
7
  gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
9
8
  gem "rails", "4.2.0"
10
-
11
- # mongoid is not yet compatible with Rails >= 4
12
- # gem 'mongoid' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
13
-
9
+ gem 'mongoid', '~>4.0' if Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3')
14
10
  gem 'sequel'
15
11
 
16
12
  gemspec :path => "../"
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "sqlite3", :platforms => :ruby
4
+ gem "coveralls"
5
+ gem 'rubysl', :platforms => :rbx
6
+ gem 'rubinius-developer_tools', :platforms => :rbx
7
+ gem "jruby-openssl", :platforms => :jruby
8
+ gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
9
+ gem "rails", "4.2.0"
10
+ gem 'sequel'
11
+ gem 'mongo_mapper'
12
+ gem 'bson_ext', :platforms => :ruby
13
+
14
+ gemspec :path => "../"
data/lib/aasm/aasm.rb CHANGED
@@ -69,8 +69,10 @@ private
69
69
  )
70
70
 
71
71
  if may_fire_to = event.may_fire?(self, *args)
72
- old_state.fire_callbacks(:before_exit, self)
73
- old_state.fire_callbacks(:exit, self) # TODO: remove for AASM 4?
72
+ old_state.fire_callbacks(:before_exit, self,
73
+ *process_args(event, aasm.current_state, *args))
74
+ old_state.fire_callbacks(:exit, self,
75
+ *process_args(event, aasm.current_state, *args)) # TODO: remove for AASM 4?
74
76
 
75
77
  if new_state_name = event.fire(self, {:may_fire => may_fire_to}, *args)
76
78
  aasm_fired(event, old_state, new_state_name, options, *args, &block)
@@ -90,9 +92,11 @@ private
90
92
 
91
93
  new_state = aasm.state_object_for_name(new_state_name)
92
94
 
93
- new_state.fire_callbacks(:before_enter, self)
95
+ new_state.fire_callbacks(:before_enter, self,
96
+ *process_args(event, aasm.current_state, *args))
94
97
 
95
- new_state.fire_callbacks(:enter, self) # TODO: remove for AASM 4?
98
+ new_state.fire_callbacks(:enter, self,
99
+ *process_args(event, aasm.current_state, *args)) # TODO: remove for AASM 4?
96
100
 
97
101
  persist_successful = true
98
102
  if persist
@@ -107,8 +111,10 @@ private
107
111
  end
108
112
 
109
113
  if persist_successful
110
- old_state.fire_callbacks(:after_exit, self)
111
- new_state.fire_callbacks(:after_enter, self)
114
+ old_state.fire_callbacks(:after_exit, self,
115
+ *process_args(event, aasm.current_state, *args))
116
+ new_state.fire_callbacks(:after_enter, self,
117
+ *process_args(event, aasm.current_state, *args))
112
118
  event.fire_callbacks(
113
119
  :after,
114
120
  self,
@@ -129,7 +135,7 @@ private
129
135
  end
130
136
 
131
137
  if AASM::StateMachine[self.class].config.whiny_transitions
132
- raise AASM::InvalidTransition, "Event '#{event_name}' cannot transition from '#{aasm.current_state}'"
138
+ raise AASM::InvalidTransition.new(self, event_name)
133
139
  else
134
140
  false
135
141
  end
@@ -12,7 +12,7 @@ module AASM::Core
12
12
 
13
13
  # from aasm4
14
14
  @options = options # QUESTION: .dup ?
15
- add_options_from_dsl(@options, [:after, :before, :error, :success], &block) if block
15
+ add_options_from_dsl(@options, [:after, :before, :error, :success, :after_commit], &block) if block
16
16
  end
17
17
 
18
18
  # a neutered version of fire - it doesn't actually fire the event, it just
@@ -28,12 +28,12 @@ module AASM::Core
28
28
  name.to_s
29
29
  end
30
30
 
31
- def fire_callbacks(action, record)
31
+ def fire_callbacks(action, record, *args)
32
32
  action = @options[action]
33
33
  catch :halt_aasm_chain do
34
34
  action.is_a?(Array) ?
35
- action.each {|a| _fire_callbacks(a, record)} :
36
- _fire_callbacks(action, record)
35
+ action.each {|a| _fire_callbacks(a, record, args)} :
36
+ _fire_callbacks(action, record, args)
37
37
  end
38
38
  end
39
39
 
@@ -66,12 +66,14 @@ module AASM::Core
66
66
  self
67
67
  end
68
68
 
69
- def _fire_callbacks(action, record)
69
+ def _fire_callbacks(action, record, args)
70
70
  case action
71
71
  when Symbol, String
72
- record.send(action)
72
+ arity = record.send(:method, action.to_sym).arity
73
+ record.send(action, *(arity < 0 ? args : args[0...arity]))
73
74
  when Proc
74
- action.call(record)
75
+ arity = action.arity
76
+ action.call(record, *(arity < 0 ? args : args[0...arity]))
75
77
  end
76
78
  end
77
79
 
data/lib/aasm/errors.rb CHANGED
@@ -1,5 +1,16 @@
1
1
  module AASM
2
- class InvalidTransition < RuntimeError; end
2
+
3
+ class InvalidTransition < RuntimeError
4
+ attr_reader :object, :event_name
5
+ def initialize(object, event_name)
6
+ @object, @event_name = object, event_name
7
+ end
8
+
9
+ def message
10
+ "Event '#{event_name}' cannot transition from '#{object.aasm.current_state}'"
11
+ end
12
+ end
13
+
3
14
  class UndefinedState < RuntimeError; end
4
15
  class NoDirectAssignmentError < RuntimeError; end
5
16
  end
@@ -10,7 +10,7 @@ module AASM
10
10
  #
11
11
  # Adds
12
12
  #
13
- # before_validation :aasm_ensure_initial_state, :on => :create
13
+ # after_initialize :aasm_ensure_initial_state
14
14
  #
15
15
  # As a result, it doesn't matter when you define your methods - the following 2 are equivalent
16
16
  #
@@ -166,7 +166,7 @@ module AASM
166
166
  def aasm_ensure_initial_state
167
167
  # checking via respond_to? does not work in Rails <= 3
168
168
  # if respond_to?(self.class.aasm.attribute_name) && send(self.class.aasm.attribute_name).blank? # Rails 4
169
- if attributes.key?(self.class.aasm.attribute_name.to_s) && send(self.class.aasm.attribute_name).blank?
169
+ if attribute_names.include?(self.class.aasm.attribute_name.to_s) && send(self.class.aasm.attribute_name).blank?
170
170
  aasm.enter_initial_state
171
171
  end
172
172
  end
@@ -187,7 +187,7 @@ module AASM
187
187
  end
188
188
 
189
189
  def aasm_validate_states
190
- unless AASM::StateMachine[self.class].config.skip_validation_on_save
190
+ unless aasm_skipping_validations
191
191
  if aasm.current_state && !aasm.states.include?(aasm.current_state)
192
192
  self.errors.add(AASM::StateMachine[self.class].config.column , "is invalid")
193
193
  end
@@ -71,6 +71,9 @@ module AASM
71
71
  elsif @klass.ancestors.map {|klass| klass.to_s}.include?("Mongoid::Document")
72
72
  scope_options = lambda { @klass.send(:where, {@klass.aasm.attribute_name.to_sym => name.to_s}) }
73
73
  @klass.send(:scope, name, scope_options)
74
+ elsif @klass.ancestors.map {|klass| klass.to_s}.include?("MongoMapper::Document")
75
+ conditions = { @klass.aasm.attribute_name.to_sym => name.to_s }
76
+ @klass.scope(name, lambda { @klass.where(conditions) })
74
77
  end
75
78
  end
76
79
  end
@@ -0,0 +1,174 @@
1
+ require_relative 'base'
2
+
3
+ module AASM
4
+ module Persistence
5
+ module MongoMapperPersistence
6
+ # This method:
7
+ #
8
+ # * extends the model with ClassMethods
9
+ # * includes InstanceMethods
10
+ #
11
+ # Adds
12
+ #
13
+ # before_validation :aasm_ensure_initial_state, :on => :create
14
+ #
15
+ # As a result, it doesn't matter when you define your methods - the following 2 are equivalent
16
+ #
17
+ # class Foo
18
+ # include MongoMapper::Document
19
+ # def aasm_write_state(state)
20
+ # "bar"
21
+ # end
22
+ # include AASM
23
+ # end
24
+ #
25
+ # class Foo < ActiveRecord::Base
26
+ # include MongoMapper::Document
27
+ # include AASM
28
+ # def aasm_write_state(state)
29
+ # "bar"
30
+ # end
31
+ # end
32
+ #
33
+ def self.included(base)
34
+ base.send(:include, AASM::Persistence::Base)
35
+ base.extend AASM::Persistence::MongoMapperPersistence::ClassMethods
36
+ base.send(:include, AASM::Persistence::MongoMapperPersistence::InstanceMethods)
37
+
38
+ base.before_create :aasm_ensure_initial_state
39
+
40
+ # ensure state is in the list of states
41
+ base.validate :aasm_validate_states
42
+ end
43
+
44
+ module ClassMethods
45
+
46
+ def find_in_state(number, state, *args)
47
+ with_state_scope(state).find!(number, *args)
48
+ end
49
+
50
+ def count_in_state(state, *args)
51
+ with_state_scope(state).count(*args)
52
+ end
53
+
54
+ def calculate_in_state(state, *args)
55
+ with_state_scope(state).calculate(*args)
56
+ end
57
+
58
+ protected
59
+ def with_state_scope(state)
60
+ where(aasm.attribute_name.to_sym => state.to_s)
61
+ end
62
+ end
63
+
64
+ module InstanceMethods
65
+
66
+ # Writes <tt>state</tt> to the state column and persists it to the database
67
+ #
68
+ # foo = Foo.find(1)
69
+ # foo.aasm.current_state # => :opened
70
+ # foo.close!
71
+ # foo.aasm.current_state # => :closed
72
+ # Foo.find(1).aasm.current_state # => :closed
73
+ #
74
+ # NOTE: intended to be called from an event
75
+ def aasm_write_state(state)
76
+ old_value = read_attribute(self.class.aasm.attribute_name)
77
+ aasm_write_attribute state
78
+
79
+ success = if aasm_skipping_validations
80
+ value = aasm_raw_attribute_value state
81
+ self.class.where(self.class.primary_key => self.id).update_all(self.class.aasm.attribute_name => value) == 1
82
+ else
83
+ self.save
84
+ end
85
+ unless success
86
+ write_attribute(self.class.aasm.attribute_name, old_value)
87
+ return false
88
+ end
89
+
90
+ true
91
+ end
92
+
93
+ # Writes <tt>state</tt> to the state column, but does not persist it to the database
94
+ #
95
+ # foo = Foo.find(1)
96
+ # foo.aasm.current_state # => :opened
97
+ # foo.close
98
+ # foo.aasm.current_state # => :closed
99
+ # Foo.find(1).aasm.current_state # => :opened
100
+ # foo.save
101
+ # foo.aasm.current_state # => :closed
102
+ # Foo.find(1).aasm.current_state # => :closed
103
+ #
104
+ # NOTE: intended to be called from an event
105
+ def aasm_write_state_without_persistence(state)
106
+ aasm_write_attribute state
107
+ end
108
+
109
+ private
110
+ def aasm_enum
111
+ case AASM::StateMachine[self.class].config.enum
112
+ when false then nil
113
+ when true then aasm_guess_enum_method
114
+ when nil then aasm_guess_enum_method if aasm_column_looks_like_enum
115
+ else AASM::StateMachine[self.class].config.enum
116
+ end
117
+ end
118
+
119
+ def aasm_column_looks_like_enum
120
+ self.class.keys[self.class.aasm.attribute_name.to_s].type == Integer
121
+ end
122
+
123
+ def aasm_guess_enum_method
124
+ self.class.aasm.attribute_name.to_s.pluralize.to_sym
125
+ end
126
+
127
+ def aasm_skipping_validations
128
+ AASM::StateMachine[self.class].config.skip_validation_on_save
129
+ end
130
+
131
+ def aasm_write_attribute(state)
132
+ write_attribute self.class.aasm.attribute_name, aasm_raw_attribute_value(state)
133
+ end
134
+
135
+ def aasm_raw_attribute_value(state)
136
+ if aasm_enum
137
+ self.class.send(aasm_enum)[state]
138
+ else
139
+ state.to_s
140
+ end
141
+ end
142
+
143
+ # Ensures that if the aasm_state column is nil and the record is new
144
+ # that the initial state gets populated before validation on create
145
+ #
146
+ # foo = Foo.new
147
+ # foo.aasm_state # => nil
148
+ # foo.valid?
149
+ # foo.aasm_state # => "open" (where :open is the initial state)
150
+ #
151
+ #
152
+ # foo = Foo.find(:first)
153
+ # foo.aasm_state # => 1
154
+ # foo.aasm_state = nil
155
+ # foo.valid?
156
+ # foo.aasm_state # => nil
157
+ #
158
+ def aasm_ensure_initial_state
159
+ return send("#{self.class.aasm.attribute_name}=", aasm.enter_initial_state.to_s) if send(self.class.aasm.attribute_name).blank?
160
+ end
161
+
162
+ def aasm_validate_states
163
+ send("#{self.class.aasm.attribute_name}=", aasm.enter_initial_state.to_s) if send(self.class.aasm.attribute_name).blank?
164
+ unless AASM::StateMachine[self.class].config.skip_validation_on_save
165
+ if aasm.current_state && !aasm.states.include?(aasm.current_state)
166
+ self.errors.add(AASM::StateMachine[self.class].config.column , "is invalid")
167
+ end
168
+ end
169
+ end
170
+ end # InstanceMethods
171
+
172
+ end
173
+ end # Persistence
174
+ end # AASM
@@ -35,11 +35,7 @@ module AASM
35
35
  base.extend AASM::Persistence::MongoidPersistence::ClassMethods
36
36
  base.send(:include, AASM::Persistence::MongoidPersistence::InstanceMethods)
37
37
 
38
- # Mongoid's Validatable gem dependency goes not have a before_validation_on_xxx hook yet.
39
- # base.before_validation_on_create :aasm_ensure_initial_state
40
- base.before_validation :aasm_ensure_initial_state
41
- # ensure initial aasm state even when validations are skipped
42
- base.before_create :aasm_ensure_initial_state
38
+ base.after_initialize :aasm_ensure_initial_state
43
39
  end
44
40
 
45
41
  module ClassMethods
@@ -72,6 +72,7 @@ module AASM
72
72
  #
73
73
  def aasm_ensure_initial_state
74
74
  aasm.enter_initial_state if
75
+ (new? || values.key?(self.class.aasm.attribute_name)) &&
75
76
  send(self.class.aasm.attribute_name).to_s.strip.empty?
76
77
  end
77
78
 
@@ -10,6 +10,8 @@ module AASM
10
10
  include_persistence base, :active_record
11
11
  elsif hierarchy.include?("Mongoid::Document")
12
12
  include_persistence base, :mongoid
13
+ elsif hierarchy.include?("MongoMapper::Document")
14
+ include_persistence base, :mongo_mapper
13
15
  elsif hierarchy.include?("Sequel::Model")
14
16
  include_persistence base, :sequel
15
17
  else
data/lib/aasm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module AASM
2
- VERSION = "4.0.8"
2
+ VERSION = "4.1.1"
3
3
  end
@@ -44,15 +44,15 @@ module Callbacks
44
44
 
45
45
  def aasm_write_state(*args); log('aasm_write_state'); true; end
46
46
 
47
- def before_enter_open; log('before_enter_open'); end
48
- def before_exit_open; log('before_exit_open'); end
49
- def after_enter_open; log('after_enter_open'); end
50
- def after_exit_open; log('after_exit_open'); end
51
-
52
- def before_enter_closed; log('before_enter_closed'); end
53
- def before_exit_closed; log('before_enter_closed'); end
54
- def after_enter_closed; log('after_enter_closed'); end
55
- def after_exit_closed; log('after_exit_closed'); end
47
+ def before_enter_open(*args); log("before_enter_open(#{args.map(&:inspect).join(',')})"); end
48
+ def before_exit_open(*args); log("before_exit_open(#{args.map(&:inspect).join(',')})"); end
49
+ def after_enter_open(*args); log("after_enter_open(#{args.map(&:inspect).join(',')})"); end
50
+ def after_exit_open(*args); log("after_exit_open(#{args.map(&:inspect).join(',')})"); end
51
+
52
+ def before_enter_closed(*args); log("before_enter_closed(#{args.map(&:inspect).join(',')})"); end
53
+ def before_exit_closed(*args); log("before_enter_closed(#{args.map(&:inspect).join(',')})"); end
54
+ def after_enter_closed(*args); log("after_enter_closed(#{args.map(&:inspect).join(',')})"); end
55
+ def after_exit_closed(*args); log("after_exit_closed(#{args.map(&:inspect).join(',')})"); end
56
56
 
57
57
  def before(arg1, *args); log("before(#{arg1.inspect},#{args.map(&:inspect).join(',')})"); end
58
58
  def transition_proc(arg1, arg2); log("transition_proc(#{arg1.inspect},#{arg2.inspect})"); end
@@ -0,0 +1,10 @@
1
+ class NoScopeMongoMapper
2
+ include MongoMapper::Document
3
+ include AASM
4
+
5
+ key :status, String
6
+
7
+ aasm :create_scopes => false, :column => :status do
8
+ state :ignored_scope
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ class SimpleMongoMapper
2
+ include MongoMapper::Document
3
+ include AASM
4
+
5
+ key :status, String
6
+
7
+ aasm column: :status do
8
+ state :unknown_scope
9
+ state :next
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ class SimpleNewDslMongoMapper
2
+ include MongoMapper::Document
3
+ include AASM
4
+
5
+ key :status, String
6
+
7
+ aasm :column => :status
8
+ aasm do
9
+ state :unknown_scope
10
+ state :next
11
+ end
12
+ end
@@ -6,7 +6,7 @@ class SimpleNewDslMongoid
6
6
 
7
7
  aasm :column => :status
8
8
  aasm do
9
- state :unknown_scope
9
+ state :unknown_scope, :initial => true
10
10
  state :new
11
11
  end
12
12
  end
@@ -12,6 +12,9 @@ class Validator < ActiveRecord::Base
12
12
  transitions :to => :running, :from => :sleeping
13
13
  end
14
14
  event :sleep do
15
+ after_commit do
16
+ change_name_on_sleep
17
+ end
15
18
  transitions :to => :sleeping, :from => :running
16
19
  end
17
20
  event :fail do
@@ -26,6 +29,11 @@ class Validator < ActiveRecord::Base
26
29
  save!
27
30
  end
28
31
 
32
+ def change_name_on_sleep
33
+ self.name = "sleeper"
34
+ save!
35
+ end
36
+
29
37
  def fail
30
38
  raise StandardError.new('failed on purpose')
31
39
  end
data/spec/spec_helper.rb CHANGED
@@ -4,13 +4,12 @@ require 'aasm'
4
4
 
5
5
  require 'rspec'
6
6
 
7
- require 'coveralls'
8
- Coveralls.wear!
9
-
10
7
  # require 'ruby-debug'; Debugger.settings[:autoeval] = true; debugger; rubys_debugger = 'annoying'
11
8
  # require 'ruby-debug/completion'
12
9
  # require 'pry'
13
10
 
11
+ SEQUEL_DB = defined?(JRUBY_VERSION) ? 'jdbc:sqlite::memory:' : 'sqlite:/'
12
+
14
13
  def load_schema
15
14
  config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
16
15
  ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
@@ -145,7 +145,7 @@ describe 'callbacks for the new DSL' do
145
145
 
146
146
  cb.reset_data
147
147
  cb.close!(:arg1, :arg2)
148
- expect(cb.data).to eql 'before(:arg1,:arg2) before_exit_open transition_proc(:arg1,:arg2) before_enter_closed aasm_write_state after_exit_open after_enter_closed after(:arg1,:arg2)'
148
+ expect(cb.data).to eql 'before(:arg1,:arg2) before_exit_open(:arg1,:arg2) transition_proc(:arg1,:arg2) before_enter_closed(:arg1,:arg2) aasm_write_state after_exit_open(:arg1,:arg2) after_enter_closed(:arg1,:arg2) after(:arg1,:arg2)'
149
149
  end
150
150
 
151
151
  it "should call the callbacks given the to-state as argument" do
@@ -431,9 +431,14 @@ describe 'transitions with persistence' do
431
431
  it "should fire :after_commit if transaction was successful" do
432
432
  validator = Validator.create(:name => 'name')
433
433
  expect(validator).to be_sleeping
434
+
434
435
  validator.run!
435
436
  expect(validator).to be_running
436
- expect(validator.name).not_to eq("name")
437
+ expect(validator.name).to eq("name changed")
438
+
439
+ validator.sleep!
440
+ expect(validator).to be_sleeping
441
+ expect(validator.name).to eq("sleeper")
437
442
  end
438
443
 
439
444
  it "should not fire :after_commit if transaction failed" do
@@ -0,0 +1,135 @@
1
+ describe 'mongo_mapper' do
2
+ begin
3
+ require 'mongo_mapper'
4
+ require 'logger'
5
+ require 'spec_helper'
6
+
7
+ before(:all) do
8
+ Dir[File.dirname(__FILE__) + "/../../models/mongo_mapper/*.rb"].sort.each { |f| require File.expand_path(f) }
9
+
10
+ config = {
11
+ 'test' => {
12
+ 'database' => "mongo_mapper_#{Process.pid}"
13
+ }
14
+ }
15
+
16
+ MongoMapper.setup(config, 'test') #, :logger => Logger.new(STDERR))
17
+ end
18
+
19
+ after do
20
+ # Clear Out all non-system Mongo collections between tests
21
+ MongoMapper.database.collections.each do |collection|
22
+ collection.drop unless collection.capped? || (collection.name =~ /\Asystem/)
23
+ end
24
+ end
25
+
26
+ describe "named scopes with the old DSL" do
27
+
28
+ context "Does not already respond_to? the scope name" do
29
+ it "should add a scope" do
30
+ expect(SimpleMongoMapper).to respond_to(:unknown_scope)
31
+ expect(SimpleMongoMapper.unknown_scope.class).to eq(MongoMapper::Plugins::Querying::DecoratedPluckyQuery)
32
+ #expect(SimpleMongoMapper.unknown_scope.is_a?(ActiveRecord::Relation)).to be_truthy
33
+ end
34
+ end
35
+
36
+ context "Already respond_to? the scope name" do
37
+ it "should not add a scope" do
38
+ expect(SimpleMongoMapper).to respond_to(:next)
39
+ expect(SimpleMongoMapper.new.class).to eq(SimpleMongoMapper)
40
+ end
41
+ end
42
+
43
+ end
44
+
45
+ describe "named scopes with the new DSL" do
46
+
47
+ context "Does not already respond_to? the scope name" do
48
+ it "should add a scope" do
49
+ expect(SimpleNewDslMongoMapper).to respond_to(:unknown_scope)
50
+ expect(SimpleNewDslMongoMapper.unknown_scope.class).to eq(MongoMapper::Plugins::Querying::DecoratedPluckyQuery)
51
+ end
52
+ end
53
+
54
+ context "Already respond_to? the scope name" do
55
+ it "should not add a scope" do
56
+ expect(SimpleNewDslMongoMapper).to respond_to(:next)
57
+ expect(SimpleNewDslMongoMapper.new.class).to eq(SimpleNewDslMongoMapper)
58
+ end
59
+ end
60
+
61
+ it "does not create scopes if requested" do
62
+ expect(NoScopeMongoMapper).not_to respond_to(:ignored_scope)
63
+ end
64
+
65
+ end
66
+
67
+ describe "#find_in_state" do
68
+
69
+ let!(:model) { SimpleNewDslMongoMapper.create!(:status => :unknown_scope) }
70
+ let!(:model_id) { model._id }
71
+
72
+ it "should respond to method" do
73
+ expect(SimpleNewDslMongoMapper).to respond_to(:find_in_state)
74
+ end
75
+
76
+ it "should find the model when given the correct scope and model id" do
77
+ expect(SimpleNewDslMongoMapper.find_in_state(model_id, 'unknown_scope').class).to eq(SimpleNewDslMongoMapper)
78
+ expect(SimpleNewDslMongoMapper.find_in_state(model_id, 'unknown_scope')).to eq(model)
79
+ end
80
+
81
+ it "should raise DocumentNotFound error when given incorrect scope" do
82
+ expect {SimpleNewDslMongoMapper.find_in_state(model_id, 'next')}.to raise_error MongoMapper::DocumentNotFound
83
+ end
84
+
85
+ it "should raise DocumentNotFound error when given incorrect model id" do
86
+ expect {SimpleNewDslMongoMapper.find_in_state('bad_id', 'unknown_scope')}.to raise_error MongoMapper::DocumentNotFound
87
+ end
88
+
89
+ end
90
+
91
+ describe "#count_in_state" do
92
+
93
+ before do
94
+ 3.times { SimpleNewDslMongoMapper.create!(:status => :unknown_scope) }
95
+ end
96
+
97
+ it "should respond to method" do
98
+ expect(SimpleNewDslMongoMapper).to respond_to(:count_in_state)
99
+ end
100
+
101
+ it "should return n for a scope with n records persisted" do
102
+ expect(SimpleNewDslMongoMapper.count_in_state('unknown_scope').class).to eq(Fixnum)
103
+ expect(SimpleNewDslMongoMapper.count_in_state('unknown_scope')).to eq(3)
104
+ end
105
+
106
+ it "should return zero for a scope without records persisted" do
107
+ expect(SimpleNewDslMongoMapper.count_in_state('next').class).to eq(Fixnum)
108
+ expect(SimpleNewDslMongoMapper.count_in_state('next')).to eq(0)
109
+ end
110
+
111
+ end
112
+
113
+ describe "instance methods" do
114
+
115
+ let(:simple) {SimpleNewDslMongoMapper.new}
116
+
117
+ it "should call aasm_ensure_initial_state on validation before create" do
118
+ expect(SimpleNewDslMongoMapper.aasm.initial_state).to eq(:unknown_scope)
119
+ expect(SimpleNewDslMongoMapper.aasm.attribute_name).to eq(:status)
120
+ expect(simple.status).to eq(nil)
121
+ simple.valid?
122
+ expect(simple.status).to eq('unknown_scope')
123
+ end
124
+
125
+ it "should call aasm_ensure_initial_state before create, even if skipping validations" do
126
+ expect(simple.status).to eq(nil)
127
+ simple.save(:validate => false)
128
+ expect(simple.status).to eq('unknown_scope')
129
+ end
130
+ end
131
+
132
+ rescue LoadError
133
+ puts "Not running MongoMapper specs because mongo_mapper gem is not installed!!!"
134
+ end
135
+ end
@@ -1,6 +1,4 @@
1
- describe 'mongoid', :if => Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version.create('1.9.3') do
2
- # describe 'mongoid' do
3
-
1
+ describe 'mongoid' do
4
2
  begin
5
3
  require 'mongoid'
6
4
  require 'logger'
@@ -135,15 +133,11 @@ describe 'mongoid', :if => Gem::Version.create(RUBY_VERSION.dup) >= Gem::Version
135
133
  describe "instance methods" do
136
134
  let(:simple) {SimpleNewDslMongoid.new}
137
135
 
138
- it "should call aasm_ensure_initial_state on validation before create" do
139
- expect(simple).to receive(:aasm_ensure_initial_state).and_return(true)
140
- simple.valid?
136
+ it "should initialize the aasm state on instantiation" do
137
+ expect(SimpleNewDslMongoid.new.status).to eql 'unknown_scope'
138
+ expect(SimpleNewDslMongoid.new.aasm.current_state).to eql :unknown_scope
141
139
  end
142
140
 
143
- it "should call aasm_ensure_initial_state before create, even if skipping validations" do
144
- expect(simple).to receive(:aasm_ensure_initial_state).and_return(true)
145
- simple.save(:validate => false)
146
- end
147
141
  end
148
142
 
149
143
  rescue LoadError
@@ -6,7 +6,8 @@ describe 'sequel' do
6
6
  require 'spec_helper'
7
7
 
8
8
  before(:all) do
9
- db = Sequel.sqlite
9
+ db = Sequel.connect(SEQUEL_DB)
10
+
10
11
  # if you want to see the statements while running the spec enable the following line
11
12
  # db.loggers << Logger.new($stderr)
12
13
  db.create_table(:models) do
@@ -43,6 +44,11 @@ describe 'sequel' do
43
44
  expect(model.aasm.current_state).to eq(:alpha)
44
45
  end
45
46
 
47
+ it "should save the initial state" do
48
+ model.save
49
+ expect(model.status).to eq("alpha")
50
+ end
51
+
46
52
  it "should return the aasm column when new and the aasm field is not nil" do
47
53
  model.status = "beta"
48
54
  expect(model.aasm.current_state).to eq(:beta)
@@ -60,6 +66,14 @@ describe 'sequel' do
60
66
  expect(model.aasm.current_state).to be_nil
61
67
  end
62
68
 
69
+ it "should not change the state if state is not loaded" do
70
+ model.release
71
+ model.save
72
+ model.class.select(:id).first.save
73
+ model.reload
74
+ expect(model.aasm.current_state).to eq(:beta)
75
+ end
76
+
63
77
  it "should call aasm_ensure_initial_state on validation before create" do
64
78
  expect(model).to receive(:aasm_ensure_initial_state).and_return(true)
65
79
  model.valid?
@@ -4,7 +4,12 @@ describe 'transitions' do
4
4
 
5
5
  it 'should raise an exception when whiny' do
6
6
  process = ProcessWithNewDsl.new
7
- expect { process.stop! }.to raise_error(AASM::InvalidTransition)
7
+ expect { process.stop! }.to raise_error do |err|
8
+ expect(err.class).to eql(AASM::InvalidTransition)
9
+ expect(err.message).to eql("Event 'stop' cannot transition from 'sleeping'")
10
+ expect(err.object).to eql(process)
11
+ expect(err.event_name).to eql(:stop)
12
+ end
8
13
  expect(process).to be_sleeping
9
14
  end
10
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aasm
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.8
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Barron
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-12-31 00:00:00.000000000 Z
13
+ date: 2015-05-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -91,8 +91,11 @@ files:
91
91
  - callbacks.txt
92
92
  - gemfiles/rails_3.2.gemfile
93
93
  - gemfiles/rails_4.0.gemfile
94
+ - gemfiles/rails_4.0_bson1.gemfile
94
95
  - gemfiles/rails_4.1.gemfile
96
+ - gemfiles/rails_4.1_bson1.gemfile
95
97
  - gemfiles/rails_4.2.gemfile
98
+ - gemfiles/rails_4.2_bson1.gemfile
96
99
  - lib/aasm.rb
97
100
  - lib/aasm/aasm.rb
98
101
  - lib/aasm/base.rb
@@ -107,6 +110,7 @@ files:
107
110
  - lib/aasm/persistence.rb
108
111
  - lib/aasm/persistence/active_record_persistence.rb
109
112
  - lib/aasm/persistence/base.rb
113
+ - lib/aasm/persistence/mongo_mapper_persistence.rb
110
114
  - lib/aasm/persistence/mongoid_persistence.rb
111
115
  - lib/aasm/persistence/plain_persistence.rb
112
116
  - lib/aasm/persistence/sequel_persistence.rb
@@ -132,6 +136,9 @@ files:
132
136
  - spec/models/foo.rb
133
137
  - spec/models/guardian.rb
134
138
  - spec/models/invalid_persistor.rb
139
+ - spec/models/mongo_mapper/no_scope_mongo_mapper.rb
140
+ - spec/models/mongo_mapper/simple_mongo_mapper.rb
141
+ - spec/models/mongo_mapper/simple_new_dsl_mongo_mapper.rb
135
142
  - spec/models/mongoid/no_scope_mongoid.rb
136
143
  - spec/models/mongoid/simple_mongoid.rb
137
144
  - spec/models/mongoid/simple_new_dsl_mongoid.rb
@@ -159,6 +166,7 @@ files:
159
166
  - spec/unit/memory_leak_spec.rb
160
167
  - spec/unit/new_dsl_spec.rb
161
168
  - spec/unit/persistence/active_record_persistence_spec.rb
169
+ - spec/unit/persistence/mongo_mapper_persistance_spec.rb
162
170
  - spec/unit/persistence/mongoid_persistance_spec.rb
163
171
  - spec/unit/persistence/sequel_persistence_spec.rb
164
172
  - spec/unit/reloading_spec.rb
@@ -211,6 +219,9 @@ test_files:
211
219
  - spec/models/foo.rb
212
220
  - spec/models/guardian.rb
213
221
  - spec/models/invalid_persistor.rb
222
+ - spec/models/mongo_mapper/no_scope_mongo_mapper.rb
223
+ - spec/models/mongo_mapper/simple_mongo_mapper.rb
224
+ - spec/models/mongo_mapper/simple_new_dsl_mongo_mapper.rb
214
225
  - spec/models/mongoid/no_scope_mongoid.rb
215
226
  - spec/models/mongoid/simple_mongoid.rb
216
227
  - spec/models/mongoid/simple_new_dsl_mongoid.rb
@@ -238,6 +249,7 @@ test_files:
238
249
  - spec/unit/memory_leak_spec.rb
239
250
  - spec/unit/new_dsl_spec.rb
240
251
  - spec/unit/persistence/active_record_persistence_spec.rb
252
+ - spec/unit/persistence/mongo_mapper_persistance_spec.rb
241
253
  - spec/unit/persistence/mongoid_persistance_spec.rb
242
254
  - spec/unit/persistence/sequel_persistence_spec.rb
243
255
  - spec/unit/reloading_spec.rb