RSpec Expectations

Max Jacobson edited this page Oct 13, 2015 · 2 revisions

If you're using bundler, add the rspec-expectations gem to your Gemfile. Cucumber will automatically load RSpec's matchers and expectation methods to be available in your step definitions.

e.g.

Given /^a nice new bike$/ do
  expect(bike).to be_shiny
end

If you'd like to configure RSpec, you'll need to also add the rspec-core gem to your Gemfile. Then, you can add to your features/support/env.rb configuration such as

RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end
end