rucaptcha 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c8619ffa153f60752223f1f764b7145849b1b4b
4
- data.tar.gz: f7d6b3358ba52b86886550e41902cee4220bec28
3
+ metadata.gz: 8fe1a21f8a2142b7b430c62264738016bf803c48
4
+ data.tar.gz: de11fac7290c95d9e5b6a137bd88f9a9225ac8bd
5
5
  SHA512:
6
- metadata.gz: aa2eebcabe01dca90464094dbd7bc367d09c7ab230c2f80a60acada970df844821affeb074ddfba828240576c7b9aa22ed6aed504a4144ce066ef2103580f301
7
- data.tar.gz: 1f8a4758678ff5b44a94572db65ab6eb7040f451254b58dddeeddc8aa8e4b380805cbd27b994f8fa78f8fad0fb68ba74bb60b8b30ea65869d93bf0a808697915
6
+ metadata.gz: 2177bdc67c19738d3a953c73cc0891680500ed7492b7fa59d4f0f873d7d82f2df47175afd90310c9245b8230376fc6143985c6e488bfbee8388d4d48168a9ff6
7
+ data.tar.gz: 0d69113ab3343156f6a74a860239f3cc9da6434aa3e3289b3f40804ab3cccb0f156c3c8bdaade59a10ad1cfe0be365d8fc30d8e332314f040e00e00ec0c7c5c0
@@ -1,4 +1,10 @@
1
+ 0.5.1
2
+ -----
3
+
4
+ - Make sure it will render image when ImageMagick stderr have warning messages. (#26)
5
+
1
6
  0.5.0
7
+ -----
2
8
 
3
9
  - Fix cache with Rails 5.
4
10
 
data/README.md CHANGED
@@ -29,7 +29,7 @@ Idea by: https://ruby-china.org/topics/20558#reply4
29
29
 
30
30
  ## Requirements
31
31
 
32
- - ImageMagick
32
+ - ImageMagick 6.9+
33
33
 
34
34
  #### Ubuntu
35
35
 
@@ -107,8 +107,12 @@ View `app/views/account/new.html.erb`
107
107
  </form>
108
108
  ```
109
109
 
110
+ And if you are use Devise, you can read this to add validation: [RuCaptcha with Devise](https://github.com/huacnlee/rucaptcha/wiki/Working-with-Devise).
111
+
110
112
  ### Write your test skip captcha validation
111
113
 
114
+ for RSpec
115
+
112
116
  ```rb
113
117
  describe 'sign up and login', type: :feature do
114
118
  before do
@@ -119,5 +123,15 @@ describe 'sign up and login', type: :feature do
119
123
  end
120
124
  ```
121
125
 
126
+ for MiniTest
122
127
 
123
-
128
+ ```rb
129
+ class ActionDispatch::IntegrationTest
130
+ def sign_in(user)
131
+ ActionController::Base.any_instance.stubs(:verify_rucaptcha?).returns(true)
132
+ post user_session_path \
133
+ 'user[email]' => user.email,
134
+ 'user[password]' => user.password
135
+ end
136
+ end
137
+ ```
@@ -71,17 +71,21 @@ module RuCaptcha
71
71
  if Gem.win_platform?
72
72
  png_file_path = Rails.root.join('tmp', 'cache', "#{code}.png")
73
73
  command = "convert -size #{size} xc:White -gravity Center -weight 12 -pointsize 20 -annotate 0 \"#{code}\" -trim #{png_file_path}"
74
- require 'open3'
75
- _stdout_str, stderr_str = Open3.capture3(command)
76
- raise "RuCaptcha: #{stderr_str.strip}" if stderr_str.present?
74
+ out, err, _st = Open3.capture3(command)
75
+ warn " RuCaptcha #{err.strip}" if err.present?
77
76
  png_file_path
78
77
  else
79
78
  command.strip!
80
79
  out, err, _st = Open3.capture3(command)
81
- raise "RuCaptcha: #{err.strip}" if err.present?
80
+ warn " RuCaptcha #{err.strip}" if err.present?
82
81
  out
83
82
  end
84
83
  end
84
+
85
+ def warn(msg)
86
+ msg = " RuCaptcha #{msg}"
87
+ Rails.logger.error(msg)
88
+ end
85
89
  end
86
90
  end
87
91
  end
@@ -1,3 +1,3 @@
1
1
  module RuCaptcha
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rucaptcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-25 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2016-06-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
13
27
  description:
14
28
  email: huacnlee@gmail.com
15
29
  executables: []