demarches-normaliennes/spec/models/logic/and_spec.rb

19 lines
440 B
Ruby
Raw Normal View History

2022-06-09 14:00:18 +02:00
describe Logic::And do
include Logic
describe '#compute' do
it { expect(and_from([true, true, true]).compute).to be true }
it { expect(and_from([true, true, false]).compute).to be false }
end
describe '#to_s' do
it do
2022-09-26 21:21:55 +02:00
expect(and_from([true, false, true]).to_s([])).to eq "(Oui && Non && Oui)"
2022-06-09 14:00:18 +02:00
end
end
def and_from(boolean_to_constants)
ds_and(boolean_to_constants.map { |b| constant(b) })
end
end