Class: RSpecFixtures::Matchers::RaiseFixture

Inherits:
Base
  • Object
show all
Defined in:
lib/rspec_fixtures/matchers/raise_fixture.rb

Instance Attribute Summary

Attributes inherited from Base

#actual, #actual_distance, #distance, #fixture_name

Instance Method Summary collapse

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

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rspec_fixtures/matchers/raise_fixture.rb', line 11

def matches?(block)
  return false unless block.is_a? Proc
  @actual = 'Nothing raised'

  begin
    block.call
  rescue => e
    @actual = e.inspect
  end

  super
end

#supports_block_expectations?Boolean

Lets RSpec know that this matcher requires a block.

Returns:

  • (Boolean)


25
26
27
# File 'lib/rspec_fixtures/matchers/raise_fixture.rb', line 25

def supports_block_expectations?
  true
end