sidestate 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,7 +44,7 @@ module Sidestate::Hook
44
44
  return unless send("#{aasm_column}_changed?")
45
45
 
46
46
  old_state, new_state = send("#{aasm_column}_change")
47
- aasm_state_collection.create :name => new_state.to_s, self.class.name.underscore.to_sym => self
47
+ aasm_state_collection.create! :name => new_state.to_s, self.class.name.underscore.to_sym => self
48
48
  end
49
49
 
50
50
  def aasm_state_collection
@@ -19,6 +19,16 @@ describe Sidestate::Hook do
19
19
  article.publish!
20
20
  article.article_state.name.should == 'published'
21
21
  end
22
+
23
+ it "should raise a validation exception if the state object doesn't save" do
24
+ article_state = ArticleState.new
25
+ ArticleState.stub!(:new => article_state)
26
+ article_state.stub!(:valid? => false)
27
+
28
+ lambda {
29
+ Article.create
30
+ }.should raise_error(ActiveRecord::RecordInvalid)
31
+ end
22
32
  end
23
33
 
24
34
  describe '#article_states' do
data/spec/spec_helper.rb CHANGED
@@ -13,6 +13,8 @@ require 'spec/autorun'
13
13
  require 'timecop'
14
14
 
15
15
  Spec::Runner.configure do |config|
16
+ FileUtils.mkdir_p("tmp")
17
+
16
18
  Dir['spec/support/*.rb'].sort.each do |file|
17
19
  require file.gsub(/\.rb/, '')
18
20
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidestate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 2
9
+ version: 0.2.2
5
10
  platform: ruby
6
11
  authors:
7
12
  - Pat Allan
@@ -9,49 +14,63 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-03-16 00:00:00 +11:00
17
+ date: 2010-03-30 00:00:00 +11:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: aasm
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 1
30
+ - 5
23
31
  version: 2.1.5
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: rspec
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 2
44
+ - 9
33
45
  version: 1.2.9
34
- version:
46
+ type: :development
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: yard
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ">="
42
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
43
57
  version: "0"
44
- version:
58
+ type: :development
59
+ version_requirements: *id003
45
60
  - !ruby/object:Gem::Dependency
46
61
  name: timecop
47
- type: :development
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
62
+ prerelease: false
63
+ requirement: &id004 !ruby/object:Gem::Requirement
50
64
  requirements:
51
65
  - - ">="
52
66
  - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ - 3
70
+ - 4
53
71
  version: 0.3.4
54
- version:
72
+ type: :development
73
+ version_requirements: *id004
55
74
  description: Track state history using AASM
56
75
  email: pat@freelancing-gods.com
57
76
  executables: []
@@ -79,18 +98,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
98
  requirements:
80
99
  - - ">="
81
100
  - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
82
103
  version: "0"
83
- version:
84
104
  required_rubygems_version: !ruby/object:Gem::Requirement
85
105
  requirements:
86
106
  - - ">="
87
107
  - !ruby/object:Gem::Version
108
+ segments:
109
+ - 0
88
110
  version: "0"
89
- version:
90
111
  requirements: []
91
112
 
92
113
  rubyforge_project:
93
- rubygems_version: 1.3.5
114
+ rubygems_version: 1.3.6
94
115
  signing_key:
95
116
  specification_version: 3
96
117
  summary: AASM Extention for storing state in a separate model