No commit activity in last 3 years
No release in over 3 years
Repeat RSpec examples with custom setup.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.0

Runtime

 Project Readme

RSpec::Repetitive

Repeat RSpec examples with custom setup.

Installation

Add this line to your application's Gemfile:

gem 'rspec-repetitive'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec-repetitive

Usage

The following RSpec example would run twice: first without then with a feature switch enabled.

require 'rspec'
require 'rspec-repetitive'

RSpec.configure do |config|
  RSpec::Repetitive.configure(config)
end

RSpec.describe "something that should work with and without a feature switch enabled" do
  repeat_each_example "with my_feature enabled" do
    FeatureSwitch.enable(:my_feature)
  end

  it "works" do
    # ...
  end
end

Running the above example would produce the following:

$ rspec my_spec.rb

something that should work with and without a feature switch enabled
  works
  with my_feature enabled works

Finished in 0.00153 seconds (files took 0.12087 seconds to load)
2 examples, 0 failures

License

The gem is available as open source under the terms of the MIT License.