I'm in the midst of upgrading an app from Rails 2.3 to Rails 3, and as part of 
the process, from RSpec to RSpec2.
One thing that seems to have broken for me is the use of NullDB to nullify the 
database contextually for a single spec.

I think I've narrowed it down to this method in NullDB which always seems to 
return false, no matter where I put the line:
  include NullDB::RSpec::NullifiedDatabase

Can someone either sanity-check me here, or provide a different way of knowing 
when you are inside a describe block?

  def self.nullify_contextually?(other)
    rspec_root = defined?(RSpec) ? RSpec : Spec
    if defined? rspec_root::Rails::RailsExampleGroup
      other.ancestors.include?(rspec_root::Rails::RailsExampleGroup)
    else
      other.ancestors.include?(rspec_root::Rails::ModelExampleGroup) ||
        other.ancestors.include?(rspec_root::Rails::ControllerExampleGroup) ||
        other.ancestors.include?(rspec_root::Rails::ViewExampleGroup) ||
        other.ancestors.include?(rspec_root::Rails::HelperExampleGroup)
    end
  end

Thanks,
Matt Van Horn
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to