I wouldn't bother with the it "should call #tags when the @tag_list
instance variable is empty" and it "should set the @tag_list instance
variable" specs, as they're testing implementation, not the interface -
that makes your test brittle and they end up knowing too much about your
code.
As for your "should return a sorted array of tags as words" there isn't
much to go on as I can't see what parse_tags does and returns, but
probably just making an expected array and testing it against that
should be enough, e.g.:
it "should return a sorted array of tags as words" do
@thing.tag_list( 'three,two,one' ).should eql(
['one','two','three'] )
end
Hope that's what you were asking about.
-D
On 22/1/09 16:26, Alistair Holt wrote:
> Hi everyone,
>
> I've just started seriously using Rspec writing the specs for a Merb
> app I'm working on. I've got some model methods which I'm not sure how
> to test or what the best way to test them is so I'm asking for any
> advice on my spec attempts. You can see the code @
> https://gist.github.com/ea5a553c12c38c4c6e1b
>
> Thanks
>
> Alistair Holt
>
> E: [email protected] <mailto:[email protected]>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"NWRUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nwrug-members?hl=en
-~----------~----~----~----~------~----~------~--~---