hey ben, thanks,
your solution works :-)

luckily(!) a typo make get me to some prettier way (doing what webrat does),
first namescoping the matchers:

module MyCustom do
  module Matchers do
     Spec::Matchers.define :have_rol do |role|
       match do |user|
         user.roles.collect{ |r| r.name }.include?(role)
       end
     end
  end
end

and then in some my_custom_matchers.rb do:

Spec::Runner.configure do |config|
  # rspec should support :type => [:controller, :helper, :view] - but until
it does ...
  config.include(Webrat::Matchers, :type => :controller)
  config.include(Webrat::Matchers, :type => :helper)
  config.include(Webrat::Matchers, :type => :view)
end

and then a require 'my_custom_matchers' in env.rb save the day

thanks for your response
joaquin
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to