2018-11-06 16:20:11 +01:00
|
|
|
describe Champs::YesNoChamp do
|
|
|
|
describe '#to_s' do
|
|
|
|
subject { Champs::YesNoChamp.new(value: value).to_s }
|
|
|
|
|
|
|
|
context 'when the value is false' do
|
|
|
|
let(:value) { "false" }
|
|
|
|
|
2018-12-28 15:58:17 +01:00
|
|
|
it { is_expected.to eq("Non") }
|
2018-11-06 16:20:11 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when the value is true' do
|
|
|
|
let(:value) { "true" }
|
|
|
|
|
2018-12-28 15:58:17 +01:00
|
|
|
it { is_expected.to eq("Oui") }
|
2018-11-06 16:20:11 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when the value is nil' do
|
|
|
|
let(:value) { nil }
|
|
|
|
|
2018-12-28 15:58:17 +01:00
|
|
|
it { is_expected.to eq("Non") }
|
2018-11-06 16:20:11 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|