Sha256: 46ece91e531b7a42a83a0df361321f3ab83db2455f377637ed08130e4e25436e
Contents?: true
Size: 1.37 KB
Versions: 49
Compression:
Stored size: 1.37 KB
Contents
require File.expand_path(File.dirname(__FILE__) + "/../../../example_helper") describe Micronaut::Matchers do describe "be_close" do it "should match when value == target" do be_close(5.0, 0.5).matches?(5.0).should be_true end it "should match when value < (target + delta)" do be_close(5.0, 0.5).matches?(5.49).should be_true end it "should match when value > (target - delta)" do be_close(5.0, 0.5).matches?(4.51).should be_true end it "should not match when value == (target - delta)" do be_close(5.0, 0.5).matches?(4.5).should be_false end it "should not match when value < (target - delta)" do be_close(5.0, 0.5).matches?(4.49).should be_false end it "should not match when value == (target + delta)" do be_close(5.0, 0.5).matches?(5.5).should be_false end it "should not match when value > (target + delta)" do be_close(5.0, 0.5).matches?(5.51).should be_false end it "should provide a useful failure message" do #given matcher = be_close(5.0, 0.5) #when matcher.matches?(5.51) #then matcher.failure_message.should == "expected 5.0 +/- (< 0.5), got 5.51" end it "should describe itself" do matcher = be_close(5.0, 0.5) matcher.matches?(5.1) matcher.description.should == "be close to 5.0 (within +- 0.5)" end end end
Version data entries
49 entries across 49 versions & 3 rubygems