Format code

This commit is contained in:
Jason Lee 2016-05-23 15:11:04 +08:00
parent 2e2a8f6f8a
commit 19dc27e71b
3 changed files with 6 additions and 8 deletions

View File

@ -11,7 +11,7 @@ describe RuCaptcha::Captcha do
end end
it 'should not include [0ol1]' do it 'should not include [0ol1]' do
10000.times do 10_000.times do
expect(RuCaptcha::Captcha.random_chars_without_cache).not_to match(/[0ol1]/i) expect(RuCaptcha::Captcha.random_chars_without_cache).not_to match(/[0ol1]/i)
end end
end end

View File

@ -48,7 +48,7 @@ describe RuCaptcha do
end end
describe 'Incorrect chars' do describe 'Incorrect chars' do
it "should work" do it 'should work' do
simple.session[:_rucaptcha_at] = Time.now.to_i - 60 simple.session[:_rucaptcha_at] = Time.now.to_i - 60
simple.session[:_rucaptcha] = 'abcd' simple.session[:_rucaptcha] = 'abcd'
simple.params[:_rucaptcha] = 'd123' simple.params[:_rucaptcha] = 'd123'
@ -57,7 +57,7 @@ describe RuCaptcha do
end end
describe 'Expires Session key' do describe 'Expires Session key' do
it "should work" do it 'should work' do
simple.session[:_rucaptcha_at] = Time.now.to_i - 121 simple.session[:_rucaptcha_at] = Time.now.to_i - 121
simple.session[:_rucaptcha] = 'abcd' simple.session[:_rucaptcha] = 'abcd'
simple.params[:_rucaptcha] = 'abcd' simple.params[:_rucaptcha] = 'abcd'

View File

@ -6,9 +6,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rucaptcha' require 'rucaptcha'
tmp_path = File.join(File.dirname(__FILE__), '../tmp') tmp_path = File.join(File.dirname(__FILE__), '../tmp')
if !File.exists?(tmp_path) Dir.mkdir(tmp_path) unless File.exist?(tmp_path)
Dir.mkdir(tmp_path)
end
module Rails module Rails
class << self class << self
@ -19,7 +17,7 @@ module Rails
end end
RuCaptcha.configure do RuCaptcha.configure do
self.len = 2 self.len = 2
self.font_size = 48 self.font_size = 48
self.implode = 0.111 self.implode = 0.111
end end