debian-mirror-gitlab/spec/tooling/docs/deprecation_handling_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1,023 B
Ruby
Raw Normal View History

2022-03-02 08:16:31 +05:30
# frozen_string_literal: true
2022-04-04 11:22:00 +05:30
require 'spec_helper'
2022-03-02 08:16:31 +05:30
require_relative '../../../tooling/docs/deprecation_handling'
RSpec.describe Docs::DeprecationHandling do
let(:type) { 'deprecation' }
subject { described_class.new(type).render }
before do
allow(Rake::FileList).to receive(:new).and_return(
['14-10-c.yml', '14-2-b.yml', '14-2-a.yml']
)
# Create dummy YAML data based on file name
allow(YAML).to receive(:load_file) do |file_name|
{
2023-03-04 22:38:38 +05:30
'title' => file_name[/[a-z]*\.yml/],
2022-03-02 08:16:31 +05:30
'announcement_milestone' => file_name[/\d+-\d+/].tr('-', '.')
}
end
end
it 'sorts entries and milestones' do
allow_next_instance_of(ERB) do |template|
expect(template).to receive(:result_with_hash) do |arguments|
milestones = arguments[:milestones]
entries = arguments[:entries]
2022-05-07 20:08:51 +05:30
expect(milestones).to eq(['14.10', '14.2'])
2023-03-04 22:38:38 +05:30
expect(entries.map { |e| e['title'] }).to eq(['a.yml', 'b.yml', 'c.yml'])
2022-03-02 08:16:31 +05:30
end
end
subject
end
end