Sha256: 1e3e710dfe9ec445357d0364906d4fe5a41bf12da4ce3b6782a83687b85de6aa

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

require "spec_helper"

module JstdRunner
  describe CLI do
    let(:runner) { mock(Runner, :options => {}) }
    before { Runner.stub!(:new).and_return(runner) }

    def cli(str = '')
      CLI.new(str.split(" "))
    end

    it "configures the port" do
      cli "--port 1234"
      runner.options[:port].should == 1234
    end

    it "configures VNC" do
      cli "--vnc"
      runner.options[:vnc].should be_true
    end

    it "configures the monitoring interval" do
      cli "--monitor 10"
      runner.options[:monitor_interval].should == 10
    end

    it "configures the browser type" do
      cli "--browser chrome"
      runner.options[:browser].should == :chrome
    end

    it "configures daemonization" do
      cli "--daemonize /foo/bar"
      runner.options[:daemonize].should == "/foo/bar"
    end

    it "configures email notifications" do
      cli "--notify a@b.com,x@y.com"
      runner.options[:emails].should == %w[a@b.com x@y.com]
    end

    it "delegates to the runner when run" do
      runner.should_receive(:run)
      cli.run
    end

    it "configures restarts" do
      cli "--restart 01:15"
      runner.options[:restart_at].should == "01:15"
    end

    it "configures whitelists" do
      cli "--whitelist 127.0.0.1,192.168.41.41"
      runner.options[:whitelist].should == ["127.0.0.1", "192.168.41.41"]
    end
    
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jstd-runner-0.0.9 spec/jstd-runner/cli_spec.rb