On 1/10/08, Rick DeNatale <[EMAIL PROTECTED]> wrote:
>
> So why not
>
> songs = [song1, song2, song3]
> album.stub!(:songs).and_return(songs)
> songs.stub!(:streamable).and_return([song1, song2])
Oh, of course. Thank you.
I think my mind was in a rut of "must use mock or mock_model" and I didn't
On 1/10/08, Chris Kampmeier <[EMAIL PROTECTED]> wrote:
> On 1/10/08, David Chelimsky <[EMAIL PROTECTED]> wrote:
>
> > album = mock("album")
> > songs = mock("songs")
> > album.stub!(:songs).and_return(songs)
> > songs.stub!(:streamable).and_return(true)
> >
> > That's the general idea. Specifics wi
On 1/10/08, David Chelimsky <[EMAIL PROTECTED]> wrote:
> album = mock("album")
> songs = mock("songs")
> album.stub!(:songs).and_return(songs)
> songs.stub!(:streamable).and_return(true)
>
> That's the general idea. Specifics will vary for each example.
If I do this, I end up with a mock object
On Jan 10, 2008 12:35 PM, Chris Kampmeier <[EMAIL PROTECTED]> wrote:
> I'm having a lot of trouble stubbing out an association extension for
> some view tests. Example rails code modeling a music album:
>
> class Album < ActiveRecord::Base
>has_many :songs do
> def streamable
>find
I'm having a lot of trouble stubbing out an association extension for
some view tests. Example rails code modeling a music album:
class Album < ActiveRecord::Base
has_many :songs do
def streamable
find(:all, :conditions => 'streamable = 1')
end
end
end
So for a given Album in