summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-09-02 23:45:42 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-09-02 23:54:40 -0400
commite5d89c1084d1c1f29bfabe50718debf8867f760e (patch)
tree4a57b43e392842195ca449fd1198898956e7fd15 /spec
parent21cacb36a728dd6e1d1bee77680a1c78645d1765 (diff)
downloadgitlab-ce-e5d89c1084d1c1f29bfabe50718debf8867f760e.tar.gz
Remove unnecessary current_user context from filter specs
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/markdown/cross_project_reference_spec.rb24
-rw-r--r--spec/lib/gitlab/markdown/user_reference_filter_spec.rb11
2 files changed, 11 insertions, 24 deletions
diff --git a/spec/lib/gitlab/markdown/cross_project_reference_spec.rb b/spec/lib/gitlab/markdown/cross_project_reference_spec.rb
index 6490d6f7a42..8d4f9e403a6 100644
--- a/spec/lib/gitlab/markdown/cross_project_reference_spec.rb
+++ b/spec/lib/gitlab/markdown/cross_project_reference_spec.rb
@@ -2,20 +2,16 @@ require 'spec_helper'
module Gitlab::Markdown
describe CrossProjectReference do
- # context in the html-pipeline sense, not in the rspec sense
- let(:context) do
- {
- current_user: double('user'),
- project: double('project')
- }
- end
-
include described_class
describe '#project_from_ref' do
context 'when no project was referenced' do
it 'returns the project from context' do
- expect(project_from_ref(nil)).to eq context[:project]
+ project = double
+
+ allow(self).to receive(:context).and_return({ project: project })
+
+ expect(project_from_ref(nil)).to eq project
end
end
@@ -26,17 +22,13 @@ module Gitlab::Markdown
end
context 'when referenced project exists' do
- let(:project2) { double('referenced project') }
+ it 'returns the referenced project' do
+ project2 = double('referenced project')
- before do
expect(Project).to receive(:find_with_namespace).
with('cross/reference').and_return(project2)
- end
- context 'and the user has permission to read it' do
- it 'returns the referenced project' do
- expect(project_from_ref('cross/reference')).to eq project2
- end
+ expect(project_from_ref('cross/reference')).to eq project2
end
end
end
diff --git a/spec/lib/gitlab/markdown/user_reference_filter_spec.rb b/spec/lib/gitlab/markdown/user_reference_filter_spec.rb
index d3028cd3b88..c206cf4b745 100644
--- a/spec/lib/gitlab/markdown/user_reference_filter_spec.rb
+++ b/spec/lib/gitlab/markdown/user_reference_filter_spec.rb
@@ -80,20 +80,15 @@ module Gitlab::Markdown
context 'mentioning a group' do
let(:group) { create(:group) }
- let(:user) { create(:user) }
let(:reference) { group.to_reference }
- before do
- group.add_developer(user)
- end
-
it 'links to the Group' do
- doc = filter("Hey #{reference}", current_user: user)
+ doc = filter("Hey #{reference}")
expect(doc.css('a').first.attr('href')).to eq urls.group_url(group)
end
it 'includes a data-group-id attribute' do
- doc = filter("Hey #{reference}", current_user: user)
+ doc = filter("Hey #{reference}")
link = doc.css('a').first
expect(link).to have_attribute('data-group-id')
@@ -101,7 +96,7 @@ module Gitlab::Markdown
end
it 'adds to the results hash' do
- result = pipeline_result("Hey #{reference}", current_user: user)
+ result = pipeline_result("Hey #{reference}")
expect(result[:references][:user]).to eq group.users
end
end