Class: Evilution::Integration::RSpec::StateGuard::ExampleGroupsConstants

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/integration/rspec/state_guard/example_groups_constants.rb

Instance Method Summary collapse

Instance Method Details

#release(before) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/evilution/integration/rspec/state_guard/example_groups_constants.rb', line 14

def release(before)
  return unless before
  return unless defined?(::RSpec::ExampleGroups)

  ::RSpec::ExampleGroups.constants(false).each do |c|
    next if before.include?(c)

    begin
      ::RSpec::ExampleGroups.send(:remove_const, c)
    rescue NameError
      next
    end
  end
end

#snapshotObject



8
9
10
11
12
# File 'lib/evilution/integration/rspec/state_guard/example_groups_constants.rb', line 8

def snapshot
  return nil unless defined?(::RSpec::ExampleGroups)

  Set.new(::RSpec::ExampleGroups.constants(false))
end