Hi I wonder why this stub doesn't work:
# ruby 1.8.7, rspec 2.0.1 require 'rubygems' require 'rspec' Rspec.configure do |c| c.mock_with :rspec end class SayHello def say_hello "hello" end end describe "test string" do it "should interpret stub correctly" do SayHello.stub!(:say_hello).and_return('NO') sh = SayHello.new() sh.say_hello.should eql('NO') end end The result is: tryouts ➤ rspec -f n test_spec.rb test string should interpret stub correctly (FAILED - 1) Failures: 1) test string should interpret stub correctly Failure/Error: sh.say_hello.should eql('NO') expected "NO" got "hello" (compared using eql?) # ./test_spec.rb:18 Finished in 0.0016 seconds 1 example, 1 failure Any ideas? Bye Haim Ashkenazi
PGP.sig
Description: This is a digitally signed message part
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users