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.6.1 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-abfc34474d12/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-abfc34474d12/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-abfc34474d12/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-abfc34474d12/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/spec/acceptance/shared/output_spec.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/spec/acceptance/shared/output_spec.rb