diff options
Diffstat (limited to 'spec/controllers/projects/commits_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/commits_controller_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/controllers/projects/commits_controller_spec.rb b/spec/controllers/projects/commits_controller_spec.rb index fd840fafa61..c7f98406201 100644 --- a/spec/controllers/projects/commits_controller_spec.rb +++ b/spec/controllers/projects/commits_controller_spec.rb @@ -88,6 +88,26 @@ RSpec.describe Projects::CommitsController do expect(response).to be_successful end + + context 'when limit is a hash' do + it 'uses the default limit' do + expect_any_instance_of(Repository).to receive(:commits).with( + "master", + path: "README.md", + limit: described_class::COMMITS_DEFAULT_LIMIT, + offset: 0 + ).and_call_original + + get(:show, params: { + namespace_id: project.namespace, + project_id: project, + id: id, + limit: { 'broken' => 'value' } + }) + + expect(response).to be_successful + end + end end context "when the ref name ends in .atom" do @@ -131,6 +151,20 @@ RSpec.describe Projects::CommitsController do expect(response.media_type).to eq('text/html') end end + + context 'when the ref does not exist' do + before do + get(:show, params: { + namespace_id: project.namespace, + project_id: project, + id: 'unknown.atom' + }) + end + + it 'returns 404 page' do + expect(response).to be_not_found + end + end end end |