diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-06-28 10:02:57 +0000 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-06-28 10:02:57 +0000 |
commit | 2321b337f1487031e2cab8e1a4e778f3aaf8e2da (patch) | |
tree | 09ac0a7fe65e4da93f873e4b8cf02b57cd359791 /spec/requests | |
parent | 1012cfb0b780bc9348a8478a66af2a337a69b0f6 (diff) | |
parent | d78f7ceac94abe0e8318c6472fc5f7967325a74f (diff) | |
download | gitlab-ce-2321b337f1487031e2cab8e1a4e778f3aaf8e2da.tar.gz |
Merge branch 'graphql-tree-last-commit' into 'master'
Added commit type to tree GraphQL type
See merge request gitlab-org/gitlab-ce!29412
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/graphql/project/tree/tree_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/requests/api/graphql/project/tree/tree_spec.rb b/spec/requests/api/graphql/project/tree/tree_spec.rb index b07aa1e12d3..94128cc21ee 100644 --- a/spec/requests/api/graphql/project/tree/tree_spec.rb +++ b/spec/requests/api/graphql/project/tree/tree_spec.rb @@ -33,6 +33,12 @@ describe 'getting a tree in a project' do expect(graphql_data['project']['repository']['tree']['submodules']['edges']).to eq([]) expect(graphql_data['project']['repository']['tree']['blobs']['edges']).to eq([]) end + + it 'returns null commit' do + post_graphql(query, current_user: current_user) + + expect(graphql_data['project']['repository']['last_commit']).to be_nil + end end context 'when ref does not exist' do @@ -45,6 +51,12 @@ describe 'getting a tree in a project' do expect(graphql_data['project']['repository']['tree']['submodules']['edges']).to eq([]) expect(graphql_data['project']['repository']['tree']['blobs']['edges']).to eq([]) end + + it 'returns null commit' do + post_graphql(query, current_user: current_user) + + expect(graphql_data['project']['repository']['last_commit']).to be_nil + end end context 'when ref and path exist' do @@ -61,6 +73,12 @@ describe 'getting a tree in a project' do expect(graphql_data['project']['repository']['tree']['blobs']['edges'].size).to be > 0 expect(graphql_data['project']['repository']['tree']['submodules']['edges'].size).to be > 0 end + + it 'returns tree latest commit' do + post_graphql(query, current_user: current_user) + + expect(graphql_data['project']['repository']['tree']['lastCommit']).to be_present + end end context 'when current user is nil' do |