On Jun 3, 2011, at 7:39 AM, Andrew Premdas wrote:

> Hi there,
> 
> I need some help migrating some code in the cucumber textmate bundle so I can 
> run the specs with rspec2.
> 
> The following code lives in support/spec/spec_helper.rb and I think its 
> purpose is to load the fixtures. 
> 
> module Spec::Example::ExampleMethods
>   def project_root
>     @project_root ||= File.expand_path(File.join(File.dirname(__FILE__), 
> '../fixtures'))
>   end
> end
> 
> Anyhow I can't find an rspec2 equivalent and was hoping someone might be able 
> to help
> 
> Best attempt so far uses module RSpec::Core::Subject::InstanceMethods but 
> this is pure guesswork and I'm still getting errors, although it could be 
> something unrelated

Rather than monkey patching RSpec, I'd recommend using its APIs:

RSpec.configure do |c|
  c.include(Module.new do
    def project_root
      # ...
    end
  end)
end

Let me know if that works.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to