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/extracts_ref_spec.rb')
-rw-r--r--spec/lib/extracts_ref_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/extracts_ref_spec.rb b/spec/lib/extracts_ref_spec.rb
new file mode 100644
index 00000000000..1867f639711
--- /dev/null
+++ b/spec/lib/extracts_ref_spec.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ExtractsRef do
+ include described_class
+ include RepoHelpers
+
+ let_it_be(:owner) { create(:user) }
+ let_it_be(:container) { create(:snippet, :repository, author: owner) }
+ let(:ref) { sample_commit[:id] }
+ let(:params) { { path: sample_commit[:line_code_path], ref: ref } }
+
+ before do
+ ref_names = ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0', 'release/app', 'release/app/v1.0.0']
+
+ allow(container.repository).to receive(:ref_names).and_return(ref_names)
+ allow_any_instance_of(described_class).to receive(:repository_container).and_return(container)
+ end
+
+ it_behaves_like 'assigns ref vars'
+ it_behaves_like 'extracts refs'
+end