Skip to content

Commit

Permalink
Fix server start from the CLI. (Fixes #84)
Browse files Browse the repository at this point in the history
  • Loading branch information
netzpirat committed Oct 17, 2012
1 parent e62053c commit edb13ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
7 changes: 6 additions & 1 deletion lib/guard/jasmine/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class CLI < Thor
:default => 15,
:desc => 'The number of seconds to wait for the Jasmine spec server'

method_option :rackup_config,
:type => :string,
:aliases => '-c',
:desc => 'The rackup config to use (jasminerice only)'

method_option :bin,
:type => :string,
:aliases => '-b',
Expand Down Expand Up @@ -118,7 +123,7 @@ def spec(*paths)
runner_options[:max_error_notify] = 0

if CLI.phantomjs_bin_valid?(runner_options[:phantomjs_bin])
::Guard::Jasmine::Server.start(runner_options[:server], runner_options[:port], runner_options[:server_env], runner_options[:spec_dir]) unless runner_options[:server] == :none
::Guard::Jasmine::Server.start(runner_options) unless runner_options[:server] == :none

if CLI.runner_available?(runner_options)
result = ::Guard::Jasmine::Runner.run(paths, runner_options)
Expand Down
23 changes: 10 additions & 13 deletions spec/guard/jasmine/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,17 @@

describe '.spec' do
context 'with specified options' do
context 'for the server' do
it 'sets the server type' do
server.should_receive(:start).with(:thin, 3001, 'test', 'spec/javascripts')
cli.start(['spec', '--server', 'thin'])
end

it 'sets the server port' do
server.should_receive(:start).with(:auto, 4321, 'test', 'spec/javascripts')
cli.start(['spec', '--port', '4321'])
context 'with the server set to :none' do
it 'does not start the server' do
server.should_not_receive(:start)
cli.start(['spec', '--server', 'none'])
end
end

it 'sets the spec dir' do
server.should_receive(:start).with(:auto, 4321, 'test', 'specs')
cli.start(['spec', '--port', '4321', '-d', 'specs'])
context 'without the server set to :none' do
it 'starts the server' do
server.should_receive(:start).with(hash_including(:server => :thin))
cli.start(['spec', '--server', 'thin'])
end
end

Expand Down Expand Up @@ -98,7 +95,7 @@
context 'without specified options' do
context 'for the server' do
it 'sets the server type' do
server.should_receive(:start).with(:auto, 3001 , 'test', 'spec/javascripts')
server.should_receive(:start).with(hash_including(:server => :auto))
cli.start(['spec'])
end
end
Expand Down

0 comments on commit edb13ed

Please sign in to comment.