Sha256: c68a394ed37ffdefc4bc1d87e7e12f280949fc3b3b2eaf454061d2512d9fafe8

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe RdiffSimple do
  describe '#execute' do
    context 'when no arguments are given' do
      it 'should return false' do
        subject.execute.should be_false
      end
    end

    context 'when arguments are given' do
      it 'should return true' do
        subject.execute('--version').should be_true
      end
    end

    context 'when rdiff-backup is not installed' do
      before(:each) do
        mock_rdiff_installed(false)
      end

      it 'should be false' do
        expect { subject.execute('--version') }.should raise_error(RdiffSimple::NotInstalledError)
      end
    end
  end

  describe '#installed?' do
    context 'when rdiff-backup is installed' do
      before(:each) do
        mock_rdiff_installed(true)
      end

      it 'should be true' do
        subject.installed?.should be_true
      end
    end

    context 'when rdiff-backup is not installed' do
      before(:each) do
        mock_rdiff_installed(false)
      end

      it 'should be false' do
        subject.installed?.should be_false
      end
    end
  end

  def mock_rdiff_installed(value)
    subject
    .should_receive(:system)
    .with('which rdiff-backup')
    .and_return(value)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rdiff-simple-0.0.4 spec/rdiff_simple_spec.rb