validates_captcha 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +6 -0
- data/Rakefile +9 -9
- data/lib/validates_captcha.rb +12 -12
- data/lib/validates_captcha/controller_validation.rb +11 -10
- data/lib/validates_captcha/form_builder.rb +2 -2
- data/lib/validates_captcha/form_helper.rb +11 -11
- data/lib/validates_captcha/image_generator/simple.rb +24 -23
- data/lib/validates_captcha/model_validation.rb +29 -13
- data/lib/validates_captcha/provider/dynamic_image.rb +50 -50
- data/lib/validates_captcha/provider/question.rb +28 -27
- data/lib/validates_captcha/provider/static_image.rb +62 -62
- data/lib/validates_captcha/string_generator/simple.rb +18 -17
- data/lib/validates_captcha/symmetric_encryptor/simple.rb +11 -10
- data/lib/validates_captcha/test_case.rb +1 -0
- data/lib/validates_captcha/version.rb +3 -2
- data/rails/init.rb +4 -4
- data/tasks/static_image_tasks.rake +7 -9
- data/test/cases/controller_validation_test.rb +42 -41
- data/test/cases/image_generator/simple_test.rb +8 -8
- data/test/cases/model_validation_test.rb +79 -64
- data/test/cases/provider/dynamic_image_test.rb +29 -28
- data/test/cases/provider/question_test.rb +11 -10
- data/test/cases/provider/static_image_test.rb +40 -39
- data/test/cases/string_generator/simple_test.rb +29 -29
- data/test/cases/symmetric_encryptor/simple_test.rb +6 -6
- data/test/cases/validates_captcha_test.rb +7 -6
- data/test/test_helper.rb +4 -0
- metadata +3 -3
@@ -1,24 +1,24 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
|
2
|
+
|
3
3
|
SE = ValidatesCaptcha::SymmetricEncryptor::Simple
|
4
|
-
|
4
|
+
|
5
5
|
class SymmetricEncryptorTest < ValidatesCaptcha::TestCase
|
6
6
|
test "defines an instance level #encrypt method" do
|
7
7
|
assert_respond_to SE.new, :encrypt
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
test "instance level #encrypt method returns a string" do
|
11
11
|
assert_kind_of String, SE.new.encrypt('abc')
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
test "defines an instance level #decrypt method" do
|
15
15
|
assert_respond_to SE.new, :decrypt
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
test "instance level #decrypt method returns nil if decryption failes" do
|
19
19
|
assert_nil SE.new.decrypt('invalid')
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
test "decryption of encryption of string should equal the string" do
|
23
23
|
%w(d3crypti0n 3ncrypt3d 5trin9 sh0u1d equ41 th3 c4ptch4).each do |captcha|
|
24
24
|
assert_equal captcha, SE.new.decrypt(SE.new.encrypt(captcha))
|
@@ -4,25 +4,26 @@ class ValidatesCaptchaTest < ValidatesCaptcha::TestCase
|
|
4
4
|
test "defines a class level #version method" do
|
5
5
|
assert_respond_to ValidatesCaptcha, :version
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
test "class level #version method returns a valid version" do
|
9
9
|
assert_match /^\d+\.\d+\.\w+$/, ValidatesCaptcha.version
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
test "defines a class level #provider method" do
|
13
13
|
assert_respond_to ValidatesCaptcha, :provider
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
test "defines a class level #provider= method" do
|
17
17
|
assert_respond_to ValidatesCaptcha, :provider=
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
test "#provider method's return value should equal the value set using the #provider= method" do
|
21
21
|
old_provider = ValidatesCaptcha.provider
|
22
|
-
|
22
|
+
|
23
23
|
ValidatesCaptcha.provider = 'abc'
|
24
24
|
assert_equal 'abc', ValidatesCaptcha.provider
|
25
|
-
|
25
|
+
|
26
26
|
ValidatesCaptcha.provider = old_provider
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
data/test/test_helper.rb
CHANGED
@@ -13,14 +13,18 @@ end
|
|
13
13
|
|
14
14
|
require 'active_record'
|
15
15
|
|
16
|
+
ActiveRecord::Base.logger = Logger.new(nil)
|
16
17
|
ActiveRecord::Schema.verbose = false
|
17
18
|
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
|
18
19
|
ActiveRecord::Schema.define :version => 1 do
|
19
20
|
create_table :widgets do |t|
|
21
|
+
t.string :name
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
25
|
class Widget < ActiveRecord::Base
|
24
26
|
include ValidatesCaptcha::ModelValidation
|
27
|
+
|
28
|
+
attr_accessible :name
|
25
29
|
end
|
26
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validates_captcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Andert
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-30 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -79,7 +79,7 @@ licenses: []
|
|
79
79
|
post_install_message:
|
80
80
|
rdoc_options:
|
81
81
|
- --title
|
82
|
-
- Validates Captcha 0.9.
|
82
|
+
- Validates Captcha 0.9.6
|
83
83
|
- --main
|
84
84
|
- README.rdoc
|
85
85
|
- --line-numbers
|