ankh 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/ankh.gemspec +1 -1
- data/lib/ankh/validations/human.rb +1 -1
- data/spec/ankh/model_spec.rb +12 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/ankh.gemspec
CHANGED
data/spec/ankh/model_spec.rb
CHANGED
@@ -4,10 +4,13 @@ describe Ankh::Model do
|
|
4
4
|
INVALID_ANSWER = "3241235" #this answer will never be valid due to constraints
|
5
5
|
class Post < ActiveRecord::Base
|
6
6
|
validates_human
|
7
|
+
attr_accessor :name
|
8
|
+
validates_presence_of :name
|
7
9
|
end
|
8
10
|
|
9
11
|
subject do
|
10
12
|
p = Post.new
|
13
|
+
p.name = "John"
|
11
14
|
p.generate_human_question
|
12
15
|
p
|
13
16
|
end
|
@@ -46,4 +49,13 @@ describe Ankh::Model do
|
|
46
49
|
subject.human_answer = question.answer
|
47
50
|
subject.save.should be_true
|
48
51
|
end
|
52
|
+
|
53
|
+
it "should clear the human answer if the model is not valid" do
|
54
|
+
question = Ankh::Question.new
|
55
|
+
Ankh::Question.expects(:generate).returns(question)
|
56
|
+
subject.name = nil
|
57
|
+
subject.human_answer = question.answer
|
58
|
+
subject.save.should be_false
|
59
|
+
subject.human_answer.should be_blank
|
60
|
+
end
|
49
61
|
end
|
metadata
CHANGED