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

Fix couldn't find HOME #482

Merged
merged 1 commit into from
Jan 26, 2017
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
2 changes: 1 addition & 1 deletion lib/simplecov/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

# Autoload config from ~/.simplecov if present
require "etc"
home_dir = File.expand_path("~") || Etc.getpwuid.dir || (ENV["USER"] && File.expand_path("~#{ENV['USER']}"))
home_dir = (ENV["HOME"] && File.expand_path("~")) || Etc.getpwuid.dir || (ENV["USER"] && File.expand_path("~#{ENV['USER']}"))
if home_dir
global_config_path = File.join(home_dir, ".simplecov")
load global_config_path if File.exist?(global_config_path)
Expand Down
17 changes: 17 additions & 0 deletions spec/config_loader_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require "helper"

describe "loading config" do
context "without ENV[HOME]" do
before do
@home = ENV.delete("HOME")
end

after do
ENV["HOME"] = @home
end

it "shouldn't raise any errors" do
expect { require "simplecov/defaults" }.not_to raise_error
end
end
end