Joshua Muheim wrote:
> Hi all
> 
> I have the following helper that I use both in the unit and functional
> tests for my model Page:
> 
> class PagesControllerTest < ActionController::TestCase
>   ...
> private
>   def valid_attributes
>     { :short_title => "Valid short title",
>       :body => "<h1>Valid title</h1><p>Valid body</p>",
>       :parent_id => nil}
>   end
> end
> 
> Is there a convenient way to remove this duplication and source it out
> to a file that is loaded by both the unit and the functional test files?

With RSpec, you could use spec_helper; with TestCase, I don't know if 
there's a standard location.

However, in either case, there's a better solution to this particular 
issue.  If you use Machinist, these attributes could go into a named 
blueprint.

> 
> Thanks
> Josh

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to