spec/spec_helper.rb in licensee-9.11.0 vs spec/spec_helper.rb in licensee-9.12.0

- old
+ new

@@ -1,8 +1,10 @@ -require 'coveralls' -Coveralls.wear! +# frozen_string_literal: true +require 'simplecov' +SimpleCov.start + require 'licensee' require 'open3' require 'tmpdir' require 'mustache' require 'yaml' @@ -25,10 +27,17 @@ def fixtures_base File.expand_path 'spec/fixtures', project_root end +def fixtures + @fixtures ||= begin + dirs = Dir["#{fixtures_base}/*"].select { |e| File.directory?(e) } + dirs.map { |path| File.basename(path) }.sort_by { |k, _v| k } + end +end + def fixture_path(fixture) File.expand_path fixture, fixtures_base end def fixture_contents(fixture) @@ -47,10 +56,14 @@ path: File.basename(file) } end.to_json end +def fixture_licenses + @fixture_licenses ||= YAML.load_file(fixture_path('fixtures.yml')) +end + def field_values { fullname: 'Ben Balter', year: '2018', email: 'ben@github.invalid', @@ -88,10 +101,10 @@ `git commit -m 'initial commit'` end end def format_percent(float) - "#{format('%.2f', float)}%" + "#{format('%<float>.2f', float: float)}%" end def meta_fields path = 'vendor/choosealicense.com/_data/meta.yml' path = File.expand_path(path, project_root)