1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
3 describe "should include(expected)" do
4 it "should pass if target includes expected" do
5 [1,2,3].should include(3)
6 "abc".should include("a")
9 it "should fail if target does not include expected" do
11 [1,2,3].should include(4)
12 }.should fail_with("expected [1, 2, 3] to include 4")
14 "abc".should include("d")
15 }.should fail_with("expected \"abc\" to include \"d\"")
19 describe "should include(with, multiple, args)" do
20 it "should pass if target includes all items" do
21 [1,2,3].should include(1,2,3)
24 it "should fail if target does not include any one of the items" do
26 [1,2,3].should include(1,2,4)
27 }.should fail_with("expected [1, 2, 3] to include 1, 2 and 4")
31 describe "should_not include(expected)" do
32 it "should pass if target does not include expected" do
33 [1,2,3].should_not include(4)
34 "abc".should_not include("d")
37 it "should fail if target includes expected" do
39 [1,2,3].should_not include(3)
40 }.should fail_with("expected [1, 2, 3] not to include 3")
42 "abc".should_not include("c")
43 }.should fail_with("expected \"abc\" not to include \"c\"")