Sha256: eed2fabd57e32c153c29bcedc0038b917363da994e03e2ff0b8e6dd0dbd902c2

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require 'fileutils'

describe Guard::Pumadev::Manager do
  let(:manager) { Guard::Pumadev::Manager.new }

  before {
    Guard::UI.stub(:info)
    Guard::Notifier.stub(:notify)
  }

  describe "#restart_pumadev" do

    context "without tmp dir" do
      before { FileUtils.rm_rf('tmp') }

      it "creates and removes tmp/restart.txt" do
        manager.restart
        expect(File.file?("tmp/restart.txt")).to be_falsey
      end
    end

    context "with tmp dir" do
      before {
        FileUtils.mkdir 'tmp' unless File.directory?("tmp")
        FileUtils.rm_rf('tmp/restart.txt')
      }

      it "creates tmp/restart.txt" do
        manager.restart
        expect(File.file?("tmp/restart.txt")).to be_falsey
      end
    end

    context "with tmp dir" do
      before {
        FileUtils.mkdir 'tmp' unless File.directory?("tmp")
        FileUtils.touch('tmp/restart.txt')
        sleep 1
      }

      it "touches tmp/restart.txt" do
        manager.restart
        expect(File.file?("tmp/restart.txt")).to be_falsey 
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
guard-pumadev-2.0.1 spec/lib/guard/pumadev/manager_spec.rb
guard-pumadev-2.0.0 spec/lib/guard/pumadev/manager_spec.rb