Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/git/changed_path_spec.rb')
-rw-r--r--spec/lib/gitlab/git/changed_path_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/changed_path_spec.rb b/spec/lib/gitlab/git/changed_path_spec.rb
new file mode 100644
index 00000000000..93db107ad5c
--- /dev/null
+++ b/spec/lib/gitlab/git/changed_path_spec.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+require "spec_helper"
+
+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