diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-27 00:08:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-27 00:08:51 +0300 |
commit | 757d2fda7e2936b071a4cb600046ca375051d7c5 (patch) | |
tree | 76673008cb2e31c1df8705d0388fd3cabdd79d2d /spec/graphql | |
parent | ebe92e84a92d7d00710a6c5017ef2bb160268471 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql')
-rw-r--r-- | spec/graphql/resolvers/last_commit_resolver_spec.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/graphql/resolvers/last_commit_resolver_spec.rb b/spec/graphql/resolvers/last_commit_resolver_spec.rb index c891445c1ff..5ac6ad59864 100644 --- a/spec/graphql/resolvers/last_commit_resolver_spec.rb +++ b/spec/graphql/resolvers/last_commit_resolver_spec.rb @@ -4,8 +4,10 @@ require 'spec_helper' RSpec.describe Resolvers::LastCommitResolver do include GraphqlHelpers + include RepoHelpers - let(:repository) { create(:project, :repository).repository } + let(:project) { create(:project, :repository) } + let(:repository) { project.repository } let(:tree) { repository.tree(ref, path) } let(:commit) { resolve(described_class, obj: tree) } @@ -29,6 +31,28 @@ RSpec.describe Resolvers::LastCommitResolver do end end + context 'last commit for a wildcard pathspec' do + let(:ref) { 'fix' } + let(:path) { 'files/*' } + + it 'returns nil' do + expect(commit).to be_nil + end + end + + context 'last commit with pathspec characters' do + let(:ref) { 'fix' } + let(:path) { ':wq' } + + before do + create_file_in_repo(project, ref, ref, path, 'Test file') + end + + it 'resolves commit' do + expect(commit).to eq(repository.commits(ref, path: path, limit: 1).last) + end + end + context 'last commit does not exist' do let(:ref) { 'master' } let(:path) { 'does-not-exist' } |