Skip to content

Commit

Permalink
Make sure file names are always added as symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Jan 17, 2020
1 parent 0c33f1a commit 5061173
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/simplecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def add_not_loaded_files(result)
result = result.dup
Dir[tracked_files].each do |file|
absolute_path = File.expand_path(file)
result[absolute_path] ||= SimulateCoverage.call(absolute_path)
result[absolute_path.to_sym] ||= SimulateCoverage.call(absolute_path)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/simplecov/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def self.from_hash(hash)
private

def coverage
keys = original_result.keys & filenames
keys = original_result.keys & filenames.map(&:to_sym)
Hash[keys.zip(original_result.values_at(*keys))]
end

Expand Down
4 changes: 2 additions & 2 deletions lib/simplecov/result_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def adapt

result.each_with_object({}) do |(file_name, cover_statistic), adapted_result|
if cover_statistic.is_a?(Array)
adapted_result.merge!(file_name => {lines: cover_statistic})
adapted_result.merge!(file_name.to_sym => {lines: cover_statistic})
else
adapted_result.merge!(file_name => cover_statistic)
adapted_result.merge!(file_name.to_sym => cover_statistic)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
SimpleCov.coverage_dir("tmp/coverage")

def source_fixture(filename)
File.expand_path(File.join(File.dirname(__FILE__), "fixtures", filename))
File.expand_path(File.join(File.dirname(__FILE__), "fixtures", filename)).to_sym
end

# Taken from http://stackoverflow.com/questions/4459330/how-do-i-temporarily-redirect-stderr-in-ruby
Expand Down

0 comments on commit 5061173

Please sign in to comment.