yeti 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yeti/editor.rb +6 -0
- data/lib/yeti/version.rb +1 -1
- data/spec/yeti/editor_spec.rb +19 -0
- metadata +2 -8
data/lib/yeti/editor.rb
CHANGED
data/lib/yeti/version.rb
CHANGED
data/spec/yeti/editor_spec.rb
CHANGED
@@ -221,4 +221,23 @@ describe Yeti::Editor do
|
|
221
221
|
lambda{ subject.invalid }.should raise_error NoMethodError
|
222
222
|
end
|
223
223
|
end
|
224
|
+
describe "#mandatory?" do
|
225
|
+
let :editor_class do
|
226
|
+
Class.new Yeti::Editor do
|
227
|
+
validates_presence_of :name
|
228
|
+
attribute :name
|
229
|
+
attribute :password
|
230
|
+
end
|
231
|
+
end
|
232
|
+
subject{ editor_class.new context }
|
233
|
+
it "is true for an attribute with validates_presence_of" do
|
234
|
+
subject.mandatory?(:name).should be true
|
235
|
+
end
|
236
|
+
it "is false for an attribute without validates_presence_of" do
|
237
|
+
subject.mandatory?(:password).should be false
|
238
|
+
end
|
239
|
+
it "is false for an invalid attribute" do
|
240
|
+
subject.mandatory?(:invalid).should be false
|
241
|
+
end
|
242
|
+
end
|
224
243
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yeti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.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-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -112,18 +112,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
112
|
- - ! '>='
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
hash: -532776958543363223
|
118
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
116
|
none: false
|
120
117
|
requirements:
|
121
118
|
- - ! '>='
|
122
119
|
- !ruby/object:Gem::Version
|
123
120
|
version: '0'
|
124
|
-
segments:
|
125
|
-
- 0
|
126
|
-
hash: -532776958543363223
|
127
121
|
requirements: []
|
128
122
|
rubyforge_project:
|
129
123
|
rubygems_version: 1.8.24
|