Skip to content

Commit

Permalink
テストで消すファイルがないときのエラーに対応した
Browse files Browse the repository at this point in the history
```
  1) HealthCheck /custom_route_prefix works with smtp server and valid custom_check
     Failure/Error: FileUtils.rm(CUSTOM_CHECK_FILE_PATH)

     Errno::ENOENT:
       No such file or directory @ unlink_internal - spec/dummy/tmp/custom_file
     # ./spec/spec_helper.rb:35:in `ensure in enable_custom_check'
     # ./spec/spec_helper.rb:35:in `enable_custom_check'
     # ./spec/health_check_spec.rb:6:in `block (3 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # Errno::ENOENT:
     #   No such file or directory @ rb_sysopen - spec/dummy/tmp/custom_file
     #   ./spec/spec_helper.rb:32:in `write'
```
  • Loading branch information
willnet committed Oct 31, 2024
1 parent c70e127 commit ae53a2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ def enable_custom_check(&block)
File.write(CUSTOM_CHECK_FILE_PATH, 'hello')
block.call
ensure
FileUtils.rm(CUSTOM_CHECK_FILE_PATH)
FileUtils.rm(CUSTOM_CHECK_FILE_PATH) if File.exist?(CUSTOM_CHECK_FILE_PATH)
end

0 comments on commit ae53a2b

Please sign in to comment.