Commit e5d89c10 authored by Robert Speicher's avatar Robert Speicher

Remove unnecessary current_user context from filter specs

parent 21cacb36
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment