Commit 5f4c1308 authored by Gary Holtz's avatar Gary Holtz Committed by Andrew Fontaine

Moving spec to a view spec for cleaner code

parent 0ff446c5
......@@ -24,28 +24,6 @@ RSpec.describe 'listing forks of a project' do
end
end
context "when a fork is set to allow only project members to access features" do
let(:outside_user) { create(:user) }
before do
sign_in(outside_user)
allow_any_instance_of(ProjectsHelper).to receive(:able_to_see_last_commit?).and_return(false)
allow_any_instance_of(ProjectsHelper).to receive(:able_to_see_merge_requests?).and_return(false)
allow_any_instance_of(ProjectsHelper).to receive(:able_to_see_issues?).and_return(false)
end
it 'will not show that information in the original forks list' do
visit project_forks_path(source)
page.within('li.project-row') do
expect(page).not_to have_css('a.commit-row-message')
expect(page).not_to have_css('a.issues')
expect(page).not_to have_css('a.merge-requests')
end
end
end
it 'does not show the commit message when an external authorization service is used' do
enable_external_authorization_service_check
......
......@@ -20,6 +20,18 @@ RSpec.describe 'shared/projects/_list' do
expect(rendered).to have_content(project.name)
end
end
it "will not show elements a user shouldn't be able to see" do
allow(view).to receive(:able_to_see_last_commit?).and_return(false)
allow(view).to receive(:able_to_see_merge_requests?).and_return(false)
allow(view).to receive(:able_to_see_issues?).and_return(false)
render
expect(rendered).not_to have_css('a.commit-row-message')
expect(rendered).not_to have_css('a.issues')
expect(rendered).not_to have_css('a.merge-requests')
end
end
context 'without projects' do
......
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