2017-01-18 13:31:19 -08:00
|
|
|
# frozen_string_literal: true
|
2017-03-26 17:19:44 -07:00
|
|
|
|
2017-01-02 21:28:12 -08:00
|
|
|
require 'json'
|
|
|
|
require 'open-uri'
|
|
|
|
require 'spec_helper'
|
|
|
|
require 'yaml'
|
|
|
|
|
2017-01-18 13:31:19 -08:00
|
|
|
describe 'ruby version' do
|
2017-01-02 21:28:12 -08:00
|
|
|
pages_versions = JSON.parse(open('https://pages.github.com/versions.json').read)
|
|
|
|
pages_ruby_version = pages_versions['ruby']
|
|
|
|
|
2020-09-11 16:51:31 -04:00
|
|
|
ci_config_file = '.github/workflows/test.yml'
|
2017-01-02 21:28:12 -08:00
|
|
|
ci_config = YAML.load_file(ci_config_file)
|
2020-09-11 16:51:31 -04:00
|
|
|
ci_ruby_version = ci_config['jobs']['test']['steps'][1]['with']['ruby-version']
|
2017-01-02 21:28:12 -08:00
|
|
|
|
2017-01-03 10:18:27 -08:00
|
|
|
context "in #{ci_config_file} and pages ruby version" do
|
|
|
|
it 'match' do
|
2017-01-04 08:53:18 -08:00
|
|
|
msg = "#{ci_ruby_version} != #{pages_ruby_version}; please add a commit bumping in #{ci_config_file}"
|
2017-01-02 21:28:12 -08:00
|
|
|
expect(ci_ruby_version).to eql(pages_ruby_version), msg
|
|
|
|
end
|
|
|
|
end
|
2017-01-18 13:31:19 -08:00
|
|
|
|
|
|
|
rubocop_config_file = '.rubocop.yml'
|
|
|
|
rubocop_config = YAML.load_file(rubocop_config_file)
|
|
|
|
rubocop_ruby_version = rubocop_config['AllCops']['TargetRubyVersion']
|
|
|
|
pages_ruby_version_minor = pages_ruby_version.match('^(\d+)\.(\d+)')[0]
|
|
|
|
|
|
|
|
context "in #{rubocop_config_file} and pages ruby minor version" do
|
|
|
|
it 'match' do
|
|
|
|
msg = "#{rubocop_ruby_version} != #{pages_ruby_version_minor}; please add a commit bumping in #{rubocop_config_file}"
|
|
|
|
expect(rubocop_ruby_version.to_s).to eql(pages_ruby_version_minor), msg
|
|
|
|
end
|
|
|
|
end
|
2017-01-02 21:28:12 -08:00
|
|
|
end
|