aasm 4.0.7 → 4.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b5ff962a4061c7b5c90ef8615cc68a91201001c
4
- data.tar.gz: 5f05fb22ab55b5e2101ed50ecd270182ffa16d7d
3
+ metadata.gz: 9602429239af9631275cb2f9c1b3c175177aea51
4
+ data.tar.gz: 1dc343974f7348d43882b5f15908440012dcd6e5
5
5
  SHA512:
6
- metadata.gz: 9cd75c3602fc6d7f0a432f8a776434f8db864998533f59227de2a617bc1f346bbaa7ef28884b3ecf242e215506d9c1f77f3fbd88c223f8b0631c2d2ea439dfc4
7
- data.tar.gz: 61d2d2b38f233d7241b21a122e748cc6ded58f15475bca1a557febb4523cb288d050f0f5208d1bc3820411dbe6b7959105dfe123c5e441beb49d2379003e452d
6
+ metadata.gz: c0c7e3300ea262db0385d2f4f403a227968ecc42cd99c0cc13eba81b2f356881b9a42b24a33191b286e1573233ca5ff8a9abdacffd51874d763494e66caabb08
7
+ data.tar.gz: f3ec766f78f6dd8bd9a781220764e35e28dbe0cd8217763a960675202e4001e3a647bb22db7be930a2079d0d832933bc4fc68da5aaa722a130369a2e12579942
@@ -8,6 +8,7 @@ rvm:
8
8
  - 1.9.3
9
9
  - 2.0.0
10
10
  - 2.1
11
+ - 2.2
11
12
  # - jruby-18mode # JRuby in 1.8 mode
12
13
  - jruby-19mode # JRuby in 1.9 mode
13
14
  - rbx-2.2.1
@@ -18,6 +19,7 @@ gemfile:
18
19
  - gemfiles/rails_3.2.gemfile
19
20
  - gemfiles/rails_4.0.gemfile
20
21
  - gemfiles/rails_4.1.gemfile
22
+ - gemfiles/rails_4.2.gemfile
21
23
 
22
24
  matrix:
23
25
  allow_failures:
@@ -5,6 +5,10 @@
5
5
  * `aasm_column` has been removed. Use `aasm.attribute_name` instead
6
6
  * `aasm_human_event_name` has been removed. Use `aasm.human_event_name` instead
7
7
 
8
+ ## 4.0.8
9
+
10
+ * bugfix: may_<event>? should return true or false only (see [issue #200](https://github.com/aasm/aasm/issues/200) for details)
11
+
8
12
  ## 4.0.7
9
13
 
10
14
  * bugfix: take private methods into account when checking for callbacks (see [issue #197](https://github.com/aasm/aasm/issues/197) for details)
@@ -9,10 +9,13 @@ Gem::Specification.new do |s|
9
9
  s.email = %q{scott@elitists.net, ttilley@gmail.com, aasm@mt7.de}
10
10
  s.homepage = %q{https://github.com/aasm/aasm}
11
11
  s.summary = %q{State machine mixin for Ruby objects}
12
- s.description = %q{AASM is a continuation of the acts as state machine rails plugin, built for plain Ruby objects.}
12
+ s.description = %q{AASM is a continuation of the acts-as-state-machine rails plugin, built for plain Ruby objects.}
13
13
  s.date = Time.now
14
14
  s.licenses = ["MIT"]
15
15
 
16
+ s.platform = Gem::Platform::RUBY
17
+ s.required_ruby_version = '>= 1.9.3'
18
+
16
19
  s.add_development_dependency 'rake'
17
20
  s.add_development_dependency 'sdoc'
18
21
  s.add_development_dependency 'rspec'
@@ -25,8 +28,6 @@ Gem::Specification.new do |s|
25
28
  # s.add_development_dependency 'mime-types', '~> 1.25' # needed by coveralls (>= 2.0 needs Ruby >=1.9.2)
26
29
  # s.add_development_dependency 'coveralls'
27
30
 
28
- s.platform = Gem::Platform::RUBY
29
- # s.required_ruby_version = '>= 1.9.3'
30
31
  s.files = `git ls-files`.split("\n")
31
32
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
32
33
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -0,0 +1,16 @@
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
+
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
+
14
+ gem 'sequel'
15
+
16
+ gemspec :path => "../"
@@ -56,12 +56,12 @@ module AASM
56
56
  def state(name, options={})
57
57
  @state_machine.add_state(name, @klass, options)
58
58
 
59
- @klass.send(:define_method, "#{name.to_s}?") do
59
+ @klass.send(:define_method, "#{name}?") do
60
60
  aasm.current_state == name
61
61
  end
62
62
 
63
- unless @klass.const_defined?("STATE_#{name.to_s.upcase}")
64
- @klass.const_set("STATE_#{name.to_s.upcase}", name)
63
+ unless @klass.const_defined?("STATE_#{name.upcase}")
64
+ @klass.const_set("STATE_#{name.upcase}", name)
65
65
  end
66
66
  end
67
67
 
@@ -72,16 +72,16 @@ module AASM
72
72
  # an addition over standard aasm so that, before firing an event, you can ask
73
73
  # may_event? and get back a boolean that tells you whether the guard method
74
74
  # on the transition will let this happen.
75
- @klass.send(:define_method, "may_#{name.to_s}?") do |*args|
75
+ @klass.send(:define_method, "may_#{name}?") do |*args|
76
76
  aasm.may_fire_event?(name, *args)
77
77
  end
78
78
 
79
- @klass.send(:define_method, "#{name.to_s}!") do |*args, &block|
80
- aasm.current_event = "#{name.to_s}!".to_sym
79
+ @klass.send(:define_method, "#{name}!") do |*args, &block|
80
+ aasm.current_event = "#{name}!".to_sym
81
81
  aasm_fire_event(name, {:persist => true}, *args, &block)
82
82
  end
83
83
 
84
- @klass.send(:define_method, "#{name.to_s}") do |*args, &block|
84
+ @klass.send(:define_method, "#{name}") do |*args, &block|
85
85
  aasm.current_event = name.to_sym
86
86
  aasm_fire_event(name, {:persist => false}, *args, &block)
87
87
  end
@@ -76,7 +76,7 @@ module AASM
76
76
 
77
77
  def may_fire_event?(name, *args)
78
78
  if event = @instance.class.aasm.state_machine.events[name]
79
- event.may_fire?(@instance, *args)
79
+ !!event.may_fire?(@instance, *args)
80
80
  else
81
81
  false # unknown event
82
82
  end
@@ -142,9 +142,9 @@ module AASM
142
142
 
143
143
  def aasm_raw_attribute_value(state)
144
144
  if aasm_enum
145
- value = self.class.send(aasm_enum)[state]
145
+ self.class.send(aasm_enum)[state]
146
146
  else
147
- value = state.to_s
147
+ state.to_s
148
148
  end
149
149
  end
150
150
 
@@ -1,3 +1,3 @@
1
1
  module AASM
2
- VERSION = "4.0.7"
2
+ VERSION = "4.0.8"
3
3
  end
@@ -19,24 +19,24 @@ describe 'when being unsuspended' do
19
19
  it 'should be able to be unsuspended' do
20
20
  auth.activate!
21
21
  auth.suspend!
22
- expect(auth.may_unsuspend?).to be_truthy
22
+ expect(auth.may_unsuspend?).to be true
23
23
  end
24
24
 
25
25
  it 'should not be able to be unsuspended into active' do
26
26
  auth.suspend!
27
- expect(auth.may_unsuspend?(:active)).not_to be_truthy
27
+ expect(auth.may_unsuspend?(:active)).not_to be true
28
28
  end
29
29
 
30
30
  it 'should be able to be unsuspended into active if polite' do
31
31
  auth.suspend!
32
- expect(auth.may_wait?(:waiting, :please)).to be_truthy
32
+ expect(auth.may_wait?(:waiting, :please)).to be true
33
33
  auth.wait!(nil, :please)
34
34
  end
35
35
 
36
36
  it 'should not be able to be unsuspended into active if not polite' do
37
37
  auth.suspend!
38
- expect(auth.may_wait?(:waiting)).not_to be_truthy
39
- expect(auth.may_wait?(:waiting, :rude)).not_to be_truthy
38
+ expect(auth.may_wait?(:waiting)).not_to be true
39
+ expect(auth.may_wait?(:waiting, :rude)).not_to be true
40
40
  expect {auth.wait!(nil, :rude)}.to raise_error(AASM::InvalidTransition)
41
41
  expect {auth.wait!}.to raise_error(AASM::InvalidTransition)
42
42
  end
@@ -46,7 +46,7 @@ describe 'when being unsuspended' do
46
46
  auth.suspend!
47
47
  auth.unsuspend!
48
48
 
49
- expect(auth.may_unpassify?).not_to be_truthy
49
+ expect(auth.may_unpassify?).not_to be true
50
50
  expect {auth.unpassify!}.to raise_error(AASM::InvalidTransition)
51
51
  end
52
52
 
@@ -74,11 +74,11 @@ describe 'when being unsuspended' do
74
74
  end
75
75
 
76
76
  it "should be able to fire known events" do
77
- expect(auth.aasm.may_fire_event?(:activate)).to be_truthy
77
+ expect(auth.aasm.may_fire_event?(:activate)).to be true
78
78
  end
79
79
 
80
80
  it "should not be able to fire unknown events" do
81
- expect(auth.aasm.may_fire_event?(:unknown)).to be_falsey
81
+ expect(auth.aasm.may_fire_event?(:unknown)).to be false
82
82
  end
83
83
 
84
84
  end
@@ -257,6 +257,7 @@ describe "instance methods" do
257
257
 
258
258
  end
259
259
 
260
+ if ActiveRecord::VERSION::MAJOR < 4 && ActiveRecord::VERSION::MINOR < 2 # won't work with Rails >= 4.2
260
261
  describe "direct state column access" do
261
262
  it "accepts false states" do
262
263
  f = FalseState.create!
@@ -266,6 +267,7 @@ describe "direct state column access" do
266
267
  }.to_not raise_error
267
268
  end
268
269
  end
270
+ end
269
271
 
270
272
  describe 'subclasses' do
271
273
  it "should have the same states as its parent class" do
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.7
4
+ version: 4.0.8
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-20 00:00:00.000000000 Z
13
+ date: 2014-12-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -68,7 +68,7 @@ dependencies:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
- description: AASM is a continuation of the acts as state machine rails plugin, built
71
+ description: AASM is a continuation of the acts-as-state-machine rails plugin, built
72
72
  for plain Ruby objects.
73
73
  email: scott@elitists.net, ttilley@gmail.com, aasm@mt7.de
74
74
  executables: []
@@ -92,6 +92,7 @@ files:
92
92
  - gemfiles/rails_3.2.gemfile
93
93
  - gemfiles/rails_4.0.gemfile
94
94
  - gemfiles/rails_4.1.gemfile
95
+ - gemfiles/rails_4.2.gemfile
95
96
  - lib/aasm.rb
96
97
  - lib/aasm/aasm.rb
97
98
  - lib/aasm/base.rb
@@ -177,7 +178,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
178
  requirements:
178
179
  - - ">="
179
180
  - !ruby/object:Gem::Version
180
- version: '0'
181
+ version: 1.9.3
181
182
  required_rubygems_version: !ruby/object:Gem::Requirement
182
183
  requirements:
183
184
  - - ">="