Sha256: 07196c280eb3c92f6cc6ba454a2b945c7d8e5e198ad8841b7995f2697ce62ddb

Contents?: true

Size: 1.24 KB

Versions: 95

Compression:

Stored size: 1.24 KB

Contents

require "vagrant-spec/acceptance/output"

describe Vagrant::Spec::OutputTester do
  subject { described_class }

  let(:registry) { described_class }

  it "raises an exception if the matcher doesn't exist" do
    expect { subject.matches?("foo", :i_dont_exist) }.
      to raise_error(ArgumentError)
  end

  context "with a basic matcher" do
    before do
      registry[:test] = lambda do |text|
        text == "foo"
      end
    end

    after do
      registry.delete(:test)
    end

    it "should match with good input" do
      expect(described_class.matches?("foo", :test)).to be_truthy
    end

    it "should not match with bad output" do
      expect(described_class.matches?("bar", :test)).to_not be_truthy
    end
  end

  context "with a matcher with args" do
    before do
      registry[:test] = lambda do |text, compare|
        text == compare
      end
    end

    after do
      registry.delete(:test)
    end

    it "should match with good input" do
      expect(described_class.matches?("foo", :test, "foo")).to be_truthy
      expect(described_class.matches?("bar", :test, "bar")).to be_truthy
    end

    it "should not match with bad output" do
      expect(described_class.matches?("bar", :test, "foo")).to_not be_truthy
    end
  end
end

Version data entries

95 entries across 28 versions & 1 rubygems

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