diff --git a/lib/simplecov.rb b/lib/simplecov.rb index 5a47df30..c490bdd2 100644 --- a/lib/simplecov.rb +++ b/lib/simplecov.rb @@ -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 diff --git a/lib/simplecov/result.rb b/lib/simplecov/result.rb index f79cfb19..dc9e386e 100644 --- a/lib/simplecov/result.rb +++ b/lib/simplecov/result.rb @@ -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 diff --git a/lib/simplecov/result_adapter.rb b/lib/simplecov/result_adapter.rb index 79cf8e6f..996c8d31 100644 --- a/lib/simplecov/result_adapter.rb +++ b/lib/simplecov/result_adapter.rb @@ -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 diff --git a/spec/helper.rb b/spec/helper.rb index 44fbf0f4..e747a5eb 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -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