This commit is contained in:
Jason Lee 2018-09-06 19:41:16 +08:00
parent 748f17a429
commit 583bb1f3a9
1 changed files with 23 additions and 9 deletions

View File

@ -12,14 +12,14 @@ describe RuCaptcha do
describe '.create' do
it 'should len equal config.len' do
res = RuCaptcha.create(0, 5, 1)
res = RuCaptcha.create(0, 5, 1, 1)
expect(res.length).to eq(2)
expect(res[0].length).to eq(5)
expect(res[1]).not_to eq(nil)
end
it 'should work with color style' do
res = RuCaptcha.create(1, 5, 1)
res = RuCaptcha.create(1, 5, 1, 1)
expect(res.length).to eq(2)
expect(res[0].length).to eq(5)
expect(res[1]).not_to eq(nil)
@ -48,49 +48,63 @@ describe RuCaptcha do
end
it 'should len equal 3' do
res = RuCaptcha.create(1, 3, 1)
res = RuCaptcha.create(1, 3, 1, 1)
expect(res.length).to eq(2)
expect(res[0].length).to eq(3)
expect(res[1]).not_to eq(nil)
end
it 'should len equal 4' do
res = RuCaptcha.create(1, 4, 1)
res = RuCaptcha.create(1, 4, 1, 1)
expect(res.length).to eq(2)
expect(res[0].length).to eq(4)
expect(res[1]).not_to eq(nil)
end
it 'should len equal 5' do
res = RuCaptcha.create(1, 5, 1)
res = RuCaptcha.create(1, 5, 1, 1)
expect(res.length).to eq(2)
expect(res[0].length).to eq(5)
expect(res[1]).not_to eq(nil)
end
it 'should len equal 6' do
res = RuCaptcha.create(1, 6, 1)
res = RuCaptcha.create(1, 6, 1, 1)
expect(res.length).to eq(2)
expect(res[0].length).to eq(6)
expect(res[1]).not_to eq(nil)
end
it 'should len equal 7' do
res = RuCaptcha.create(1, 7, 0)
res = RuCaptcha.create(1, 7, 0, 1)
expect(res.length).to eq(2)
expect(res[0].length).to eq(7)
expect(res[1]).not_to eq(nil)
end
it 'should work with outline enable' do
res = RuCaptcha.create(1, 7, 1, 1)
expect(res.length).to eq(2)
expect(res[0].length).to eq(7)
expect(res[1]).not_to eq(nil)
end
it 'should work with outline disable' do
res = RuCaptcha.create(1, 5, 1, 0)
expect(res.length).to eq(2)
expect(res[0].length).to eq(5)
expect(res[1]).not_to eq(nil)
end
it 'should work with strikethrough enable' do
res = RuCaptcha.create(1, 7, 1)
res = RuCaptcha.create(1, 7, 1, 1)
expect(res.length).to eq(2)
expect(res[0].length).to eq(7)
expect(res[1]).not_to eq(nil)
end
it 'should work with strikethrough disable' do
res = RuCaptcha.create(1, 7, 0)
res = RuCaptcha.create(1, 7, 0, 1)
expect(res.length).to eq(2)
expect(res[0].length).to eq(7)
expect(res[1]).not_to eq(nil)