3 describe Projects::TreeController do
4 let(:project) { create(:project_with_code) }
5 let(:user) { create(:user) }
10 project.team << [user, :master]
12 project.stub(:branches).and_return(['master', 'foo/bar/baz'])
13 project.stub(:tags).and_return(['v1.0.0', 'v2.0.0'])
14 controller.instance_variable_set(:@project, project)
17 describe "GET show" do
18 # Make sure any errors accessing the tree in our views bubble up to this spec
21 before { get :show, project_id: project.to_param, id: id }
23 context "valid branch, no path" do
25 it { should respond_with(:success) }
28 context "valid branch, valid path" do
29 let(:id) { 'master/app/' }
30 it { should respond_with(:success) }
33 context "valid branch, invalid path" do
34 let(:id) { 'master/invalid-path/' }
35 it { should respond_with(:not_found) }
38 context "invalid branch, valid path" do
39 let(:id) { 'invalid-branch/app/' }
40 it { should respond_with(:not_found) }