[rspec-users] Depot app, Demeter's law and troubles cleanly specing

Mark Wilden mark at mwilden.com
Sun Apr 19 12:24:09 EDT 2009

On Sun, Apr 19, 2009 at 3:51 AM, Matt Wynne <matt at mattwynne.net> wrote:

> @order_presenter.product_titles do |product_title, url|
>  <%= link_to product_title, url %>
> end

The presentation of an order in most apps will be constructed from
additional columns (e.g., color, size, price, extended price). These
columns may well be formatted differently depending on the
circumstance (e.g, printed or on-screen).

Now, it might be a good idea to put this construction and formatting
in a helper or presenter outside the view (though it won't be
TSTTCPW). But anywhere you put it, there will be non-Demeterian code
that needs to drill down into each order's items', products'
information (as well as non-product information, such as line-item
discount). If the underlying model changes, this code will have to
change - you can't avoid it.


More information about the rspec-users mailing list