Class: PigCI::TestFrameworks::Rspec

Inherits:
Object
  • Object
show all
Defined in:
lib/pig_ci/test_frameworks/rspec.rb

Class Method Summary collapse

Class Method Details

.configure!Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pig_ci/test_frameworks/rspec.rb', line 2

def self.configure!
  if defined?(::RSpec)
    ::RSpec.configure do |config|
      config.around(:each, pig_ci: false) do |example|
        @pig_ci_enabled = PigCI.enabled?
        PigCI.enabled = false
        example.run
        PigCI.enabled = @pig_ci_enabled
      end

      config.around(:each, pig_ci: true) do |example|
        @pig_ci_enabled = PigCI.enabled?
        PigCI.enabled = true
        example.run
        PigCI.enabled = @pig_ci_enabled
      end
    end
  end
end