Skip to content

Commit

Permalink
Do not output running spring status for commands with prefix 'spring'
Browse files Browse the repository at this point in the history
  • Loading branch information
sonalkr132 committed Dec 13, 2015
1 parent ac943a0 commit 652d544
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions bin/spring
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ end
lib = File.expand_path("../../lib", __FILE__)
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib) # enable local development
require 'spring/client'
# if the user knows that spring is called, do not show that running spring
Spring.verbose_output = false if $0.include? 'spring'
Spring::Client.run(ARGV)
19 changes: 15 additions & 4 deletions lib/spring/test/acceptance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ def assert_failure(command, expected_output = nil)
assert_output artifacts, expected_output if expected_output
end

def assert_not_include(command, not_expected)
artifacts = app.run(*Array(command))
not_expected.each do |stream, output|
assert !artifacts[stream].include?(output),
"expected #{stream} to not include '#{output}'.\n\n#{app.debug(artifacts)}"
end
end

def assert_speedup(ratio = DEFAULT_SPEEDUP)
if ENV['CI']
yield
Expand Down Expand Up @@ -94,17 +102,20 @@ def without_gem(name)
refute app.spring_env.server_running?
end

test "output running spring by default" do
test "running spring status for rails/rake commands" do
assert_success "bin/rails runner ''", stdout: "Running Spring [client]"
assert_success app.spring_test_command, stdout: "Running Spring [client]"
end

test "running spring status for spring commands" do
assert_not_include "spring rails runner ''", stdout: 'Running Spring [client]'
assert_not_include "spring rake test", stdout: "Running Spring [client]"
end

test "changing verbose output" do
File.write("#{app.user_home}/.spring.rb", "Spring.verbose_output = false\nSpring.watch_interval = 0.3")
assert_success "bin/rails runner ''"
artifacts = app.run("bin/rails runner ''")
assert !artifacts[:stdout].include?("Running Spring [client]"),
"expected stdout to not include 'Running Spring [client]'.\n\n#{app.debug(artifacts)}"
assert_not_include "bin/rails runner ''", stdout: 'Running Spring [client]'
end

test "test changes are picked up" do
Expand Down

0 comments on commit 652d544

Please sign in to comment.