diff options
author | Stan Hu <stanhu@gmail.com> | 2015-07-20 16:55:45 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-07-21 14:12:43 -0700 |
commit | 643557dabccbb3a503b0867ae44ec5701759d2a8 (patch) | |
tree | d50c3315b5e4a7461deac389a09a3aceb5b60e03 /spec/requests | |
parent | 57f9a1ccd4e97747cf09ffd98e8c44056c0846e5 (diff) | |
download | gitlab-ce-643557dabccbb3a503b0867ae44ec5701759d2a8.tar.gz |
Fix 404 error in files view after deleting the last file in a repository
Closes #1362
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/branches_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index cb6e5e89625..bb3862c9eb2 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -13,11 +13,18 @@ describe API::API, api: true do let!(:branch_sha) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' } describe "GET /projects/:id/repository/branches" do + before do + # Ensure that repository.branch_names is cleared from the cache at start to ensure + # the list matches reality + Rails.cache.clear + end + it "should return an array of project branches" do get api("/projects/#{project.id}/repository/branches", user) expect(response.status).to eq(200) expect(json_response).to be_an Array - expect(json_response.first['name']).to eq(project.repository.branch_names.first) + branch_names = json_response.map { |x| x['name'] } + expect(branch_names).to match_array(project.repository.branch_names) end end |