2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
require 'fast_spec_helper'
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
RSpec.describe Gitlab::ChangesList, feature_category: :source_code_management do
|
2016-09-13 17:45:13 +05:30
|
|
|
let(:valid_changes_string) { "\n000000 570e7b2 refs/heads/my_branch\nd14d6c 6fd24d refs/heads/master" }
|
|
|
|
let(:invalid_changes) { 1 }
|
|
|
|
|
|
|
|
context 'when changes is a valid string' do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:changes_list) { described_class.new(valid_changes_string) }
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
it 'splits elements by newline character' do
|
|
|
|
expect(changes_list).to contain_exactly({
|
|
|
|
oldrev: "000000",
|
|
|
|
newrev: "570e7b2",
|
|
|
|
ref: "refs/heads/my_branch"
|
|
|
|
}, {
|
|
|
|
oldrev: "d14d6c",
|
|
|
|
newrev: "6fd24d",
|
|
|
|
ref: "refs/heads/master"
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'behaves like a list' do
|
|
|
|
expect(changes_list.first).to eq({
|
|
|
|
oldrev: "000000",
|
|
|
|
newrev: "570e7b2",
|
|
|
|
ref: "refs/heads/my_branch"
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|