Sha256: 52db6931c880846344db4b1a1b24b349a70f77508a6c01de5b731a7141278aa2

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

require 'spec_helper'

describe Jobim::Application, fakefs: true do

  describe '::run' do
    before(:each) do
      Jobim::Server.stub(:start!)
      $stdout.stub(:write)
      $stderr.stub(:write)
    end

    it 'exits on --help command flag' do
      expect { Jobim::Application.run('--help') }.to raise_error SystemExit
    end

    it 'exits on --version command flags' do
      expect { Jobim::Application.run('--version') }.to raise_error SystemExit
    end

    it 'starts the server' do
      expect(Jobim::Server).to receive(:start!)
      Jobim::Application.run
    end

    it 'catches InvalidOption and reports to stderr' do
      expect($stderr).to receive(:write)
      Jobim::Application.run('--foo')
    end

    it 'catches RuntimeError and reports to stderr' do
      expect($stderr).to receive(:write)
      Jobim::Server.unstub(:start!)
      Jobim::Application.run('--port', '1')
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jobim-0.6.0 spec/jobim_application_spec.rb