Project

rspec-bdd

0.0
No commit activity in last 3 years
No release in over 3 years
The library extends the DSL of RSpec with given, background, feature, scenario, and shared_scenarios.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0

Runtime

~> 3.0
 Project Readme

RSpec BDD Gem Version Dependency Status Build Status

The library extends the DSL of RSpec with the following methods:

  • background,
  • given,
  • feature,
  • scenario, and
  • shared_scenarios.

Installation

In Gemfile:

gem 'rspec-bdd'

Usage

Before:

RSpec.describe 'Awesome feature' do
  before do
    expect(true).to be true
  end

  let(:truth) { true }
  let!(:lie) { false }

  it 'Superb scenario' do
    expect(truth).to be true
  end

  xit 'Bad scenario' do
    expect(truth).to be false
  end

  shared_examples 'Comprehensive scenarios' do
    it 'Handsome scenario' do
      expect(lie).to be false
    end
  end

  include_examples 'Comprehensive scenarios'
end

After:

require 'rspec/bdd'

RSpec.feature 'Awesome feature' do
  background do
    expect(true).to be true
  end

  given(:truth) { true }
  given!(:lie) { false }

  scenario 'Superb scenario' do
    expect(truth).to be true
  end

  xscenario 'Bad scenario' do
    expect(truth).to be false
  end

  shared_scenarios 'Comprehensive scenarios' do
    scenario 'Handsome scenario' do
      expect(lie).to be false
    end
  end

  include_scenarios 'Comprehensive scenarios'
end

Acknowledgments

The library is inspired by Capybara.

Contributing

  1. Fork the project.
  2. Create a branch for your feature (git checkout -b awesome-feature).
  3. Implement your feature (vim).
  4. Commit your changes (git commit -am 'Implemented an awesome feature').
  5. Push to the branch (git push origin awesome-feature).
  6. Create a new Pull Request.