Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Started to add some integration specs to show the interaction between…

… include()

matcher support and the built-in matchers.
  • Loading branch information...
commit 556c3f601ef138ca02e973d178b6147555e11113 1 parent 402b75a
@lukeredpath authored
Showing with 30 additions and 0 deletions.
  1. +30 −0 spec/rspec/matchers/include_matcher_integration_spec.rb
View
30 spec/rspec/matchers/include_matcher_integration_spec.rb
@@ -0,0 +1,30 @@
+require 'spec_helper'
+
+module RSpec
+ module Matchers
+ describe "include() interaction with built-in matchers" do
+ it "works with be_within(delta).of(expected)" do
+ [10, 20, 30].should include( be_within(5).of(24) )
+ [10, 20, 30].should_not include( be_within(3).of(24) )
+ end
+
+ it "works with be_instance_of(klass)" do
+ ["foo", 123, {:foo => "bar"}].should include( be_instance_of(Hash) )
+ ["foo", 123, {:foo => "bar"}].should_not include( be_instance_of(Range) )
+ end
+
+ it "works with be_kind_of(klass)" do
+ class StringSubclass < String; end
+ class NotHashSubclass; end
+
+ [StringSubclass.new("baz")].should include( be_kind_of(String) )
+ [NotHashSubclass.new].should_not include( be_instance_of(Hash) )
+ end
+
+ it "works with be_[some predicate]" do
+ [stub("actual", :happy? => true)].should include( be_happy )
+ [stub("actual", :happy? => false)].should_not include( be_happy )
+ end
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.