2011-10-08 23:36:38 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Projects" do
|
|
|
|
before { login_as :user }
|
|
|
|
|
|
|
|
describe "GET /projects/tree" do
|
|
|
|
describe "head" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :read)
|
|
|
|
|
2011-11-16 06:58:53 +01:00
|
|
|
visit tree_project_ref_path(@project, @project.root_ref)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
2011-11-16 06:58:53 +01:00
|
|
|
current_path.should == tree_project_ref_path(@project, @project.root_ref)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like :tree_view
|
|
|
|
end
|
|
|
|
|
|
|
|
describe ValidCommit::ID do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :read)
|
|
|
|
|
2011-11-16 06:58:53 +01:00
|
|
|
visit tree_project_ref_path(@project, ValidCommit::ID)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
2011-11-16 06:58:53 +01:00
|
|
|
current_path.should == tree_project_ref_path(@project, ValidCommit::ID)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like :tree_view
|
|
|
|
it_behaves_like :project_side_pane
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "branch passed" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :read)
|
|
|
|
|
2011-11-16 06:58:53 +01:00
|
|
|
visit tree_project_ref_path(@project, @project.root_ref)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
2011-11-16 06:58:53 +01:00
|
|
|
current_path.should == tree_project_ref_path(@project, @project.root_ref)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like :tree_view
|
|
|
|
it_behaves_like :project_side_pane
|
|
|
|
end
|
|
|
|
|
|
|
|
# TREE FILE PREVIEW
|
|
|
|
describe "file preview" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :read)
|
|
|
|
|
2012-03-13 22:54:49 +01:00
|
|
|
visit tree_project_ref_path(@project, @project.root_ref, :path => "Gemfile")
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
2011-11-16 06:58:53 +01:00
|
|
|
current_path.should == tree_project_ref_path(@project, @project.root_ref)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should contain file view" do
|
2012-03-13 22:54:49 +01:00
|
|
|
page.should have_content("rubygems.org")
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-10-26 15:46:25 +02:00
|
|
|
# RAW FILE
|
2011-10-08 23:36:38 +02:00
|
|
|
describe "GET /projects/blob" do
|
2011-10-26 15:46:25 +02:00
|
|
|
before do
|
2011-10-08 23:36:38 +02:00
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :read)
|
|
|
|
|
2011-11-16 06:58:53 +01:00
|
|
|
visit blob_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should be correct path" do
|
2011-11-16 06:58:53 +01:00
|
|
|
current_path.should == blob_project_ref_path(@project, ValidCommit::ID)
|
2011-10-08 23:36:38 +02:00
|
|
|
end
|
|
|
|
|
2011-10-26 15:46:25 +02:00
|
|
|
it "raw file response" do
|
2011-10-08 23:36:38 +02:00
|
|
|
page.source.should == ValidCommit::BLOB_FILE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|