Sha256: 69c4528eadb00510b82d0225ebef9cb0de3fb4a0e9e142eb0e40b40478e4a9f3

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe ConfigCurator::Symlink do
  subject(:symlink) { ConfigCurator::Symlink.new }

  describe "#install" do
    context "when symbolic link should be installed" do
      it "installs the symbolic link and returns true" do
        expect(symlink).to receive(:install?).and_return true
        expect(symlink).to receive(:install_symlink)
        expect(symlink.install).to be true
      end
    end

    context "when symbolic link should not be installed" do
      it "does not install the symbolic link and returns false" do
        expect(symlink).to receive(:install?).and_return false
        expect(symlink).to_not receive(:install_symlink)
        expect(symlink.install).to be false
      end
    end
  end

  describe "#install?" do
    context "when source not given" do
      it "fails" do
        symlink.destination = 'link_path'
        expect { symlink.install? }.to raise_error ConfigCurator::Symlink::InstallFailed
      end
    end

    context "when destination not given" do
      it "fails" do
        symlink.source = 'file'
        expect { symlink.install? }.to raise_error ConfigCurator::Symlink::InstallFailed
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
config_curator-0.2.4 spec/units/symlink_spec.rb
config_curator-0.2.3 spec/units/symlink_spec.rb
config_curator-0.2.2 spec/units/symlink_spec.rb
config_curator-0.2.1 spec/units/symlink_spec.rb