gitlabhq/spec/requests/admin/admin_projects_spec.rb

77 lines
1.7 KiB
Ruby
Raw Normal View History

2011-10-08 23:36:38 +02:00
require 'spec_helper'
describe "Admin::Projects" do
before do
2012-11-23 20:31:09 +01:00
@project = create(:project)
2011-10-08 23:36:38 +02:00
login_as :admin
end
describe "GET /admin/projects" do
before do
2011-10-08 23:36:38 +02:00
visit admin_projects_path
end
it "should be ok" do
current_path.should == admin_projects_path
end
it "should have projects list" do
2011-10-08 23:36:38 +02:00
page.should have_content(@project.name)
end
end
describe "GET /admin/projects/:id" do
before do
2011-10-08 23:36:38 +02:00
visit admin_projects_path
2011-11-22 08:55:01 +01:00
click_link "#{@project.name}"
2011-10-08 23:36:38 +02:00
end
it "should have project info" do
2012-11-23 20:31:09 +01:00
page.should have_content(@project.path)
2011-10-08 23:36:38 +02:00
page.should have_content(@project.name)
end
end
describe "GET /admin/projects/:id/edit" do
before do
2011-10-08 23:36:38 +02:00
visit admin_projects_path
click_link "edit_project_#{@project.id}"
end
it "should have project edit page" do
page.should have_content("Edit project")
page.should have_button("Save Project")
2011-10-08 23:36:38 +02:00
end
describe "Update project" do
before do
fill_in "project_name", with: "Big Bang"
2012-07-27 23:42:44 +02:00
click_button "Save Project"
2011-10-08 23:36:38 +02:00
@project.reload
end
it "should show page with new data" do
2011-10-08 23:36:38 +02:00
page.should have_content("Big Bang")
end
it "should change project entry" do
2011-10-08 23:36:38 +02:00
@project.name.should == "Big Bang"
end
end
end
2012-10-05 16:01:44 +02:00
describe "Add new team member" do
before do
@new_user = create(:user)
2012-02-11 18:56:18 +01:00
visit admin_project_path(@project)
end
2012-10-05 16:01:44 +02:00
it "should create new user" do
select @new_user.name, from: "user_ids"
2012-02-11 18:56:18 +01:00
expect { click_button "Add" }.to change { UsersProject.count }.by(1)
page.should have_content @new_user.name
current_path.should == admin_project_path(@project)
end
end
2011-10-08 23:36:38 +02:00
end