Sha256: df3219d951d580478d5048003d31ecef24f5369ce7bfeb77a8c161bf1a3bef82

Contents?: true

Size: 1.24 KB

Versions: 7390

Compression:

Stored size: 1.24 KB

Contents

require 'rspec/expectations'

module RSpec
  module Matchers
    # Matchers for testing RSpec matchers. Include them with:
    #
    #     require 'rspec/matchers/fail_matchers'
    #     RSpec.configure do |config|
    #       config.include RSpec::Matchers::FailMatchers
    #     end
    #
    module FailMatchers
      # Matches if an expectation fails
      #
      # @example
      #   expect { some_expectation }.to fail
      def fail(&block)
        raise_error(RSpec::Expectations::ExpectationNotMetError, &block)
      end

      # Matches if an expectation fails with the provided message
      #
      # @example
      #   expect { some_expectation }.to fail_with("some failure message")
      #   expect { some_expectation }.to fail_with(/some failure message/)
      def fail_with(message)
        raise_error(RSpec::Expectations::ExpectationNotMetError, message)
      end

      # Matches if an expectation fails including the provided message
      #
      # @example
      #   expect { some_expectation }.to fail_including("portion of some failure message")
      def fail_including(*snippets)
        raise_error(
          RSpec::Expectations::ExpectationNotMetError,
          a_string_including(*snippets)
        )
      end
    end
  end
end

Version data entries

7,390 entries across 7,303 versions & 127 rubygems

Version Path
cvss-suite-1.0.8 vendor/cache/ruby/2.2.0/gems/rspec-expectations-3.4.0/lib/rspec/matchers/fail_matchers.rb
tdiary-5.0.2 vendor/bundle/gems/rspec-expectations-3.5.0/lib/rspec/matchers/fail_matchers.rb
logstash-filter-delta-1.1.0 vendor/bundle/jruby/2.2.0/gems/rspec-expectations-3.5.0/lib/rspec/matchers/fail_matchers.rb
logstash-filter-delta-1.0.1 vendor/bundle/jruby/2.2.0/gems/rspec-expectations-3.5.0/lib/rspec/matchers/fail_matchers.rb
logstash-filter-base64-1.0.4 vendor/bundle/jruby/2.2.0/gems/rspec-expectations-3.5.0/lib/rspec/matchers/fail_matchers.rb
logstash-filter-base64-1.0.3 vendor/bundle/jruby/2.2.0/gems/rspec-expectations-3.5.0/lib/rspec/matchers/fail_matchers.rb
logstash-filter-delta-1.0.0 vendor/bundle/jruby/2.2.0/gems/rspec-expectations-3.5.0/lib/rspec/matchers/fail_matchers.rb
logstash-filter-base64-1.0.2 vendor/bundle/jruby/2.3.0/gems/rspec-expectations-3.5.0/lib/rspec/matchers/fail_matchers.rb
logstash-filter-base64-1.0.1 vendor/bundle/jruby/2.3.0/gems/rspec-expectations-3.5.0/lib/rspec/matchers/fail_matchers.rb
logstash-filter-base64-1.0.0 vendor/bundle/jruby/2.3.0/gems/rspec-expectations-3.5.0/lib/rspec/matchers/fail_matchers.rb
rspec-expectations-3.5.0 lib/rspec/matchers/fail_matchers.rb
tdiary-5.0.1 vendor/bundle/gems/rspec-expectations-3.4.0/lib/rspec/matchers/fail_matchers.rb
cvss-suite-1.0.7 vendor/cache/ruby/2.2.0/gems/rspec-expectations-3.4.0/lib/rspec/matchers/fail_matchers.rb
rspec-expectations-3.5.0.beta4 lib/rspec/matchers/fail_matchers.rb
guesswhat-1.1.0 vendor/bundle/gems/rspec-expectations-3.4.0/lib/rspec/matchers/fail_matchers.rb
guesswhat-1.0.1 vendor/bundle/gems/rspec-expectations-3.4.0/lib/rspec/matchers/fail_matchers.rb
guesswhat-1.0.0 vendor/bundle/gems/rspec-expectations-3.4.0/lib/rspec/matchers/fail_matchers.rb
guesswhat-0.1.0 vendor/bundle/gems/rspec-expectations-3.4.0/lib/rspec/matchers/fail_matchers.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/rspec-expectations-3.4.0/lib/rspec/matchers/fail_matchers.rb
cvss-suite-1.0.6 vendor/cache/ruby/2.2.0/gems/rspec-expectations-3.4.0/lib/rspec/matchers/fail_matchers.rb