Class: Mspec::Matchers::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/m-spec/core/matchers/output.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Output

Returns a new instance of Output.



8
9
10
# File 'lib/m-spec/core/matchers/output.rb', line 8

def initialize(value)
  @value = value
end

Instance Attribute Details

#test_code_output_stringObject (readonly)

Returns the value of attribute test_code_output_string.



6
7
8
# File 'lib/m-spec/core/matchers/output.rb', line 6

def test_code_output_string
  @test_code_output_string
end

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/m-spec/core/matchers/output.rb', line 6

def value
  @value
end

Instance Method Details

#check(block) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/m-spec/core/matchers/output.rb', line 12

def check(block)
  output = mock_output do
    block.call
  end
  @test_code_output_string = output.string

  @value == @test_code_output_string
end