aasm 4.12.3 → 5.0.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.
- checksums.yaml +4 -4
- data/.travis.yml +14 -12
- data/Appraisals +39 -16
- data/CHANGELOG.md +16 -3
- data/Dockerfile +44 -0
- data/Gemfile +1 -2
- data/README.md +41 -11
- data/docker-compose.yml +40 -0
- data/gemfiles/rails_3.2.gemfile +6 -6
- data/gemfiles/rails_4.0.gemfile +7 -7
- data/gemfiles/rails_4.2.gemfile +8 -8
- data/gemfiles/rails_4.2_mongoid_5.gemfile +5 -5
- data/gemfiles/rails_4.2_nobrainer.gemfile +9 -0
- data/gemfiles/rails_5.0.gemfile +5 -6
- data/gemfiles/rails_5.0_nobrainer.gemfile +9 -0
- data/gemfiles/rails_5.1.gemfile +13 -0
- data/lib/aasm.rb +5 -0
- data/lib/aasm/aasm.rb +1 -0
- data/lib/aasm/core/event.rb +6 -21
- data/lib/aasm/core/invoker.rb +129 -0
- data/lib/aasm/core/invokers/base_invoker.rb +75 -0
- data/lib/aasm/core/invokers/class_invoker.rb +52 -0
- data/lib/aasm/core/invokers/literal_invoker.rb +47 -0
- data/lib/aasm/core/invokers/proc_invoker.rb +59 -0
- data/lib/aasm/core/state.rb +10 -9
- data/lib/aasm/core/transition.rb +7 -68
- data/lib/aasm/errors.rb +2 -2
- data/lib/aasm/persistence.rb +3 -0
- data/lib/aasm/persistence/active_record_persistence.rb +5 -4
- data/lib/aasm/persistence/no_brainer_persistence.rb +105 -0
- data/lib/aasm/persistence/plain_persistence.rb +2 -1
- data/lib/aasm/persistence/sequel_persistence.rb +0 -1
- data/lib/aasm/rspec/allow_event.rb +5 -1
- data/lib/aasm/rspec/allow_transition_to.rb +5 -1
- data/lib/aasm/version.rb +1 -1
- data/lib/generators/nobrainer/aasm_generator.rb +28 -0
- data/lib/motion-aasm.rb +1 -0
- data/spec/database.rb +3 -0
- data/spec/generators/no_brainer_generator_spec.rb +29 -0
- data/spec/models/active_record/simple_new_dsl.rb +15 -0
- data/spec/models/nobrainer/complex_no_brainer_example.rb +36 -0
- data/spec/models/nobrainer/invalid_persistor_no_brainer.rb +39 -0
- data/spec/models/nobrainer/no_scope_no_brainer.rb +21 -0
- data/spec/models/nobrainer/nobrainer_relationships.rb +25 -0
- data/spec/models/nobrainer/silent_persistor_no_brainer.rb +39 -0
- data/spec/models/nobrainer/simple_new_dsl_nobrainer.rb +25 -0
- data/spec/models/nobrainer/simple_no_brainer.rb +23 -0
- data/spec/models/nobrainer/validator_no_brainer.rb +98 -0
- data/spec/models/simple_example.rb +2 -0
- data/spec/models/simple_example_with_guard_args.rb +17 -0
- data/spec/spec_helpers/active_record.rb +2 -1
- data/spec/spec_helpers/dynamoid.rb +7 -5
- data/spec/spec_helpers/mongoid.rb +20 -1
- data/spec/spec_helpers/nobrainer.rb +15 -0
- data/spec/spec_helpers/redis.rb +5 -2
- data/spec/spec_helpers/sequel.rb +1 -1
- data/spec/unit/callback_multiple_spec.rb +3 -3
- data/spec/unit/callbacks_spec.rb +2 -2
- data/spec/unit/exception_spec.rb +1 -1
- data/spec/unit/invoker_spec.rb +189 -0
- data/spec/unit/invokers/base_invoker_spec.rb +72 -0
- data/spec/unit/invokers/class_invoker_spec.rb +95 -0
- data/spec/unit/invokers/literal_invoker_spec.rb +86 -0
- data/spec/unit/invokers/proc_invoker_spec.rb +86 -0
- data/spec/unit/persistence/active_record_persistence_spec.rb +16 -0
- data/spec/unit/persistence/mongoid_persistence_multiple_spec.rb +0 -4
- data/spec/unit/persistence/mongoid_persistence_spec.rb +0 -4
- data/spec/unit/persistence/no_brainer_persistence_multiple_spec.rb +198 -0
- data/spec/unit/persistence/no_brainer_persistence_spec.rb +158 -0
- data/spec/unit/rspec_matcher_spec.rb +6 -0
- data/spec/unit/state_spec.rb +2 -2
- data/spec/unit/transition_spec.rb +1 -1
- data/test/minitest_helper.rb +2 -2
- data/test/unit/minitest_matcher_test.rb +1 -1
- metadata +51 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea455b8d666bb3c526bec4b9be0736719a3b38a5
|
4
|
+
data.tar.gz: 3987011c8c53b930f369f76399b37194966bd170
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b35a314d950405db70775b44f8cb06617d5b4987d1f07e586069e19dcab525e761d71551019c53340b622733a8600de5ce238a44cf685854801696203cdda4d0
|
7
|
+
data.tar.gz: 3852368590562313ea46427efb3c41d1f414c9a379e522880d7af472807014350a109ab65c2ebe445dbbd6132cee531375e20bb0fd36a83eea425d4cf054d377
|
data/.travis.yml
CHANGED
@@ -3,22 +3,26 @@ language: ruby
|
|
3
3
|
cache: bundler
|
4
4
|
|
5
5
|
rvm:
|
6
|
-
- 1.9.3
|
7
6
|
- 2.2.6
|
8
7
|
- 2.3.3
|
9
|
-
- jruby-
|
10
|
-
- jruby-9.0.5.0
|
8
|
+
- jruby-9.1.12.0
|
11
9
|
|
12
10
|
services:
|
13
11
|
- mongodb
|
14
12
|
- redis-server
|
15
13
|
|
14
|
+
addons:
|
15
|
+
rethinkdb: '2.3.6'
|
16
|
+
|
16
17
|
gemfile:
|
17
18
|
- gemfiles/rails_3.2.gemfile
|
18
19
|
- gemfiles/rails_4.0.gemfile
|
19
20
|
- gemfiles/rails_4.2.gemfile
|
20
21
|
- gemfiles/rails_4.2_mongoid_5.gemfile
|
22
|
+
- gemfiles/rails_4.2_nobrainer.gemfile
|
21
23
|
- gemfiles/rails_5.0.gemfile
|
24
|
+
- gemfiles/rails_5.0_nobrainer.gemfile
|
25
|
+
- gemfiles/rails_5.1.gemfile
|
22
26
|
|
23
27
|
before_script:
|
24
28
|
- mkdir /tmp/dynamodb
|
@@ -32,20 +36,18 @@ script:
|
|
32
36
|
|
33
37
|
matrix:
|
34
38
|
exclude:
|
35
|
-
- rvm: 1.9.3
|
36
|
-
gemfile: gemfiles/rails_4.2_mongoid_5.gemfile
|
37
|
-
- rvm: 1.9.3
|
38
|
-
gemfile: gemfiles/rails_5.0.gemfile
|
39
39
|
- rvm: 2.2.6
|
40
40
|
gemfile: gemfiles/rails_3.2.gemfile
|
41
41
|
- rvm: 2.3.3
|
42
42
|
gemfile: gemfiles/rails_3.2.gemfile
|
43
|
-
- rvm: jruby-1.
|
44
|
-
gemfile: gemfiles/rails_4.2_mongoid_5.gemfile
|
45
|
-
- rvm: jruby-1.7
|
46
|
-
gemfile: gemfiles/rails_5.0.gemfile
|
47
|
-
- rvm: jruby-9.0.5.0
|
43
|
+
- rvm: jruby-9.1.12.0
|
48
44
|
gemfile: gemfiles/rails_5.0.gemfile
|
45
|
+
- rvm: jruby-9.1.12.0
|
46
|
+
gemfile: gemfiles/rails_5.1.gemfile
|
47
|
+
- rvm: jruby-9.1.12.0
|
48
|
+
gemfile: gemfiles/rails_4.2_nobrainer.gemfile
|
49
|
+
- rvm: jruby-9.1.12.0
|
50
|
+
gemfile: gemfiles/rails_5.0_nobrainer.gemfile
|
49
51
|
|
50
52
|
notifications:
|
51
53
|
slack:
|
data/Appraisals
CHANGED
@@ -1,43 +1,66 @@
|
|
1
1
|
appraise 'rails_3.2' do
|
2
|
-
gem 'rails', '~>3.2.22'
|
3
|
-
gem 'mongoid', '~>3.1'
|
2
|
+
gem 'rails', '~> 3.2.22'
|
3
|
+
gem 'mongoid', '~> 3.1'
|
4
4
|
gem 'sequel'
|
5
|
-
gem 'bson_ext',
|
5
|
+
gem 'bson_ext', platforms: :ruby
|
6
6
|
gem 'test-unit', '~> 3.0'
|
7
|
+
gem 'activerecord-jdbcsqlite3-adapter', '1.3.24', platforms: :jruby
|
7
8
|
end
|
8
9
|
|
9
10
|
appraise 'rails_4.0' do
|
10
|
-
gem 'mime-types', '~> 2',
|
11
|
+
gem 'mime-types', '~> 2', platforms: %i[ruby_19 jruby]
|
11
12
|
gem 'rails', '4.0.13'
|
12
|
-
gem 'mongoid', '~>4.0'
|
13
|
+
gem 'mongoid', '~> 4.0'
|
13
14
|
gem 'sequel'
|
14
|
-
gem 'dynamoid', '~> 1',
|
15
|
-
gem 'aws-sdk', '~>2',
|
15
|
+
gem 'dynamoid', '~> 1', platforms: :ruby
|
16
|
+
gem 'aws-sdk', '~> 2', platforms: :ruby
|
16
17
|
gem 'redis-objects'
|
18
|
+
gem 'activerecord-jdbcsqlite3-adapter', '1.3.24', platforms: :jruby
|
17
19
|
end
|
18
20
|
|
19
21
|
appraise 'rails_4.2' do
|
20
|
-
gem 'nokogiri', '1.6.8.1',
|
21
|
-
gem 'mime-types', '~> 2',
|
22
|
+
gem 'nokogiri', '1.6.8.1', platforms: %i[ruby_19]
|
23
|
+
gem 'mime-types', '~> 2', platforms: %i[ruby_19 jruby]
|
22
24
|
gem 'rails', '4.2.5'
|
23
|
-
gem 'mongoid', '~>4.0'
|
25
|
+
gem 'mongoid', '~> 4.0'
|
24
26
|
gem 'sequel'
|
25
|
-
gem 'dynamoid', '~> 1',
|
26
|
-
gem 'aws-sdk', '~>2',
|
27
|
+
gem 'dynamoid', '~> 1', platforms: :ruby
|
28
|
+
gem 'aws-sdk', '~> 2', platforms: :ruby
|
27
29
|
gem 'redis-objects'
|
30
|
+
gem 'activerecord-jdbcsqlite3-adapter', '1.3.24', platforms: :jruby
|
31
|
+
end
|
32
|
+
|
33
|
+
appraise 'rails_4.2_nobrainer' do
|
34
|
+
gem 'rails', '4.2.5'
|
35
|
+
gem 'nobrainer', '~> 0.33.0'
|
28
36
|
end
|
29
37
|
|
30
38
|
appraise 'rails_4.2_mongoid_5' do
|
31
|
-
gem 'mime-types', '~> 2',
|
39
|
+
gem 'mime-types', '~> 2', platforms: %i[ruby_19 jruby]
|
32
40
|
gem 'rails', '4.2.5'
|
33
|
-
gem 'mongoid', '~>5.0'
|
41
|
+
gem 'mongoid', '~> 5.0'
|
42
|
+
gem 'activerecord-jdbcsqlite3-adapter', '1.3.24', platforms: :jruby
|
34
43
|
end
|
35
44
|
|
36
45
|
appraise 'rails_5.0' do
|
37
46
|
gem 'rails', '5.0.0'
|
47
|
+
gem 'mongoid', '~> 6.0'
|
48
|
+
gem 'sequel'
|
49
|
+
gem 'dynamoid', '~> 1', platforms: :ruby
|
50
|
+
gem 'aws-sdk', '~> 2', platforms: :ruby
|
51
|
+
gem 'redis-objects'
|
52
|
+
end
|
53
|
+
|
54
|
+
appraise 'rails_5.0_nobrainer' do
|
55
|
+
gem 'rails', '5.0.0'
|
56
|
+
gem 'nobrainer', '~> 0.33.0'
|
57
|
+
end
|
58
|
+
|
59
|
+
appraise 'rails_5.1' do
|
60
|
+
gem 'rails', '5.1'
|
38
61
|
gem 'mongoid', '~>6.0'
|
39
62
|
gem 'sequel'
|
40
|
-
gem 'dynamoid', '~> 1',
|
41
|
-
gem 'aws-sdk', '~>2',
|
63
|
+
gem 'dynamoid', '~> 1', platforms: :ruby
|
64
|
+
gem 'aws-sdk', '~>2', platforms: :ruby
|
42
65
|
gem 'redis-objects'
|
43
66
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
3
|
## unreleased
|
4
|
+
|
5
|
+
## 5.0.1
|
6
|
+
|
7
|
+
* Fix failures array in transition not being reset [#383](https://github.com/aasm/aasm/issues/383)
|
8
|
+
* Enable AASM scopes to be defined on abstract classes.
|
9
|
+
|
10
|
+
## 5.0.0
|
11
|
+
|
12
|
+
* Chore(invokers): Refactor callback invokers, add class-callbacks support [#541](https://github.com/aasm/aasm/pull/541), thanks to [pandomic](https://github.com/pandomic)
|
13
|
+
* Add docker setup to readme
|
14
|
+
* Add support for Nobrainer (RethinkDB) [#522](https://github.com/aasm/aasm/pull/522), thanks to [zedtux](https://github.com/zedtux)
|
15
|
+
* Patch `allow_event` to accept event with custom arguments [#419](https://github.com/aasm/aasm/pull/419), thanks to [czhc](https://github.com/czhc)
|
16
|
+
|
4
17
|
## 4.12.3
|
5
18
|
|
6
19
|
* Add to AASM fire(event) and fire!(event) methods [#494](https://github.com/aasm/aasm/pull/494), thanks to [slayer](https://github.com/slayer)
|
@@ -14,9 +27,9 @@
|
|
14
27
|
|
15
28
|
## 4.12.1
|
16
29
|
|
17
|
-
* DRY-up Mongoid and ActiveRecord Persistence, Add Sequel transactions and locking [#475](https://github.com/aasm/aasm/pull/475), thanks to [@Aryk]
|
18
|
-
* Add aliases for event methods [#476](https://github.com/aasm/aasm/pull/476), thanks to [@Aryk]
|
19
|
-
* Support Minitest spec expectations [#387](https://github.com/aasm/aasm/pull/387), thanks to [@faragorn]
|
30
|
+
* DRY-up Mongoid and ActiveRecord Persistence, Add Sequel transactions and locking [#475](https://github.com/aasm/aasm/pull/475), thanks to [@Aryk](https://github.com/Aryk)
|
31
|
+
* Add aliases for event methods [#476](https://github.com/aasm/aasm/pull/476), thanks to [@Aryk](https://github.com/Aryk)
|
32
|
+
* Support Minitest spec expectations [#387](https://github.com/aasm/aasm/pull/387), thanks to [@faragorn](https://github.com/faragorn)
|
20
33
|
## 4.12.0
|
21
34
|
|
22
35
|
* Fix thread safe issue with concurrent-ruby gem [see [pull-request #422](https://github.com/aasm/aasm/pull/442), thanks to [@reidmorrison](https://github.com/reidmorrison)
|
data/Dockerfile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
FROM ruby:2.3.4-slim
|
2
|
+
|
3
|
+
LABEL maintainer="AASM"
|
4
|
+
|
5
|
+
ENV DEBIAN_FRONTEND noninteractive
|
6
|
+
|
7
|
+
# ~~~~ System locales ~~~~
|
8
|
+
RUN apt-get update && apt-get install -y locales && \
|
9
|
+
dpkg-reconfigure locales && \
|
10
|
+
locale-gen C.UTF-8 && \
|
11
|
+
/usr/sbin/update-locale LANG=C.UTF-8 && \
|
12
|
+
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && \
|
13
|
+
locale-gen
|
14
|
+
|
15
|
+
# Set default locale for the environment
|
16
|
+
ENV LC_ALL C.UTF-8
|
17
|
+
ENV LANG en_US.UTF-8
|
18
|
+
ENV LANGUAGE en_US.UTF-8
|
19
|
+
ENV APP_HOME /application
|
20
|
+
|
21
|
+
# ~~~~ Application dependencies ~~~~
|
22
|
+
RUN apt-get update
|
23
|
+
RUN apt-get install -y libsqlite3-dev \
|
24
|
+
build-essential \
|
25
|
+
git
|
26
|
+
|
27
|
+
# ~~~~ Bundler ~~~~
|
28
|
+
RUN gem install bundler
|
29
|
+
|
30
|
+
WORKDIR $APP_HOME
|
31
|
+
RUN mkdir -p $APP_HOME/lib/aasm/
|
32
|
+
|
33
|
+
COPY Gemfile* $APP_HOME/
|
34
|
+
COPY *.gemspec $APP_HOME/
|
35
|
+
COPY lib/aasm/version.rb $APP_HOME/lib/aasm/
|
36
|
+
|
37
|
+
ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile \
|
38
|
+
BUNDLE_JOBS=8 \
|
39
|
+
BUNDLE_PATH=/bundle
|
40
|
+
|
41
|
+
RUN bundle install
|
42
|
+
|
43
|
+
# ~~~~ Import application ~~~~
|
44
|
+
COPY . $APP_HOME
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -24,6 +24,7 @@
|
|
24
24
|
- [Sequel](#sequel)
|
25
25
|
- [Dynamoid](#dynamoid)
|
26
26
|
- [Mongoid](#mongoid)
|
27
|
+
- [Nobrainer](#nobrainer)
|
27
28
|
- [Redis](#redis)
|
28
29
|
- [Automatic Scopes](#automatic-scopes)
|
29
30
|
- [Transaction support](#transaction-support)
|
@@ -42,6 +43,7 @@
|
|
42
43
|
- [Bundler](#or-if-you-are-using-bundler)
|
43
44
|
- [Building your own gems](#building-your-own-gems)
|
44
45
|
- [Generators](#generators)
|
46
|
+
- [Test suite with Docker](#docker)
|
45
47
|
- [Latest changes](#latest-changes)
|
46
48
|
- [Questions?](#questions)
|
47
49
|
- [Maintainers](#maintainers)
|
@@ -52,10 +54,8 @@
|
|
52
54
|
This package contains AASM, a library for adding finite state machines to Ruby classes.
|
53
55
|
|
54
56
|
AASM started as the *acts_as_state_machine* plugin but has evolved into a more generic library
|
55
|
-
that no longer targets only ActiveRecord models. It currently provides adapters for
|
56
|
-
|
57
|
-
and [Mongoid](http://mongoid.org/) but it can be used for any Ruby class, no matter what
|
58
|
-
parent class it has (if any).
|
57
|
+
that no longer targets only ActiveRecord models. It currently provides adapters for many
|
58
|
+
ORMs but it can be used for any Ruby class, no matter what parent class it has (if any).
|
59
59
|
|
60
60
|
## Upgrade from version 3 to 4
|
61
61
|
|
@@ -130,8 +130,8 @@ the transition succeeds :
|
|
130
130
|
|
131
131
|
### Callbacks
|
132
132
|
|
133
|
-
You can define a number of callbacks for your transitions. These methods will be
|
134
|
-
called
|
133
|
+
You can define a number of callbacks for your events, transitions and states. These methods, Procs or classes will be
|
134
|
+
called when certain criteria are met, like entering a particular state:
|
135
135
|
|
136
136
|
```ruby
|
137
137
|
class Job
|
@@ -139,7 +139,7 @@ class Job
|
|
139
139
|
|
140
140
|
aasm do
|
141
141
|
state :sleeping, :initial => true, :before_enter => :do_something
|
142
|
-
state :running
|
142
|
+
state :running, before_enter: Proc.new { do_something && notify_somebody }
|
143
143
|
state :finished
|
144
144
|
|
145
145
|
after_all_transitions :log_status_change
|
@@ -195,6 +195,8 @@ is finished.
|
|
195
195
|
|
196
196
|
AASM will also initialize `LogRunTime` and run the `call` method for you after the transition from `running` to `finished` in the example above. You can pass arguments to the class by defining an initialize method on it, like this:
|
197
197
|
|
198
|
+
Note that Procs are executed in the context of a record, it means that you don't need to expect the record as an argument, just call the methods you need.
|
199
|
+
|
198
200
|
```ruby
|
199
201
|
class LogRunTime
|
200
202
|
# optional args parameter can be omitted, but if you define initialize
|
@@ -225,7 +227,7 @@ callback, which can handle it or re-raise it for further propagation.
|
|
225
227
|
|
226
228
|
Also, you can define a method that will be called if any event fails:
|
227
229
|
|
228
|
-
```
|
230
|
+
```ruby
|
229
231
|
def aasm_event_failed(event_name, old_state_name)
|
230
232
|
# use custom exception/messages, report metrics, etc
|
231
233
|
end
|
@@ -523,7 +525,7 @@ All _AASM_ class- and instance-level `aasm` methods accept a state machine selec
|
|
523
525
|
So, for example, to use inspection on a class level, you have to use
|
524
526
|
|
525
527
|
```ruby
|
526
|
-
SimpleMultipleExample.aasm(:
|
528
|
+
SimpleMultipleExample.aasm(:move).states.map(&:name)
|
527
529
|
# => [:standing, :walking, :running]
|
528
530
|
```
|
529
531
|
|
@@ -630,7 +632,7 @@ class CustomAASMBase < AASM::Base
|
|
630
632
|
end
|
631
633
|
```
|
632
634
|
|
633
|
-
When we declare our model that has an AASM state machine, we simply declare the AASM block with a `:
|
635
|
+
When we declare our model that has an AASM state machine, we simply declare the AASM block with a `:with_klass` key to our own class.
|
634
636
|
|
635
637
|
```ruby
|
636
638
|
class SimpleCustomExample
|
@@ -825,6 +827,23 @@ class Job
|
|
825
827
|
end
|
826
828
|
```
|
827
829
|
|
830
|
+
### NoBrainer
|
831
|
+
|
832
|
+
AASM also supports persistence to [RethinkDB](https://www.rethinkdb.com/)
|
833
|
+
if you're using [Nobrainer](http://nobrainer.io/).
|
834
|
+
Make sure to include NoBrainer::Document before you include AASM.
|
835
|
+
|
836
|
+
```ruby
|
837
|
+
class Job
|
838
|
+
include NoBrainer::Document
|
839
|
+
include AASM
|
840
|
+
field :aasm_state
|
841
|
+
aasm do
|
842
|
+
...
|
843
|
+
end
|
844
|
+
end
|
845
|
+
```
|
846
|
+
|
828
847
|
### Redis
|
829
848
|
|
830
849
|
AASM also supports persistence in Redis via
|
@@ -1193,6 +1212,9 @@ expect(multiple).to allow_event(:start).on(:move)
|
|
1193
1212
|
expect(multiple).to_not allow_event(:stop).on(:move)
|
1194
1213
|
expect(multiple).to allow_transition_to(:processing).on(:move)
|
1195
1214
|
expect(multiple).to_not allow_transition_to(:sleeping).on(:move)
|
1215
|
+
# allow_event also accepts arguments
|
1216
|
+
expect(job).to allow_event(:run).with(:defragmentation)
|
1217
|
+
|
1196
1218
|
```
|
1197
1219
|
|
1198
1220
|
#### Minitest
|
@@ -1203,7 +1225,7 @@ AASM provides assertions and rspec-like expectations for [Minitest](https://gith
|
|
1203
1225
|
|
1204
1226
|
List of supported assertions: `assert_have_state`, `refute_have_state`, `assert_transitions_from`, `refute_transitions_from`, `assert_event_allowed`, `refute_event_allowed`, `assert_transition_to_allowed`, `refute_transition_to_allowed`.
|
1205
1227
|
|
1206
|
-
Add `require 'aasm/minitest' to your `test_helper.rb` file and use them like this:
|
1228
|
+
Add `require 'aasm/minitest'` to your `test_helper.rb` file and use them like this:
|
1207
1229
|
|
1208
1230
|
```ruby
|
1209
1231
|
# classes with only the default state machine
|
@@ -1312,6 +1334,14 @@ Replace NAME with the Model name, COLUMN_NAME is optional(default is 'aasm_state
|
|
1312
1334
|
This will create a model (if one does not exist) and configure it with aasm block.
|
1313
1335
|
For Active record orm a migration file is added to add aasm state column to table.
|
1314
1336
|
|
1337
|
+
### Docker
|
1338
|
+
|
1339
|
+
Run test suite easily on docker
|
1340
|
+
```
|
1341
|
+
1. docker-compose build aasm
|
1342
|
+
2. docker-compose run --rm aasm
|
1343
|
+
```
|
1344
|
+
|
1315
1345
|
## Latest changes ##
|
1316
1346
|
|
1317
1347
|
Take a look at the [CHANGELOG](https://github.com/aasm/aasm/blob/master/CHANGELOG.md) for details about recent changes to the current version.
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
version: "2"
|
2
|
+
|
3
|
+
services:
|
4
|
+
aasm:
|
5
|
+
image: aasm/aasm
|
6
|
+
build: .
|
7
|
+
command: bash -c 'bundle exec appraisal install && bundle exec appraisal rspec'
|
8
|
+
environment:
|
9
|
+
- DYNAMODB_HOST=dynamodb
|
10
|
+
- DYNAMODB_PORT=8000
|
11
|
+
- MONGODB_HOST=mongo
|
12
|
+
- MONGODB_PORT=27017
|
13
|
+
- RAILS_ENV=development
|
14
|
+
- REDIS_HOST=redis
|
15
|
+
- REDIS_PORT=6379
|
16
|
+
- RETHINKDB_DB=rethinkdb_test
|
17
|
+
- RETHINKDB_HOST=rethinkdb
|
18
|
+
- RETHINKDB_PORT=28015
|
19
|
+
depends_on:
|
20
|
+
- dynamodb
|
21
|
+
- mongo
|
22
|
+
- redis
|
23
|
+
- rethinkdb
|
24
|
+
volumes:
|
25
|
+
- .:/application
|
26
|
+
volumes_from:
|
27
|
+
- bundle
|
28
|
+
bundle:
|
29
|
+
image: aasm/aasm
|
30
|
+
command: echo Bundler data container
|
31
|
+
volumes:
|
32
|
+
- /bundle
|
33
|
+
dynamodb:
|
34
|
+
image: cnadiminti/dynamodb-local:2017-02-16
|
35
|
+
mongo:
|
36
|
+
image: mongo:3.6.1
|
37
|
+
redis:
|
38
|
+
image: redis:4.0.6-alpine
|
39
|
+
rethinkdb:
|
40
|
+
image: rethinkdb:2.3.6
|
data/gemfiles/rails_3.2.gemfile
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "sqlite3", :
|
6
|
-
gem "
|
7
|
-
gem "
|
8
|
-
gem "mongoid", "~>3.1"
|
5
|
+
gem "sqlite3", platforms: :ruby
|
6
|
+
gem "rails", "~> 3.2.22"
|
7
|
+
gem "mongoid", "~> 3.1"
|
9
8
|
gem "sequel"
|
10
|
-
gem "bson_ext", :
|
9
|
+
gem "bson_ext", platforms: :ruby
|
11
10
|
gem "test-unit", "~> 3.0"
|
11
|
+
gem "activerecord-jdbcsqlite3-adapter", "1.3.24", platforms: :jruby
|
12
12
|
|
13
|
-
gemspec :
|
13
|
+
gemspec path: "../"
|
data/gemfiles/rails_4.0.gemfile
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "sqlite3", :
|
6
|
-
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
|
5
|
+
gem "sqlite3", platforms: :ruby
|
7
6
|
gem "rails", "4.0.13"
|
8
|
-
gem "mime-types", "~> 2", :
|
9
|
-
gem "mongoid", "~>4.0"
|
7
|
+
gem "mime-types", "~> 2", platforms: [:ruby_19, :jruby]
|
8
|
+
gem "mongoid", "~> 4.0"
|
10
9
|
gem "sequel"
|
11
|
-
gem "dynamoid", "~> 1", :
|
12
|
-
gem "aws-sdk", "~>2", :
|
10
|
+
gem "dynamoid", "~> 1", platforms: :ruby
|
11
|
+
gem "aws-sdk", "~> 2", platforms: :ruby
|
13
12
|
gem "redis-objects"
|
13
|
+
gem "activerecord-jdbcsqlite3-adapter", "1.3.24", platforms: :jruby
|
14
14
|
|
15
|
-
gemspec :
|
15
|
+
gemspec path: "../"
|