Class: RSpecFixtures::Matchers::OutputFixture
- Defined in:
- lib/rspec_fixtures/matchers/output_fixture.rb
Instance Attribute Summary
Attributes inherited from Base
#actual, #actual_distance, #distance, #fixture_name
Instance Method Summary collapse
-
#matches?(block) ⇒ Boolean
Called by RSpec.
- #stream_capturer ⇒ Object
-
#supports_block_expectations? ⇒ Boolean
Lets RSpec know that this matcher requires a block.
-
#to_stderr ⇒ Object
Adds chained matcher, to allow: expect{ stream }.to output_fixture(file).to_stderr.
-
#to_stdout ⇒ Object
Adds chained matcher, to allow: expect{ stream }.to output_fixture(file).to_stdout This is the default, and only provided for completeness.
Methods inherited from Base
#before, #diff, #diffable?, #except, #expected, #failure_message, #fixture_file, #fixtures_dir, #initialize, #interactive?, #sanitize?
Constructor Details
This class inherits a constructor from RSpecFixtures::Matchers::Base
Instance Method Details
#matches?(block) ⇒ Boolean
Called by RSpec
11 12 13 14 15 |
# File 'lib/rspec_fixtures/matchers/output_fixture.rb', line 11 def matches?(block) return false unless block.is_a? Proc @actual = stream_capturer.capture block super end |
#stream_capturer ⇒ Object
37 38 39 |
# File 'lib/rspec_fixtures/matchers/output_fixture.rb', line 37 def stream_capturer @stream_capturer ||= Stream::Stdout end |
#supports_block_expectations? ⇒ Boolean
Lets RSpec know that this matcher requires a block.
18 19 20 |
# File 'lib/rspec_fixtures/matchers/output_fixture.rb', line 18 def supports_block_expectations? true end |