Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 427
- Log:
Version 1.0.1 of the Hub application, which adds reCaptcha
verification to the sign-up form. Implemented after spambots
attacked the ROOL site and signed up hundreds of bogus users.
- Author:
- rool
- Date:
- Tue Aug 30 11:48:22 +0100 2011
- Size:
- 1526 Bytes
1 | require 'test/unit' |
2 | require 'cgi' |
3 | require File.dirname(File.expand_path(__FILE__)) + '/../lib/recaptcha' |
4 | |
5 | class RecaptchaClientHelperTest < Test::Unit::TestCase |
6 | include Recaptcha |
7 | include Recaptcha::ClientHelper |
8 | include Recaptcha::Verify |
9 | |
10 | attr_accessor :session |
11 | |
12 | def setup |
13 | @session = {} |
14 | Recaptcha.configure do |config| |
15 | config.public_key = '0000000000000000000000000000000000000000' |
16 | config.private_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' |
17 | end |
18 | end |
19 | |
20 | def test_recaptcha_tags |
21 | # Might as well match something... |
22 | assert_match /http:\/\/www.google.com\/recaptcha\/api\/challenge/, recaptcha_tags |
23 | end |
24 | |
25 | def test_recaptcha_tags_with_ssl |
26 | assert_match /https:\/\/www.google.com\/recaptcha\/api\/challenge/, recaptcha_tags(:ssl => true) |
27 | end |
28 | |
29 | def test_recaptcha_tags_without_noscript |
30 | assert_no_match /noscript/, recaptcha_tags(:noscript => false) |
31 | end |
32 | |
33 | def test_should_raise_exception_without_public_key |
34 | assert_raise RecaptchaError do |
35 | Recaptcha.configuration.public_key = nil |
36 | recaptcha_tags |
37 | end |
38 | end |
39 | |
40 | def test_different_configuration_within_with_configuration_block |
41 | key = Recaptcha.with_configuration(:public_key => '12345') do |
42 | Recaptcha.configuration.public_key |
43 | end |
44 | |
45 | assert_equal('12345', key) |
46 | end |
47 | |
48 | def test_reset_configuration_after_with_configuration_block |
49 | Recaptcha.with_configuration(:public_key => '12345') |
50 | assert_equal('0000000000000000000000000000000000000000', Recaptcha.configuration.public_key) |
51 | end |
52 | end |