Hi all,

I am using story runner with webrat, but I am not sure how to incorporate stub_model into my tests.

The webrat steps only care about the user interface and have nothing to say about interaction with the database.

Following Ben Mabey, I have a line in my story like:

"When clicks the Create button"

And a step like:

When "clicks the $button button" do |button|
  clicks_button button
end

Would it be sensible to extend it as follows:

"And clicks the Create button to create a new thing"

With step:

When "clicks the $button button to create a new $resource" do |button, resource|
  klass      = resource.classify.constantize
  stub_model(klass)
  clicks_button button
end

Or is there a better way of making sure that all required models are stubbed?

many thanks,

danny

_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to