specs/constraints/int_domain.rb in gecoder-0.5.0 vs specs/constraints/int_domain.rb in gecoder-0.6.0

- old
+ new

@@ -13,31 +13,38 @@ @invoke_options = lambda do |hash| @x.must_be.in(@non_range_domain, hash) @model.solve! end @expect_options = lambda do |strength, reif_var| - if reif_var.nil? - Gecode::Raw.should_receive(:dom).once.with(@model.active_space, - @x.bind, an_instance_of(Gecode::Raw::IntSet), strength) - else - Gecode::Raw.should_receive(:dom).once.with(@model.active_space, - @x.bind, an_instance_of(Gecode::Raw::IntSet), - an_instance_of(Gecode::Raw::BoolVar), strength) + @model.allow_space_access do + if reif_var.nil? + Gecode::Raw.should_receive(:dom).once.with( + an_instance_of(Gecode::Raw::Space), + @x.bind, an_instance_of(Gecode::Raw::IntSet), strength) + else + Gecode::Raw.should_receive(:dom).once.with( + an_instance_of(Gecode::Raw::Space), + @x.bind, an_instance_of(Gecode::Raw::IntSet), + an_instance_of(Gecode::Raw::BoolVar), strength) + end end end end it 'should translate domain constraints with range domains' do - Gecode::Raw.should_receive(:dom).once.with(@model.active_space, - @x.bind, @range_domain.first, @range_domain.last, Gecode::Raw::ICL_DEF) + Gecode::Raw.should_receive(:dom).once.with( + an_instance_of(Gecode::Raw::Space), + an_instance_of(Gecode::Raw::IntVar), @range_domain.first, + @range_domain.last, Gecode::Raw::ICL_DEF) @x.must_be.in @range_domain @model.solve! end it 'should translate domain constraints with three dot range domains' do - Gecode::Raw.should_receive(:dom).once.with(@model.active_space, - @x.bind, @three_dot_range_domain.first, @three_dot_range_domain.last, - Gecode::Raw::ICL_DEF) + Gecode::Raw.should_receive(:dom).once.with( + an_instance_of(Gecode::Raw::Space), + an_instance_of(Gecode::Raw::IntVar), @three_dot_range_domain.first, + @three_dot_range_domain.last, Gecode::Raw::ICL_DEF) @x.must_be.in @three_dot_range_domain @model.solve! end it 'should translate domain constraints with non-range domains' do \ No newline at end of file