Module: PryTestcase

Defined in:
lib/pry_testcase.rb,
lib/pry_testcase/rspec.rb,
lib/pry_testcase/version.rb

Defined Under Namespace

Modules: RSpec

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.disableObject



18
19
20
# File 'lib/pry_testcase.rb', line 18

def disable
  @enabled.delete(Thread.current)
end

.enableObject



14
15
16
# File 'lib/pry_testcase.rb', line 14

def enable
  @enabled[Thread.current] = true
end

.enabled?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/pry_testcase.rb', line 10

def enabled?
  @enabled[Thread.current]
end

.pryObject



22
23
24
25
26
27
# File 'lib/pry_testcase.rb', line 22

def pry
  return unless enabled?

  depth = caller_locations.find_index{|c| !c.path.end_with?('pry_testcase.rb')} + 1
  binding.of_caller(depth).pry
end

.pry_onceObject



29
30
31
32
# File 'lib/pry_testcase.rb', line 29

def pry_once
  pry
  disable
end