Commit de9beca2a8cbb713ab0273c38cfc3cef9d08f97c

Authored by Diego Araújo
1 parent 4b258550
Exists in colab and in 2 other branches master, stable

Make RepositoryController#index show only public repositories

app/controllers/repositories_controller.rb
... ... @@ -14,7 +14,7 @@ class RepositoriesController < ApplicationController
14 14 skip_before_action :verify_authenticity_token, :only => [:notify_push]
15 15  
16 16 def index
17   - @repositories = Repository.all
  17 + @repositories = Repository.public_or_owned_by_user(current_user)
18 18 end
19 19  
20 20 # GET /projects/1/repositories/1
... ...
spec/controllers/repositories_controller_spec.rb
... ... @@ -5,7 +5,7 @@ describe RepositoriesController, :type => :controller do
5 5 let!(:repository) { FactoryGirl.build(:repository) }
6 6  
7 7 before :each do
8   - Repository.expects(:all).returns([repository])
  8 + Repository.expects(:public_or_owned_by_user).returns([repository])
9 9 get :index
10 10 end
11 11  
... ...