Skip to content
nightscape edited this page Jun 9, 2011 · 9 revisions

To use RSpec’s 1.×.x expectations (should), make sure the following is in features/support/env.rb:

require 'spec/expectations'

'spec/expectations' also includes 'spec/matchers'. When cucumber sees the Spec::Matchers and Spec::Expectations modules defined, it will implicitly include them in the World in which the steps are executed.

Do not require 'spec', because that loads up a bunch of RSpec modules that you don’t need and might get in your way.

When running Cucumber from Maven (with Cuke4Duke) you need to install the RSpec gem into your Maven repository by declaring it in your POM (see Cuke4Duke: Installing gems)

  <build>
    <plugins>
      <plugin>
        <configuration>
          <gems>
	      <gem>install cuke4duke --version 0.2.1 --source http://gems.rubyforge.org/</gem>
	      <gem>install rspec --version 1.2.9 --source http://gems.rubyforge.org/</gem>

To use RSpec’s 2.×.x expectations (should), make sure the following is in features/support/env.rb:

require 'rspec/expectations'
World(Rspec::Matchers)
Clone this wiki locally