redtape 0.0.6 → 0.0.7
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.
- data/lib/redtape.rb +3 -3
- data/lib/redtape/version.rb +1 -1
- data/spec/form_spec.rb +8 -0
- metadata +4 -4
data/lib/redtape.rb
CHANGED
@@ -24,14 +24,15 @@ module Redtape
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def models_correct
|
27
|
+
populate
|
27
28
|
@@model_accessors.each do |accessor|
|
28
29
|
begin
|
29
30
|
model = send(accessor)
|
30
31
|
if model.invalid?
|
31
32
|
own_your_errors_in(model)
|
32
33
|
end
|
33
|
-
rescue
|
34
|
-
fail
|
34
|
+
rescue NoMethodError => e
|
35
|
+
fail NoMethodError, "#{self.class} is missing 'validates_and_saves :#{accessor}': #{e}"
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
@@ -42,7 +43,6 @@ module Redtape
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def save
|
45
|
-
populate
|
46
46
|
if valid?
|
47
47
|
persist!
|
48
48
|
else
|
data/lib/redtape/version.rb
CHANGED
data/spec/form_spec.rb
CHANGED
@@ -82,6 +82,14 @@ describe Redtape::Form do
|
|
82
82
|
specify { subject.test_user.should be_valid }
|
83
83
|
specify { subject.test_user.should be_persisted }
|
84
84
|
end
|
85
|
+
|
86
|
+
context "after validating the form" do
|
87
|
+
before do
|
88
|
+
subject.valid?
|
89
|
+
end
|
90
|
+
|
91
|
+
specify { subject.test_user.should be_valid }
|
92
|
+
end
|
85
93
|
end
|
86
94
|
|
87
95
|
context "with invalid data" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redtape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: virtus
|
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
segments:
|
117
117
|
- 0
|
118
|
-
hash: -
|
118
|
+
hash: -1213236872779261968
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
none: false
|
121
121
|
requirements:
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
segments:
|
126
126
|
- 0
|
127
|
-
hash: -
|
127
|
+
hash: -1213236872779261968
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
130
|
rubygems_version: 1.8.24
|