File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,10 @@ class Binstub < Command
13
13
# should cause the "unsprung" version of the command to run.
14
14
LOADER = <<CODE
15
15
begin
16
- load File.expand_path('../spring', __FILE__)
17
- rescue LoadError
16
+ spring_bin_path = File.expand_path('../spring', __FILE__)
17
+ load spring_bin_path
18
+ rescue LoadError => e
19
+ raise unless e.message.end_with? spring_bin_path, 'spring/binstub'
18
20
end
19
21
CODE
20
22
Original file line number Diff line number Diff line change @@ -208,13 +208,22 @@ def exec_name
208
208
assert_success "bin/rake -T" , stdout : "rake db:migrate"
209
209
end
210
210
211
- test "binstub when spring is uninstalled " do
211
+ test "binstub when spring gem is missing " do
212
212
without_gem "spring-#{ Spring ::VERSION } " do
213
213
File . write ( app . gemfile , app . gemfile . read . gsub ( /gem 'spring.*/ , "" ) )
214
214
assert_success "bin/rake -T" , stdout : "rake db:migrate"
215
215
end
216
216
end
217
217
218
+ test "binstub when spring binary is missing" do
219
+ begin
220
+ File . rename ( app . path ( "bin/spring" ) , app . path ( "bin/spring.bak" ) )
221
+ assert_success "bin/rake -T" , stdout : "rake db:migrate"
222
+ ensure
223
+ File . rename ( app . path ( "bin/spring.bak" ) , app . path ( "bin/spring" ) )
224
+ end
225
+ end
226
+
218
227
test "binstub upgrade" do
219
228
File . write ( app . path ( "bin/rake" ) , <<-RUBY . strip_heredoc )
220
229
#!/usr/bin/env ruby
You can’t perform that action at this time.
0 commit comments