David Chelimsky wrote:
>>> MyModel.stub(:find).with(42).and_return(myModel)
>> Didn't work as expected - I'll do a bit of research and post again.
> What is expected? What are you trying to accomplish?
Example in horror-code:
##################################################
class MyController < ApplicationController
def show
MyModel.find_by_code( params[:code] )
head :ok
end
end
describe "MySuite" do
it "should" do
MyModel.stub!( :find_by_code ).with( "abc" ) do
puts "triggered 'abc'!"
end
get :show, :code => "kkk"
end
end
##################################################
I'm expecting nothing to be printed, instead "triggered 'abc'!" is
printed.
The example is, as I said, completely meaningless, but would simplify
some tests in our suites.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users