[rspec-devel] [ rspec-Feature Requests-6333 ] mock expectations should match regular expectations

noreply at rubyforge.org noreply at rubyforge.org
Thu Oct 26 08:04:41 EDT 2006


Feature Requests item #6333, was opened at 2006-10-26 12:03
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=6333&group_id=797

Category: mock module
Group: None
>Status: Closed
Priority: 3
Submitted By: David Chelimsky (dchelimsky)
Assigned to: David Chelimsky (dchelimsky)
Summary: mock expectations should match regular expectations

Initial Comment:
context "a mock, in handling arguments" do
  setup do
    @mock = Mock.new("test mock")
  end
  specify "should match string against regexp" do
    @mock.should_receive(:random_call).with(/bcd/)
    @mock.random_call("abcde")
  end

  specify "should match regexp against regexp" do
    @mock.should_receive(:random_call).with(/bcd/)
    @mock.random_call(/bcd/)
  end
  
  specify "should fail if regexp does not match submitted string" do
    @mock.should_receive(:random_call).with(/bcd/)
    lambda { @mock.random_call("abc") }.should_raise(MockExpectationError)
  end
  
  specify "should fail if regexp does not match submitted regexp" do
    @mock.should_receive(:random_call).with(/bcd/)
    lambda { @mock.random_call(/bcde/) }.should_raise(MockExpectationError)
  end
end


----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2006-10-26 12:04

Message:
Added - will be in 0.7

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=6333&group_id=797


More information about the rspec-devel mailing list