2015-10-30 03:32:02 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-01-22 02:16:57 +00:00
|
|
|
describe RuCaptcha do
|
|
|
|
describe '.generate' do
|
2016-11-08 03:18:07 +00:00
|
|
|
it 'should work' do
|
2017-01-22 02:16:57 +00:00
|
|
|
res = RuCaptcha.generate()
|
|
|
|
expect(res.length).to eq(2)
|
|
|
|
expect(res[0].length).to eq(5)
|
|
|
|
expect(res[1]).not_to eq(nil)
|
2016-11-08 03:18:07 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-01-22 02:16:57 +00:00
|
|
|
describe '.create' do
|
|
|
|
it 'should len equal config.len' do
|
|
|
|
res = RuCaptcha.create(0)
|
|
|
|
expect(res.length).to eq(2)
|
|
|
|
expect(res[0].length).to eq(5)
|
|
|
|
expect(res[1]).not_to eq(nil)
|
2016-11-08 03:18:07 +00:00
|
|
|
end
|
|
|
|
|
2017-01-22 02:16:57 +00:00
|
|
|
it 'should work with color style' do
|
|
|
|
res = RuCaptcha.create(1)
|
|
|
|
expect(res.length).to eq(2)
|
|
|
|
expect(res[0].length).to eq(5)
|
|
|
|
expect(res[1]).not_to eq(nil)
|
2016-11-08 03:18:07 +00:00
|
|
|
end
|
|
|
|
end
|
2015-10-30 03:32:02 +00:00
|
|
|
end
|