@@ -47,6 +47,14 @@ def assert_failure(command, expected_output = nil)
47
47
assert_output artifacts , expected_output if expected_output
48
48
end
49
49
50
+ def refute_output_includes ( command , not_expected )
51
+ artifacts = app . run ( *Array ( command ) )
52
+ not_expected . each do |stream , output |
53
+ assert !artifacts [ stream ] . include? ( output ) ,
54
+ "expected #{ stream } to not include '#{ output } '.\n \n #{ app . debug ( artifacts ) } "
55
+ end
56
+ end
57
+
50
58
def assert_speedup ( ratio = DEFAULT_SPEEDUP )
51
59
if ENV [ 'CI' ]
52
60
yield
@@ -94,6 +102,22 @@ def without_gem(name)
94
102
refute app . spring_env . server_running?
95
103
end
96
104
105
+ test "tells the user that spring is being used when used automatically via binstubs" do
106
+ assert_success "bin/rails runner ''" , stdout : "Running via Spring preloader in process"
107
+ assert_success app . spring_test_command , stdout : "Running via Spring preloader in process"
108
+ end
109
+
110
+ test "does not tell the user that spring is being used when the user used spring manually" do
111
+ refute_output_includes "spring rails runner ''" , stdout : "Running via Spring preloader in process"
112
+ refute_output_includes "spring rake test" , stdout : "Running via Spring preloader in process"
113
+ end
114
+
115
+ test "does not tell the user that spring is being used when used automatically via binstubs but quiet is enabled" do
116
+ File . write ( "#{ app . user_home } /.spring.rb" , "Spring.quiet = true" )
117
+ assert_success "bin/rails runner ''"
118
+ refute_output_includes "bin/rails runner ''" , stdout : 'Running via Spring preloader in process'
119
+ end
120
+
97
121
test "test changes are picked up" do
98
122
assert_speedup do
99
123
assert_success app . spring_test_command , stdout : "0 failures"
@@ -447,7 +471,7 @@ def exec_name
447
471
system(#{ app . env . inspect } , "bundle install")
448
472
end
449
473
output = `\# {Rails.root.join('bin/rails')} runner 'require "devise"; puts "done";'`
450
- exit output == "done\n "
474
+ exit output.include? "done\n "
451
475
RUBY
452
476
453
477
assert_success [ %(bin/rails runner 'load Rails.root.join("script.rb")') , timeout : 60 ]
0 commit comments