[rspec-devel] rspec_on_rails, speccing models, adding it helpers...
adam at thewilliams.ws
Tue Apr 1 19:06:14 EDT 2008
On Apr 1, 2008, at 6:38 PM, Pat Maddox wrote:
> On Tue, Apr 1, 2008 at 3:09 PM, David Chelimsky
> <dchelimsky at gmail.com> wrote:
>>> describe SomeModel do
>>> it_has_many :widgets, :destroy => :null, :class_name =>
>>> it_has_one :fuzzbucket
>>> it_belongs_to :another_model
>> I see more and more structures appearing like this. I have very mixed
>> feelings about them. This is about structure, not behaviour. Even if
>> the underlying code is actually approaching this in a more
>> way, it's still expressing structure at the high level.
> I don't have mixed feelings about this. I think this type of spec is
> terrible. It completely duplicates the implementation. It's not even
> testing anything.
> This is not a value judgment against you though, Zach. I think when
> people do stuff like this they genuinely have good intentions. It's
> just that it seems to be quite difficult to test highly declarative
> stuff like AR associations.
I lean this way myself, and find that the best way to test
associations is by writing integration tests which prove that when an
administrator clicks delete on a user account, the user and his stuff
should be gone.
I'd love to hear your thoughts on style, Pat.
More information about the rspec-devel