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

29 lines
718 B
Ruby
Raw Normal View History

2022-06-09 11:48:30 +02:00
describe Logic::Constant do
include Logic
describe '#compute' do
it { expect(constant(1).compute).to eq(1) }
end
describe '#type' do
it { expect(constant(1).type).to eq(:number) }
it { expect(constant(1.0).type).to eq(:number) }
it { expect(constant('a').type).to eq(:string) }
it { expect(constant(true).type).to eq(:boolean) }
it { expect(constant(false).type).to eq(:boolean) }
end
describe '#errors' do
it { expect(constant(1).errors).to eq([]) }
end
describe '#==' do
it { expect(constant(1)).to eq(constant(1)) }
it { expect(constant(1)).not_to eq(constant('a')) }
end
2023-01-04 11:10:10 +01:00
describe '#sources' do
it { expect(constant(1).sources).to eq([]) }
end
2022-06-09 11:48:30 +02:00
end