aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2010-10-01 14:31:42 +0100
committerLouise Crow <louise.crow@gmail.com>2010-10-01 14:31:42 +0100
commitfbc2ff6c89033b0cde44464fb765753c238111ab (patch)
treebf30200bd664e92afd4c47205ef556f0316ebc23 /spec/lib
parente0fea53b103ae80ad93ba4bf7eeceb83739b0848 (diff)
Moved tests for commonlib/rblib functions to commonlib/rblib/tests. Added that as a dependency for rake spec.
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/format_spec.rb53
-rw-r--r--spec/lib/mysociety_validate_spec.rb47
2 files changed, 0 insertions, 100 deletions
diff --git a/spec/lib/format_spec.rb b/spec/lib/format_spec.rb
deleted file mode 100644
index c4d43a8f0..000000000
--- a/spec/lib/format_spec.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-
-describe "when making clickable" do
-
- it "should make URLs into links" do
- text = "Hello http://www.flourish.org goodbye"
- text = CGI.escapeHTML(text)
- formatted = MySociety::Format.make_clickable(text)
- formatted.should == "Hello <a href='http://www.flourish.org'>http://www.flourish.org</a> goodbye"
- end
-
- it "should make wrapped URLs in angle brackets clickable" do
- text = """<http://www.flou
-rish.org/bl
-og>
-
-More stuff and then another angle bracket >"""
- text = CGI.escapeHTML(text)
-
- formatted = MySociety::Format.make_clickable(text)
-
- formatted.should == "&lt;<a href='http://www.flourish.org/blog'>http://www.flourish.org/blog</a>&gt;\n\nMore stuff and then another angle bracket &gt;"
- end
-
- it "should make wrapped URLs in angle brackets clickable" do
- text = """<https://web.nhs.net/owa/redir.aspx?C=25a8af7e66054d62a435313f7f3d4694&URL=h
-ttp%3a%2f%2fwww.ico.gov.uk%2fupload%2fdocuments%2flibrary%2ffreedom_of_infor
-mation%2fdetailed_specialist_guides%2fname_of_applicant_fop083_v1.pdf> Valid
-request - name and address for correspondence
-
-If we can be of any further assistance please contact our Helpline on 08456
-30 60 60 or 01625 545745 if you would prefer to call a national rate number,
-quoting your case reference number. You may also find some useful
-information on our website at
-<https://web.nhs.net/owa/redir.aspx?C=25a8af7e66054d62a435313f7f3d4694&URL=h
-ttp%3a%2f%2fwww.ico.gov.uk%2f> www.ico.gov.uk."""
- text = CGI.escapeHTML(text)
- formatted = MySociety::Format.make_clickable(text)
-
- expected_formatted = """&lt;<a href='https://web.nhs.net/owa/redir.aspx?C=25a8af7e66054d62a435313f7f3d4694&amp;URL=http%3a%2f%2fwww.ico.gov.uk%2fupload%2fdocuments%2flibrary%2ffreedom_of_information%2fdetailed_specialist_guides%2fname_of_applicant_fop083_v1.pdf'>https://web.nhs.net/owa/redir.aspx?C=25a8af7e66054d62a435313f7f3d4694&amp;URL=http%3a%2f%2fwww.ico.gov.uk%2fupload%2fdocuments%2flibrary%2ffreedom_of_information%2fdetailed_specialist_guides%2fname_of_applicant_fop083_v1.pdf</a>&gt; Valid
-request - name and address for correspondence
-
-If we can be of any further assistance please contact our Helpline on 08456
-30 60 60 or 01625 545745 if you would prefer to call a national rate number,
-quoting your case reference number. You may also find some useful
-information on our website at
-&lt;<a href='https://web.nhs.net/owa/redir.aspx?C=25a8af7e66054d62a435313f7f3d4694&amp;URL=http%3a%2f%2fwww.ico.gov.uk%2f'>https://web.nhs.net/owa/redir.aspx?C=25a8af7e66054d62a435313f7f3d4694&amp;URL=http%3a%2f%2fwww.ico.gov.uk%2f</a>&gt; <a href='http://www.ico.gov.uk'>www.ico.gov.uk</a>."""
-
- formatted.should == expected_formatted
- end
-
-
-end
diff --git a/spec/lib/mysociety_validate_spec.rb b/spec/lib/mysociety_validate_spec.rb
deleted file mode 100644
index ba20694bb..000000000
--- a/spec/lib/mysociety_validate_spec.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# This is tests for the code in commonlib/rblib/validate.rb
-# XXX move the tests into commonlib
-
-require File.expand_path(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
-
- it "should allow lots of URLs, when the rest of casing is fine" do
- MySociety::Validate.uses_mixed_capitals("
-The public authority appears to have aggregated this request with the following requests on this site:
-
-http://www.whatdotheyknow.com/request/financial_value_of_post_dismissa_2
-
-http://www.whatdotheyknow.com/request/number_of_post_dismissal_compens_2
-
-http://www.whatdotheyknow.com/request/number_of_post_dismissal_compens_3
-
-...and has given one response to all four of these requests, available here:
-
-http://www.whatdotheyknow.com/request/financial_value_of_post_dismissa_2#incoming-105717
-
-The information requested in this request was not provided, however the information requested in the following request was provided:
-
-http://www.whatdotheyknow.com/request/number_of_post_dismissal_compens_3
- ").should == true
- end
-
-
-end
-