2015-09-08 12:55:34 -04:00
|
|
|
RSpec.describe Mutant::Result do
|
2015-12-20 19:28:27 -05:00
|
|
|
let(:object) do
|
|
|
|
Class.new do
|
|
|
|
include Mutant::Result, Concord.new(:runtime, :killtime)
|
2015-09-08 12:55:34 -04:00
|
|
|
|
2015-12-20 19:28:27 -05:00
|
|
|
def collection
|
|
|
|
[[1]]
|
|
|
|
end
|
2015-09-08 12:55:34 -04:00
|
|
|
|
2015-12-20 19:28:27 -05:00
|
|
|
sum :length, :collection
|
|
|
|
end.new(3.0, 1.0)
|
|
|
|
end
|
2015-09-08 12:55:34 -04:00
|
|
|
|
2015-12-20 19:28:27 -05:00
|
|
|
describe '.included' do
|
2015-09-08 12:55:34 -04:00
|
|
|
it 'includes mixin to freeze instances' do
|
|
|
|
expect(object.frozen?).to be(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'it makes DSL methods from Mutant::Result available' do
|
|
|
|
expect(object.length).to be(1)
|
|
|
|
end
|
|
|
|
end
|
2015-12-20 19:28:27 -05:00
|
|
|
|
|
|
|
describe '#overhead' do
|
|
|
|
subject { object.overhead }
|
|
|
|
|
|
|
|
it 'returns difference between runtime and killtime' do
|
|
|
|
should eql(2.0)
|
|
|
|
end
|
|
|
|
end
|
2015-09-08 12:55:34 -04:00
|
|
|
end
|