Clearing the entire Redis cache may be too expensive; just use

the repository expire_cache method
This commit is contained in:
Stan Hu 2015-07-21 18:52:56 -07:00
parent dc5504812d
commit 5aff5223d4
1 changed files with 2 additions and 6 deletions

View File

@ -13,13 +13,9 @@ describe API::API, api: true do
let!(:branch_sha) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' } let!(:branch_sha) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' }
describe "GET /projects/:id/repository/branches" do 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 it "should return an array of project branches" do
project.repository.expire_cache
get api("/projects/#{project.id}/repository/branches", user) get api("/projects/#{project.id}/repository/branches", user)
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(json_response).to be_an Array expect(json_response).to be_an Array