Sha256: 210374c91f2261309e63c847baceb8d8b691d0005726e02b8d4c20887907fff8

Contents?: true

Size: 738 Bytes

Versions: 3

Compression:

Stored size: 738 Bytes

Contents

module AcceptanceTests
  module Matchers
    # rubocop:disable Naming/PredicateName
    def have_output(output)
      HaveOutputMatcher.new(output)
    end
    # rubocop:enable Naming/PredicateName

    class HaveOutputMatcher
      def initialize(output)
        @output = output
      end

      def matches?(runner)
        @runner = runner
        runner.has_output?(output)
      end

      def failure_message
        "Expected command to have output, but did not.\n\n" +
          "Command: #{runner.formatted_command}\n\n" +
          "Expected output:\n" +
          output.inspect + "\n\n" +
          "Actual output:\n" +
          runner.output
      end

      protected

      attr_reader :output, :runner
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shoulda-4.0.0 test/support/acceptance/matchers/have_output.rb
shoulda-4.0.0.rc2 test/support/acceptance/matchers/have_output.rb
shoulda-4.0.0.rc1 test/support/acceptance/matchers/have_output.rb