1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
require 'spec_helper.rb'
describe U2F::ClientData do
let(:type) { '' }
let(:registration_type) { U2F::ClientData::REGISTRATION_TYP }
let(:authentication_type) { U2F::ClientData::AUTHENTICATION_TYP }
let(:client_data) do
cd = U2F::ClientData.new
cd.typ = type
cd
end
describe '#registration?' do
subject { client_data.registration? }
context 'for correct type' do
let(:type) { registration_type }
it { is_expected.to be_truthy }
end
context 'for incorrect type' do
let(:type) { authentication_type }
it { is_expected.to be_falsey }
end
end
describe '#authentication?' do
subject { client_data.authentication? }
context 'for correct type' do
let(:type) { authentication_type }
it { is_expected.to be_truthy }
end
context 'for incorrect type' do
let(:type) { registration_type }
it { is_expected.to be_falsey }
end
end
end
|