Sha256: cc4a3e85b5d48c00be32ef193eb6b4918bb1f9257b82ef589de3a7bd49ba8065
Contents?: true
Size: 1002 Bytes
Versions: 5
Compression:
Stored size: 1002 Bytes
Contents
require File.dirname(__FILE__) + '/../../spec_helper.rb' describe "should =~" do it "should delegate message to target" do subject = "foo" subject.should_receive(:=~).with(/oo/).and_return(true) subject.should =~ /oo/ end it "should fail when target.=~(actual) returns false" do subject = "fu" subject.should_receive(:=~).with(/oo/).and_return(false) Spec::Expectations.should_receive(:fail_with).with(%[expected =~ /oo/, got "fu"], /oo/, "fu") subject.should =~ /oo/ end end describe "should_not =~" do it "should delegate message to target" do subject = "fu" subject.should_receive(:=~).with(/oo/).and_return(false) subject.should_not =~ /oo/ end it "should fail when target.=~(actual) returns false" do subject = "foo" subject.should_receive(:=~).with(/oo/).and_return(true) Spec::Expectations.should_receive(:fail_with).with(%[expected not =~ /oo/, got "foo"], /oo/, "foo") subject.should_not =~ /oo/ end end
Version data entries
5 entries across 5 versions & 1 rubygems