Sha256: d0578662f06108e07e061775ddc63b9bd3b5b3be240afe74509aac0c85779390

Contents?: true

Size: 1.08 KB

Versions: 96

Compression:

Stored size: 1.08 KB

Contents

module Vagrant
  module Spec
    # OutputTester tests text for output by checking against a global
    # registry of testers in the $output global variable. If the tester
    # returns true, then it matches, otherwise it doesn't match.
    #
    # Additional testers can be added to the $output global hash. They
    # should be callables that take at least one argument: the text to check.
    # They can take additional arguments that will just be forwarded through
    # if they're passed to {matches?}.
    class OutputTester
      @@testers = {}

      # Tests if the output tester with the name "name" matches the given
      # text.
      #
      # @return [Boolean]
      def self.matches?(text, name, *args)
        callable = @@testers[name]
        if !callable
          raise ArgumentError, "Unknown output matcher: #{name}"
        end

        callable.call(text, *args)
      end

      # Add a tester.
      def self.[]=(key, value)
        @@testers[key] = value
      end

      # Delete a tester by name.
      def self.delete(key)
        @@testers.delete(key)
      end
    end
  end
end

Version data entries

96 entries across 29 versions & 2 rubygems

Version Path
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-03d88fe24677/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-03d88fe24677/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/lib/vagrant-spec/acceptance/output.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/lib/vagrant-spec/acceptance/output.rb