Sha256: e51e36f8c178a8d8e198d892c4203b6852b0b743d19b016ffb51562f1feaf81a

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

require "vagrant-spec/acceptance/output"

module Vagrant
  module Spec
    # Default plugins within plugin list when run mode
    # is set as "plugin"
    DEFAULT_PLUGINS = ["vagrant-share".freeze].freeze

    # Tests the Vagrant plugin list output has no plugins
    OutputTester[:plugin_list_none] = lambda do |text|
      if Vagrant::Spec::Acceptance.config.run_mode == "plugin"
        valid = DEFAULT_PLUGINS.all? do |plugin_name|
          text.include?(plugin_name)
        end
        if valid
          valid = !text.lines.any? do |line|
            !line.start_with?(" ") &&
              !DEFAULT_PLUGINS.include?(line.split(/\s/).first)
          end
        end
        valid
      else
        text =~ /^No plugins/
      end
    end

    # Tests that plugin list shows a plugin
    OutputTester[:plugin_list_plugin] = lambda do |text, name, version|
      text =~ /^#{name} \(#{version}\)$/
    end

    # Tests that Vagrant plugin install fails to a plugin not found
    OutputTester[:plugin_install_not_found] = lambda do |text, name|
      text =~ /Unable to resolve dependency:.* '#{name}/
    end

    # Tests that Vagrant plugin install fails to a plugin not found
    OutputTester[:plugin_installed] = lambda do |text, name, version|
      if version.nil?
        text =~ /^Installed the plugin '#{name} \(/
      else
        text =~ /^Installed the plugin '#{name} \(#{version}\)'/
      end
    end

  end
end

Version data entries

6 entries across 5 versions & 1 rubygems

Version Path
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-af86757912f7/acceptance/output/plugin_output.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-af86757912f7/acceptance/output/plugin_output.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-af86757912f7/acceptance/output/plugin_output.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-af86757912f7/acceptance/output/plugin_output.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-af86757912f7/acceptance/output/plugin_output.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-af86757912f7/acceptance/output/plugin_output.rb