summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/reference_extractor_spec.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-04-15 16:01:00 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-04-25 14:40:12 -0400
commit8f8a8ab32bca8fdc79d7a5115eabbd015dd44c02 (patch)
treea241bf1002d3ec0f92122f9ec22d14b6879441a1 /spec/lib/gitlab/reference_extractor_spec.rb
parenta6defd157641b102c9ea4cabe99f0a386d661d80 (diff)
downloadgitlab-ce-8f8a8ab32bca8fdc79d7a5115eabbd015dd44c02.tar.gz
Refactor ReferenceExtractor to use pipeline filters
Diffstat (limited to 'spec/lib/gitlab/reference_extractor_spec.rb')
-rw-r--r--spec/lib/gitlab/reference_extractor_spec.rb74
1 files changed, 0 insertions, 74 deletions
diff --git a/spec/lib/gitlab/reference_extractor_spec.rb b/spec/lib/gitlab/reference_extractor_spec.rb
index 0f4ea2a24ed..e339f378d54 100644
--- a/spec/lib/gitlab/reference_extractor_spec.rb
+++ b/spec/lib/gitlab/reference_extractor_spec.rb
@@ -4,80 +4,6 @@ describe Gitlab::ReferenceExtractor do
let(:project) { create(:project) }
subject { Gitlab::ReferenceExtractor.new(project, project.creator) }
- it 'extracts username references' do
- subject.analyze('this contains a @user reference')
- expect(subject.references[:user]).to eq([[project, 'user']])
- end
-
- it 'extracts issue references' do
- subject.analyze('this one talks about issue #1234')
- expect(subject.references[:issue]).to eq([[project, '1234']])
- end
-
- it 'extracts JIRA issue references' do
- subject.analyze('this one talks about issue JIRA-1234')
- expect(subject.references[:issue]).to eq([[project, 'JIRA-1234']])
- end
-
- it 'extracts merge request references' do
- subject.analyze("and here's !43, a merge request")
- expect(subject.references[:merge_request]).to eq([[project, '43']])
- end
-
- it 'extracts snippet ids' do
- subject.analyze('snippets like $12 get extracted as well')
- expect(subject.references[:snippet]).to eq([[project, '12']])
- end
-
- it 'extracts commit shas' do
- subject.analyze('commit shas 98cf0ae3 are pulled out as Strings')
- expect(subject.references[:commit]).to eq([[project, '98cf0ae3']])
- end
-
- it 'extracts commit ranges' do
- subject.analyze('here you go, a commit range: 98cf0ae3...98cf0ae4')
- expect(subject.references[:commit_range]).to eq([[project, '98cf0ae3...98cf0ae4']])
- end
-
- it 'extracts multiple references and preserves their order' do
- subject.analyze('@me and @you both care about this')
- expect(subject.references[:user]).to eq([
- [project, 'me'],
- [project, 'you']
- ])
- end
-
- it 'leaves the original note unmodified' do
- text = 'issue #123 is just the worst, @user'
- subject.analyze(text)
- expect(text).to eq('issue #123 is just the worst, @user')
- end
-
- it 'extracts no references for <pre>..</pre> blocks' do
- subject.analyze("<pre>def puts '#1 issue'\nend\n</pre>```")
- expect(subject.issues).to be_blank
- end
-
- it 'extracts no references for <code>..</code> blocks' do
- subject.analyze("<code>def puts '!1 request'\nend\n</code>```")
- expect(subject.merge_requests).to be_blank
- end
-
- it 'extracts no references for code blocks with language' do
- subject.analyze("this code:\n```ruby\ndef puts '#1 issue'\nend\n```")
- expect(subject.issues).to be_blank
- end
-
- it 'extracts issue references for invalid code blocks' do
- subject.analyze('test: ```this one talks about issue #1234```')
- expect(subject.references[:issue]).to eq([[project, '1234']])
- end
-
- it 'handles all possible kinds of references' do
- accessors = described_class::TYPES.map { |t| "#{t}s".to_sym }
- expect(subject).to respond_to(*accessors)
- end
-
it 'accesses valid user objects' do
@u_foo = create(:user, username: 'foo')
@u_bar = create(:user, username: 'bar')