Module: RSpec::ExampleDisabler
- Defined in:
- lib/rspec/example_disabler.rb
Constant Summary collapse
- @@disabled_examples =
{}
Class Method Summary collapse
- .disable_example(example, reason) ⇒ Object
- .disable_examples(examples, reason) ⇒ Object
- .register_disabler ⇒ Object
Class Method Details
.disable_example(example, reason) ⇒ Object
18 19 20 |
# File 'lib/rspec/example_disabler.rb', line 18 def self.disable_example(example, reason) disable_examples([example], reason) end |
.disable_examples(examples, reason) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/rspec/example_disabler.rb', line 22 def self.disable_examples(examples, reason) examples.each do |example| if @@disabled_examples.include? example @@disabled_examples[example] << reason else @@disabled_examples[example] = [reason] end end end |
.register_disabler ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rspec/example_disabler.rb', line 6 def self.register_disabler RSpec.configure do |c| c.before(:each) do description = example.[:full_description] if @@disabled_examples.include?(description) reasons = @@disabled_examples[description].join(', ') pending "Disabled by rspec-example_disabler. Reason: #{reasons}" end end end end |