diff options
author | Francis Irving <francis@mysociety.org> | 2010-08-07 01:10:05 +0100 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-08-07 01:10:05 +0100 |
commit | 52eda4eff8f978a3c89c41e6d3e91a1b25623e89 (patch) | |
tree | 05355d3eab3b4d8201aa5945247f30d62ce4c2ec /spec/lib/mysociety_validate_spec.rb | |
parent | 3fc55edeb0187cf76cda5f8abe8ddbe866b2bc0a (diff) |
Some tests for mixed capitals detection
Diffstat (limited to 'spec/lib/mysociety_validate_spec.rb')
-rw-r--r-- | spec/lib/mysociety_validate_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/mysociety_validate_spec.rb b/spec/lib/mysociety_validate_spec.rb new file mode 100644 index 000000000..4ac912361 --- /dev/null +++ b/spec/lib/mysociety_validate_spec.rb @@ -0,0 +1,26 @@ +# This is tests for the code in commonlib/rblib/validate.rb +# XXX move the tests into commonlib + +require File.dirname(__FILE__) + '/../spec_helper' + +describe "when checking text uses mixed capitals" do + + it "should detect all caps" do + MySociety::Validate.uses_mixed_capitals("I LIKE TO SHOUT, IT IS FUN. I ESPECIALLY LIKE TO DO SO FOR QUITE A LONG TIME, AND WHEN I DISABLED MY CAPS LOCK KEY.").should == false + end + + it "should not allow e e cummings" do + MySociety::Validate.uses_mixed_capitals(" + (i who have died am alive again today, + and this is the sun's birthday;this is the birth + day of life and love and wings:and of the gay + great happening illimitably earth) + ").should == false + end + + it "should allow a few normal sentences" do + MySociety::Validate.uses_mixed_capitals("This is a normal sentence. It is followed by another, and overall it is quite a long chunk of text so it exceeds the minimum limit.").should == true + end + +end + |