diff options
Diffstat (limited to 'vendor/gems/recaptcha-0.3.1/test/recaptcha_test.rb')
-rw-r--r-- | vendor/gems/recaptcha-0.3.1/test/recaptcha_test.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/gems/recaptcha-0.3.1/test/recaptcha_test.rb b/vendor/gems/recaptcha-0.3.1/test/recaptcha_test.rb new file mode 100644 index 000000000..82845a9cc --- /dev/null +++ b/vendor/gems/recaptcha-0.3.1/test/recaptcha_test.rb @@ -0,0 +1,39 @@ +require 'test/unit' +require 'cgi' +require File.dirname(File.expand_path(__FILE__)) + '/../lib/recaptcha' + +class RecaptchaClientHelperTest < Test::Unit::TestCase + include Recaptcha + include Recaptcha::ClientHelper + include Recaptcha::Verify + + attr_accessor :session + + def setup + @session = {} + Recaptcha.configure do |config| + config.public_key = '0000000000000000000000000000000000000000' + config.private_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' + end + end + + def test_recaptcha_tags + # Might as well match something... + assert_match /http:\/\/www.google.com\/recaptcha\/api\/challenge/, recaptcha_tags + end + + def test_recaptcha_tags_with_ssl + assert_match /https:\/\/www.google.com\/recaptcha\/api\/challenge/, recaptcha_tags(:ssl => true) + end + + def test_recaptcha_tags_without_noscript + assert_no_match /noscript/, recaptcha_tags(:noscript => false) + end + + def test_should_raise_exception_without_public_key + assert_raise RecaptchaError do + Recaptcha.configuration.public_key = nil + recaptcha_tags + end + end +end |