3

After using shoulda it is very clear that shoulda no longer uses macros (They are all deprecated for the preferred matchers) For example:

should_allow_custom_test

is deprecated for the following:

should allow_custom_test

However all the documentation I can find is for the former macro setup by placing them in the shoulda_macros directory. I thought the same could be accomplished with a custom matcher but shoulda can not find it them.

My matcher I'm using is at http://gist.github.com/613522

How do I include custom matchers into my TestCase's?

Sukima
  • 9,965
  • 3
  • 46
  • 60

1 Answers1

2

Delving into active_record.rb, looks like the matchers are directly required into Test::Unit::TestCase I think your gist pulls it into ActiveSupport::TestCase - not sure if that'd help... but might be worth a try.

From active_record.rb:

module Test # :nodoc: all
  module Unit
    class TestCase
      include Shoulda::ActiveRecord::Helpers
      include Shoulda::ActiveRecord::Matchers
      include Shoulda::ActiveRecord::Assertions
      extend Shoulda::ActiveRecord::Macros
    end
  end
end
Taryn East
  • 27,486
  • 9
  • 86
  • 108
  • Thanks that might actually be the case. I gave up a while ago and opted for custom macros as that is the only examples google can find these days. I will have to try matchers again some time. – Sukima Dec 13 '10 at 18:26