Sha256: e56d4854b7869270e1eecf98a50c1ebb49e3ea2d5517bfada29c1c50510205fd
Contents?: true
Size: 822 Bytes
Versions: 1
Compression:
Stored size: 822 Bytes
Contents
describe "Matcher::BeWithin" do it "passes when subject is within range" do expect(27.5).to be_within(0.5).of(27.9) expect(27.5).to be_within(0.5).of(28.0) expect(27.5).to be_within(0.5).of(27.1) expect(27.5).to be_within(0.5).of(27.0) expect(27.5).not_to be_within(0.5).of(28.1) expect(27.5).not_to be_within(0.5).of(26.9) end it "fails when subject is not within range" do expect_failure{ expect(27.5).not_to be_within(0.5).of(28) } expect_failure{ expect(27.5).not_to be_within(0.5).of(27) } expect_failure{ expect(27.5).to be_within(0.5).of(28.1) } expect_failure{ expect(27.5).to be_within(0.5).of(26.9) } end it "raises an exception when the matcher is not complete" do expect{ expect(1).to be_within(10) }.to raise_error(BaconExpect::InvalidMatcher) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bacon-expect-1.0.2 | spec_app/spec/matchers/be_within_spec.rb |