File: shell_spec.rb

package info (click to toggle)
ruby-guard-shell 0.7.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 96 kB
  • sloc: ruby: 104; makefile: 3
file content (48 lines) | stat: -rw-r--r-- 1,207 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require "guard/compat/test/helper"
require "guard/shell"

RSpec.describe Guard::Shell do
  describe "#start" do
    it "works" do
      subject.start
    end
  end

  describe "#stop" do
    it "works" do
      subject.stop
    end
  end

  describe "#run_all" do
    before do
      allow(Dir).to receive(:glob).and_return(%w(foo bar))
      allow(Guard::Compat).to receive(:matching_files).with(subject, %w(foo bar)).and_return(%w(bar))
    end

    it "delegates to run_on_modifications" do
      watcher = double('watcher')
      allow(watcher).to receive(:call_action).with([]).and_return('bar')

      allow_any_instance_of(described_class).to receive(:available_watchers).and_return([watcher])
      expect($stdout).to receive(:puts).with('bar')
      subject.run_all
    end
  end

  describe "#run_on_modifications" do
    it "outputs to the screen" do
      expect($stdout).to receive(:puts).with(%w(bar))
      subject.run_on_modifications(%w(bar))
    end
  end
end

RSpec.describe Guard::Dsl do
  describe '#n' do
    it "uses Guard to notify" do
      expect(Guard::Compat::UI).to receive(:notify).with('foo', title: 'bar', image: 'baz')
      subject.n('foo', 'bar', 'baz')
    end
  end
end