[rspec-users] basic noob questions

norm codehacker at comcast.net
Fri Jul 24 20:13:04 EDT 2009

Struggling mightily!

Testing a controller called Govtpositions. Just focusing on testing
the create method for the moment. I would imagine there should be two
examples for a successful save... instantiate the model object and
then save it, is that right?

So just to test the model object instantiation, I have:

describe GovtpositionsController, do
  before do

  it "should create a new govt position model" do
    @govtposition = mock_model(Govtposition)
    @params = {"name"=>"chief"}


This fails, with the reason that @govtposition is receiving an
unexpected :save. Well I didn't intend to test save, I was planning to
write another example for that assertion. Why can't I just test object
creation in it's own example, must I also test saving in the same
example? I'm clearly missing something basic!

thanks in advance for any insight you can offer

More information about the rspec-users mailing list