[rspec-devel] stubs

Brian Takita brian.takita at gmail.com
Tue Oct 3 03:36:35 EDT 2006


I fixed it. I noticed that you where using
assigns[:person].should_be person
instead of
assigns(:person).should_be person

Anyways, the context looks like:

context "/person/show/3" do
  fixtures :people
  controller_name :person

  specify "should get person with id => 3 from model" do
    person = mock("person")

    Person.should_receive(:find).with("3").and_return(person)
    #Person.stub!(:find).with(person)
    get 'show', :id => 3

    assigns(:person).should_be person
  end
end


On 10/2/06, David Chelimsky <dchelimsky at gmail.com> wrote:
>
> On 10/2/06, David Chelimsky <dchelimsky at gmail.com> wrote:
> > On 10/2/06, Brian Takita <brian.takita at gmail.com> wrote:
> > > > I found out something else of interest. On AR derivatives, this
> works:
> > > >
> > > >    (class << Person; self; end).stub!(:create).with(false
> > > > )
> > > >
> > > > but this doesn't
> > > >
> > > >    Person.stub!(:create).with(false)
> > >
> > > Interesting. I'll be able to look at this tonight.
> >
> > I checked in a file w/ some stuff commented:
>
> That's in the stubs branch.
>
> >
> > vendor/rspec_on_rails/spec/controllers/person_controller_spec.rb
> >
> > That should give you an idea of some of the behaviour I'm seeing. Very
> > weird stuff. Hope you enjoy it!
> >
> > David
> >
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-devel/attachments/20061003/65a0b1bc/attachment-0001.html 


More information about the rspec-devel mailing list