Sha256: 5c5d3d1b6c04b0b1201a430f3e0b7150507911b881474159b75566b6805d2b32

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 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

5 entries across 5 versions & 1 rubygems

Version Path
config_curator-0.2.0 spec/units/symlink_spec.rb
config_curator-0.1.1 spec/units/symlink_spec.rb
config_curator-0.1.0 spec/units/symlink_spec.rb
config_curator-0.0.2 spec/units/symlink_spec.rb
config_curator-0.0.1 spec/units/symlink_spec.rb