1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
Commit graph

158 commits

Author SHA1 Message Date
Thorsten Böttger
95ef7fc834 no need for WriteState mixin anymore (to keep adding persistence simple) 2013-04-24 13:51:21 +02:00
Thorsten Böttger
044e84b181 no need for ReadState anymore 2013-04-24 13:03:24 +02:00
Thorsten Böttger
3a331e89ca using Ruby method resolution to read the current state 2013-04-24 12:57:06 +02:00
Thorsten Böttger
55f6ccdcad fixed tests for Mongoid 2013-04-21 19:20:53 +02:00
Thorsten Böttger
461886e394 one file per test model class 2013-04-21 18:43:03 +02:00
James Herdman
1b422a537f AASM defines constants for each state name
Example:

  class Foo
    include AASM

    aasm do
      state :initialized
      state :calculated
      state :finalized
    end
  end

  > Foo::STATE_INITIALIZED
  => :initialized
  > Foo::STATE_CALCULATED
  => :calculated

You may find this useful in custom scopes when using ActiveRecord, or
when testing your classes.
2013-03-15 00:07:01 -04:00
Thorsten Böttger
f4b3701a68 added test 2013-02-27 15:13:56 +13:00
Thorsten Böttger
233d99b906 continued to refactor instance methods for AASM objects 2013-02-22 19:15:03 +13:00
Thorsten Böttger
d88fa9f2bc refactored SupportClasses away 2013-02-22 16:02:40 +13:00
Thorsten Böttger
98b54a0141 renamed StateTransition to Transition to simply shorten its name 2013-02-22 15:54:51 +13:00
Vladimir Meremyanin
a9eefa97dc Breaking changes: success/error callbacks called in context of record, not with record as argument.
Refactored callbacks in event.rb, added support for inline definition of success/error callbacks.
2013-02-21 12:01:59 +04:00
Vladimir Meremyanin
50e7a252c9 fixed event specs 2013-02-21 11:22:48 +04:00
Vladimir Meremyanin
82b5d84452 fixed after callback spec 2013-02-21 11:13:43 +04:00
Vladimir Meremyanin
37b272406c fixed and improved spec coverage for befire/after callbacks 2013-02-21 08:54:43 +04:00
Vladimir Meremyanin
36054af9c8 Append callbacks instead of overriding them.
Improved tests coverage
2013-02-20 13:19:33 +04:00
Vladimir Meremyanin
9f39a22231 implemented inline before/after callbacks for events 2013-02-02 12:22:52 +04:00
Johnny Shields
1b4e44709b Using Ruby 1.8 hash syntax 2013-01-08 04:47:58 +09:00
Johnny Shields
a2e8d42c27 More isolation of Ruby version for Mongoid testing/travis purposes 2013-01-08 04:37:37 +09:00
Johnny Shields
86177860da Skipping Mongoid except on Ruby 1.9.3 or greater. 2013-01-08 04:28:23 +09:00
Johnny Shields
13e7090d40 Added autocreation of state scopes for Mongoid, including RSpec tests. The interface mirrors the ActiveRecord support for the same.
Summary of changes
- Added the following methods to persistence/mongoid_persistence.rb
  - find_in_state
  - count_in_state
  - with_state_scope (protected in AR, would argue it should be made public there.
  - I did not port calculate_in_state, due to AR vs. Mongoid API differences; I made with_state_scope public instead. (I think it should be public for AR as well.)
- Moved AASM::Base patch which aliases scopes in persistence/active_record_persistence.rb to persistence/base.rb, and added a Mongoid detection clause to the if statement (in addition to AR). Also deleted commented code from the original method.
- Added 'mongoid' as dev dependency to gemspec
- Created two test files (mongoid_persistance_spec.rb and mongoid_models.rb) covering all my changes.
2013-01-07 07:29:35 +09:00
Thorsten Böttger
5619789c3d added support for localized state names (on a class level, like Record.aasm.states.map(&:localized_name)) 2012-12-27 10:23:41 +13:00
Thorsten Böttger
7dc7bcbb8c fix: may run localizer specs only 2012-12-27 09:51:01 +13:00
Thorsten Böttger
2ed43c3d3d a little bit of cleanup for the specs 2012-12-13 22:46:34 +13:00
Thorsten Böttger
9244ea02a1 reflecting the class structure in the specs as well 2012-12-09 22:35:35 +13:00
Thorsten Böttger
48075783ce cleaning up specs, part x 2012-12-09 22:32:32 +13:00
Thorsten Böttger
292138f823 cleaning up specs 2012-12-04 16:27:47 +13:00
Thorsten Böttger
5c6e0cd768 refactored tests 2012-12-03 22:54:15 +13:00
Thorsten Böttger
f44d10129f reformatted 2012-12-02 21:45:11 +13:00
Thorsten Böttger
bef8a274fb kiss 2012-12-02 20:55:16 +13:00
Thorsten Böttger
6160269635 better naming (test classes) 2012-12-02 20:54:58 +13:00
Thorsten Böttger
d8b8d5f5c3 improving tests 2012-12-02 20:51:48 +13:00
Thorsten Böttger
25ad26332b cleaning up tests 2012-11-28 22:58:52 +13:00
Thorsten Böttger
9fbbd41ae5 fix Travis build 2012-11-28 22:56:52 +13:00
Thorsten Böttger
475985f282 started to clean up the specs 2012-11-28 22:42:41 +13:00
Thorsten Böttger
df456af1af disabling the memory leak test for now 2012-11-06 23:51:14 +13:00
Thorsten Böttger
88f189d344 next try 2012-11-06 23:47:41 +13:00
Thorsten Böttger
b28b98d4e6 trying to understand, why Travis with Ruby 1.9.3 keeps failing 2012-11-06 23:31:13 +13:00
Thorsten Böttger
ccdb2c9790 supporting event inspection for to-states transitions (Event#transitions_to_state?) 2012-11-06 11:51:05 +13:00
Thorsten Böttger
1b7dfd628b cleaned up event tests 2012-11-06 11:38:50 +13:00
Thorsten Böttger
f2eeb2e4dc dry up read state (for persistence) 2012-11-05 21:48:44 +13:00
Thorsten Böttger
e8671ae448 refactored inspection spec 2012-10-26 22:40:57 +13:00
Thorsten Böttger
50e335be05 refactored test for complex example 2012-10-26 22:27:17 +13:00
Thorsten Böttger
547b9c30c4 refactored ActiveRecord specs 2012-10-26 22:18:44 +13:00
Thorsten Böttger
7564f87e17 refactored ActiveRecord specs 2012-10-26 22:09:54 +13:00
Thorsten Böttger
f4ccee8272 removed test classes from spec itself 2012-10-26 21:52:39 +13:00
Thorsten Böttger
5954101708 moved persistence spec into its own folder 2012-10-26 21:50:43 +13:00
Thorsten Böttger
182b5f9313 refactored callbacks tests for old DSL 2012-10-26 21:44:56 +13:00
Thorsten Böttger
c37d92204c added test for callbacks with new DSL 2012-10-26 20:01:16 +13:00
Thorsten Böttger
05d64cdf37 supporting ActiveRecord transactions when firing an event 2012-10-24 21:03:09 +13:00
Thorsten Böttger
a70de40486 aasm_from_states_for_state now supports to filter for specific transition 2012-10-19 23:05:43 +13:00