Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard::Jasmine::CLI: making specdoc an option instead of forced to :always #72

Merged
merged 1 commit into from
Aug 3, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/guard/jasmine/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class CLI < Thor
:default => 'failure',
:desc => 'Whether to show errors in the spec runner, either `always`, `never` or `failure`'

method_option :specdoc,
:type => :string,
:default => :always,
:desc => 'Whether to show successes in the spec runner, either `always`, `never` or `failure`'

method_option :server_env,
:type => :string,
:aliases => '-e',
Expand Down Expand Up @@ -98,6 +103,7 @@ def spec(*paths)
runner[:spec_dir] = options.spec_dir
runner[:console] = [:always, :never, :failure].include?(options.console.to_sym) ? options.console.to_sym : :failure
runner[:errors] = [:always, :never, :failure].include?(options.errors.to_sym) ? options.errors.to_sym : :failure
runner[:specdoc] = [:always, :never, :failure].include?(options.specdoc.to_sym) ? options.specdoc.to_sym : :always
runner[:server] = options.server.to_sym
runner[:focus] = options.focus

Expand All @@ -106,7 +112,6 @@ def spec(*paths)
runner[:hide_success] = true

runner[:max_error_notify] = 0
runner[:specdoc] = :always

if CLI.phantomjs_bin_valid?(runner[:phantomjs_bin])
::Guard::Jasmine::Server.start(runner[:server], runner[:port], runner[:server_env], runner[:spec_dir]) unless runner[:server] == :none
Expand Down
16 changes: 11 additions & 5 deletions spec/guard/jasmine/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,17 @@
runner.should_receive(:run).with(anything(), hash_including(:server_env => 'test')).and_return [true, []]
cli.start(['spec'])
end

it 'sets the specdoc to always by default' do
runner.should_receive(:run).with(anything(), hash_including(:specdoc => :always)).and_return [true, []]
cli.start(['spec'])
end

it 'sets the specdoc to failure' do
runner.should_receive(:run).with(anything(), hash_including(:specdoc => :failure)).and_return [true, []]
cli.start(['spec', '--specdoc', 'failure'])
end

end
end

Expand All @@ -171,11 +182,6 @@
runner.should_receive(:run).with(anything(), hash_including(:max_error_notify => 0)).and_return [true, []]
cli.start(['spec'])
end

it 'sets the specdoc to always' do
runner.should_receive(:run).with(anything(), hash_including(:specdoc => :always)).and_return [true, []]
cli.start(['spec'])
end
end

context 'without a valid phantomjs executable' do
Expand Down