Sha256: 5c310a10f92bf9e360039dedd08a1408a53f734cc9705cc98f318786fe405b45

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 Bytes

Contents

require "test_helper"

describe Controller do
  let(:cntrl) { Controller.instance }
  let(:regexp) { '.*\.rb' }

  def setup
    G.init({}, [])
  end

  def teardown
    cntrl.stop
  end

  it "stops" do
    cntrl.stop
    assert_nil cntrl.listener
  end

  it "runs" do
    assert_raises(Timeout::Error) do
      Timeout.timeout(0.1) { cntrl.run }
    end

    assert cntrl.listener
  end

  it "read .watchr" do
    assert_raises(Timeout::Error) do
      Timeout.timeout(0.1) { cntrl.run }
    end
  end

  it "run" do
    G.script = Script.new "watch('#{regexp}') { raise IOError }"

    assert_raises(IOError) { cntrl.file_run "a.rb" }
  end

  it "does not run" do
    G.script = Script.new "watch('#{regexp}') { raise IOError }"

    cntrl.file_run "a.no"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cuco-0.1.1 test/controller_test.rb