Migrating cucumber tm_bundle to rspec 2

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

TIA

Andrew

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

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.

On 3 June 2011 15:17, David C. [email protected] wrote:

module Spec::Example::ExampleMethods
this is pure guesswork and I’m still getting errors, although it could be
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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs