2021-03-08 18:12:59 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
require 'fast_spec_helper'
|
2021-03-08 18:12:59 +05:30
|
|
|
|
|
|
|
RSpec.describe Gitlab::Git::ChangedPath do
|
|
|
|
subject(:changed_path) { described_class.new(path: path, status: status) }
|
|
|
|
|
|
|
|
let(:path) { 'test_path' }
|
|
|
|
|
|
|
|
describe '#new_file?' do
|
|
|
|
subject(:new_file?) { changed_path.new_file? }
|
|
|
|
|
|
|
|
context 'when it is a new file' do
|
|
|
|
let(:status) { :ADDED }
|
|
|
|
|
|
|
|
it 'returns true' do
|
|
|
|
expect(new_file?).to eq(true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when it is not a new file' do
|
|
|
|
let(:status) { :MODIFIED }
|
|
|
|
|
|
|
|
it 'returns false' do
|
|
|
|
expect(new_file?).to eq(false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|