public
Description: BrainBuster - a logic captcha for Rails
Homepage: http://opensource.thinkrelevance.com/wiki/BrainBuster
Clone URL: git://github.com/rsanheim/brain_buster.git
Search Repo:
ignore case sensitivity in string answers
rsanheim (author)
Wed Jul 23 20:14:24 -0700 2008
commit  6942245feb35c84f6d7daefa6e6a9980916b8026
tree    a3ad17af26a81180aec80313dadbe1ebe0e2ea5b
parent  bb4298554a9f37e2171b9e0ce85210f0e065f613
...
12
13
14
 
15
16
17
...
12
13
14
15
16
17
18
0
@@ -12,6 +12,7 @@ TODOs (someday/maybe)
0
 HEAD
0
 * convert to new style describe/it in specs
0
 * fix tests for Rails 2.1 and the view path changes
0
+* ignore case sensitivity in string answers
0
 
0
 0.8.1 2008/02/22
0
 * use append_view_paths instead of directly appending to it, for edge rails compatibility [Hashrocket]
...
11
12
13
14
 
15
16
17
...
11
12
13
 
14
15
16
17
0
@@ -11,7 +11,7 @@ class BrainBuster < ActiveRecord::Base
0
     if answer_is_integer?
0
       return string == answer || string == HumaneInteger.new(answer.to_i).to_english
0
     else
0
- return string == answer
0
+ return string == answer.downcase
0
     end
0
   end
0
 
...
26
27
28
 
 
 
 
 
29
30
31
...
26
27
28
29
30
31
32
33
34
35
36
0
@@ -26,6 +26,11 @@ describe "BrainBuster model object" do
0
       day_before_tuesday.attempt?(answer).should.blaming(answer).be(true)
0
     end
0
   end
0
+
0
+ it "should ignore case in the answer" do
0
+ stub_brain_buster(:question => "Spell god backwards", :answer => "Dog").attempt?("dog").should == true
0
+ stub_brain_buster(:question => "Spell god backwards", :answer => "Dog").attempt?("DOG").should == true
0
+ end
0
 
0
   # fixtures
0
   def ten_minus_ten

Comments

    No one has commented yet.