Commit ae9f0ca8 authored by winniehell's avatar winniehell

Add failing test for #20462

parent c009f620
...@@ -20,7 +20,11 @@ describe BranchesFinder do ...@@ -20,7 +20,11 @@ describe BranchesFinder do
result = branches_finder.execute result = branches_finder.execute
expect(result.first.name).to eq('crlf-diff') recently_updated_branch = repository.branches.max do |a, b|
repository.commit(a.target).committed_date <=> repository.commit(b.target).committed_date
end
expect(result.first.name).to eq(recently_updated_branch.name)
end end
it 'sorts by last_updated' do it 'sorts by last_updated' do
......
...@@ -479,13 +479,16 @@ end ...@@ -479,13 +479,16 @@ end
describe Projects::NetworkController, 'routing' do describe Projects::NetworkController, 'routing' do
it 'to #show' do it 'to #show' do
expect(get('/gitlab/gitlabhq/network/master')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master') expect(get('/gitlab/gitlabhq/network/master')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master')
expect(get('/gitlab/gitlabhq/network/master.json')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master', format: 'json') expect(get('/gitlab/gitlabhq/network/ends-with.json')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'ends-with.json')
expect(get('/gitlab/gitlabhq/network/master?format=json')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master', format: 'json')
end end
end end
describe Projects::GraphsController, 'routing' do describe Projects::GraphsController, 'routing' do
it 'to #show' do it 'to #show' do
expect(get('/gitlab/gitlabhq/graphs/master')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master') expect(get('/gitlab/gitlabhq/graphs/master')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master')
expect(get('/gitlab/gitlabhq/graphs/ends-with.json')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'ends-with.json')
expect(get('/gitlab/gitlabhq/graphs/master?format=json')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master', format: 'json')
end end
end end
......
...@@ -6,6 +6,7 @@ module TestEnv ...@@ -6,6 +6,7 @@ module TestEnv
# When developing the seed repository, comment out the branch you will modify. # When developing the seed repository, comment out the branch you will modify.
BRANCH_SHA = { BRANCH_SHA = {
'empty-branch' => '7efb185', 'empty-branch' => '7efb185',
'ends-with.json' => '98b0d8b3',
'flatten-dir' => 'e56497b', 'flatten-dir' => 'e56497b',
'feature' => '0b4bc9a', 'feature' => '0b4bc9a',
'feature_conflict' => 'bb5206f', 'feature_conflict' => 'bb5206f',
......
require 'spec_helper'
describe 'projects/tree/show' do
include Devise::TestHelpers
let(:project) { create(:project) }
let(:repository) { project.repository }
before do
assign(:project, project)
assign(:repository, repository)
allow(view).to receive(:can?).and_return(true)
allow(view).to receive(:can_collaborate_with_project?).and_return(true)
end
context 'for branch names ending on .json' do
let(:ref) { 'ends-with.json' }
let(:commit) { repository.commit(ref) }
let(:path) { '' }
let(:tree) { repository.tree(commit.id, path) }
before do
assign(:ref, ref)
assign(:commit, commit)
assign(:id, commit.id)
assign(:tree, tree)
assign(:path, path)
end
it 'displays correctly' do
render
expect(rendered).to have_css('.js-project-refs-dropdown .dropdown-toggle-text', text: ref)
expect(rendered).to have_css('.readme-holder .file-content', text: ref)
end
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