Sha256: 58c310a63bd528cc0a9ad5c302b7b5f46b2c78a1bb868cb2d5fe902a88992b7a

Contents?: true

Size: 1.24 KB

Versions: 70

Compression:

Stored size: 1.24 KB

Contents

require "fileutils"
require "pathname"
require "tmpdir"

require "vagrant-spec/components"

describe Vagrant::Spec::Components do
  let(:paths) { [Pathname.new(Dir.mktmpdir)] }

  subject { described_class.new(paths) }

  before do
    # Force instantiation
    subject
  end

  after do
    paths.each do |path|
      FileUtils.rmtree(path)
    end
  end

  describe "components" do
    it "should have no components to start" do
      expect(subject.components).to be_empty
    end

    it "can load the components" do
      paths[0].join("foo_spec.rb").open("w") do |f|
        f.write(<<-CONTENT)
describe "foo", component: "foo" do
end
        CONTENT
      end

      subject.reload!
      expect(subject.components).to eql(["foo"])
    end
  end

  describe "provider_features" do
    it "has none by default" do
      expect(subject.provider_features).to be_empty
    end

    it "loads features" do
      random = "#{Time.now.to_i}-#{Random.rand(1000)}"
      paths[0].join("shared_foo_spec.rb").open("w") do |f|
        f.write(<<-CONTENT)
shared_examples "#{random}" do
end

shared_examples "provider/#{random}-bar" do
end
        CONTENT
      end

      subject.reload!
      expect(subject.provider_features).to eql(["#{random}-bar"])
    end
  end
end

Version data entries

70 entries across 21 versions & 1 rubygems

Version Path
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/spec/components_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/spec/components_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-03d88fe24677/spec/components_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/spec/components_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/spec/components_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/spec/components_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/spec/components_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/spec/components_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/spec/components_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/spec/components_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/spec/components_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/spec/components_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-03d88fe24677/spec/components_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/spec/components_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/spec/components_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/spec/components_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/spec/components_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/spec/components_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/spec/components_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/spec/components_spec.rb