Class: TarkaMatchers::Helpers::Expectation::ExpectCapture

Inherits:
Object
  • Object
show all
Defined in:
lib/tarka_matchers/helpers/expectation/expect_capture.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, block_target) ⇒ ExpectCapture

Returns a new instance of ExpectCapture.



5
6
7
# File 'lib/tarka_matchers/helpers/expectation/expect_capture.rb', line 5

def initialize target, block_target
	target == :undefined ? @target = block_target.call : @target = target
end

Class Attribute Details

.actual_matcher=(value) ⇒ Object (writeonly)

Sets the attribute actual_matcher

Parameters:

  • value

    the value to set the attribute actual_matcher to.



17
18
19
# File 'lib/tarka_matchers/helpers/expectation/expect_capture.rb', line 17

def actual_matcher=(value)
  @actual_matcher = value
end

Class Method Details

.capture(actual) ⇒ Object



9
10
11
12
13
14
# File 'lib/tarka_matchers/helpers/expectation/expect_capture.rb', line 9

def self.capture actual
	self.redefine
	actual.call
	self.replace
	@actual_matcher
end

Instance Method Details

#to(matcher) ⇒ Object



20
21
22
# File 'lib/tarka_matchers/helpers/expectation/expect_capture.rb', line 20

def to matcher
	match_populate 'should ', matcher
end

#to_not(matcher) ⇒ Object



24
25
26
# File 'lib/tarka_matchers/helpers/expectation/expect_capture.rb', line 24

def to_not matcher
	match_populate 'should not ', matcher
end