[rspec-users] Application-wide spec_helper method

Zach Dennis zach.dennis at gmail.com
Thu Aug 28 13:27:33 EDT 2008

You can put it in a module and include it for model specs in spec_helper.rb

Spec::Runner.configure do |config|
  # ...
  config.include DescribeModelAttributeSpecHelper, :type => :model


On Thu, Aug 28, 2008 at 12:41 PM, Nick Hoffman <nick at deadorange.com> wrote:
> On 2008-08-28, at 08:02, David Chelimsky wrote:
>> On Wed, Aug 27, 2008 at 2:38 PM, Nick Hoffman <nick at deadorange.com> wrote:
>>> If a helper method can be used for multiple model specs, obviously it
>>> should
>>> not be placed within a specific model's spec helper file. Is there a
>>> recommended file in which to put such a method? Maybe
>>> spec/helpers/application_helper_spec.rb ?
>> This is a very confusing question. Model's don't typically get
>> individual spec helper files, so I'm not sure what you're getting at.
>> Can you give an example?
> I asked because I had begun to abstract my #describe_properties method away
> from the Property model so that it can be used with any model. Now that the
> method's been converted from this:
>    http://pastie.org/261175
> to this:
>    http://pastie.org/261829
> I'd like to use it with multiple models.
> Cheers,
> Nick
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Zach Dennis

More information about the rspec-users mailing list