File: be_close_spec.rb

package info (click to toggle)
ruby-rspec-expectations 2.14.2-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 920 kB
  • sloc: ruby: 8,202; makefile: 4
file content (22 lines) | stat: -rw-r--r-- 620 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'spec_helper'

module RSpec
  module Matchers
    describe "expect(actual).to be_close(expected, delta)" do
      before(:each) do
        allow(RSpec).to receive(:deprecate)
      end

      it "is deprecated" do
        expect(RSpec).to receive(:deprecate).with(/be_close.*/, :replacement => "be_within(0.5).of(3.0)")
        be_close(3.0, 0.5)
      end

      it "delegates to be_within(delta).of(expected)" do
        should_receive(:be_within).with(0.5).and_return( be_within_matcher = double )
        be_within_matcher.should_receive(:of).with(3.0)
        be_close(3.0, 0.5)
      end
    end
  end
end