Sha256: 741ba45cce0d74d31b534ec1dbed4e5f2db06f149abda83a42712c05c87c57aa
Contents?: true
Size: 1.02 KB
Versions: 36
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([double("actual", :happy? => true)]).to include( be_happy ) expect([double("actual", :happy? => false)]).not_to include( be_happy ) end end end end
Version data entries
36 entries across 36 versions & 8 rubygems