Sha256: 155f92bce695ff04d99f973ba4d3201f257640b68a150502a94a8e148829e624
Contents?: true
Size: 1.02 KB
Versions: 7
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' module RSpec module Matchers describe "include() interaction with built-in matchers" do it "works with be_within(delta).of(expected)" do expect([10, 20, 30]).to include( be_within(5).of(24) ) expect([10, 20, 30]).not_to include( be_within(3).of(24) ) end it "works with be_instance_of(klass)" do expect(["foo", 123, {:foo => "bar"}]).to include( be_instance_of(Hash) ) expect(["foo", 123, {:foo => "bar"}]).not_to include( be_instance_of(Range) ) end it "works with be_kind_of(klass)" do class StringSubclass < String; end class NotHashSubclass; end expect([StringSubclass.new("baz")]).to include( be_kind_of(String) ) expect([NotHashSubclass.new]).not_to include( be_kind_of(Hash) ) end it "works with be_[some predicate]" do expect([stub("actual", :happy? => true)]).to include( be_happy ) expect([stub("actual", :happy? => false)]).not_to include( be_happy ) end end end end
Version data entries
7 entries across 7 versions & 5 rubygems