diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2019-03-20 20:23:23 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2019-03-20 20:33:49 +0300 |
commit | 732f892db308863f2a2db736949c94ae9d613678 (patch) | |
tree | ebd669db3075e46f733dd348d2d95be624a586d2 /spec/requests/api/projects_spec.rb | |
parent | 37bd7aa6beffd1567dadcb4fff8167d050deabd8 (diff) |
Return cached languages if they've been detected before
Diffstat (limited to 'spec/requests/api/projects_spec.rb')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 60d9d7fed13..fdbb78b8829 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -13,12 +13,18 @@ shared_examples 'languages and percentages JSON response' do ) end - it 'returns expected language values' do - get api("/projects/#{project.id}/languages", user) + context "when the languages haven't been detected yet" do + it 'returns expected language values' do + get api("/projects/#{project.id}/languages", user) + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response).to eq({}) - expect(response).to have_gitlab_http_status(:ok) - expect(json_response).to eq(expected_languages) - expect(json_response.count).to be > 1 + get api("/projects/#{project.id}/languages", user) + + expect(response).to have_gitlab_http_status(:ok) + expect(JSON.parse(response.body)).to eq(expected_languages) + end end context 'when the languages were detected before' do |