On 3 June 2011 15:17, David Chelimsky <dchelim...@gmail.com> wrote: > 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. >
David, that seems to work fine -- thankyou There is one small problem, I get a deprecation warning ***************************************************************** DEPRECATION WARNING: you are using deprecated behaviour that will be removed from RSpec 3. You have set some configuration options after an example group has already been defined. In RSpec 3, this will not be allowed. All configuration should happen before the first example group is defined. The configuration is happening at: ./support/spec/cucumber/mate/files/../../../spec_helper.rb:12 ***************************************************************** My spec helper is require 'rubygems' require 'rspec/core' ENV['TM_SUPPORT_PATH'] = '/Applications/TextMate.app/Contents/SharedSupport/Support' RSpec.configure do |c| c.include(Module.new do def project_root @project_root ||= File.expand_path(File.join(File.dirname(__FILE__), '../fixtures')) end end) end Should I be putting this code somewhere else? Many thanks Andrew > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -- ------------------------ Andrew Premdas blog.andrew.premdas.org
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users