2011-10-08 17:36:38 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "TeamMembers" do
|
2011-10-26 09:46:25 -04:00
|
|
|
before do
|
2011-10-08 17:36:38 -04:00
|
|
|
login_as :user
|
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :read, :admin)
|
|
|
|
end
|
|
|
|
|
2011-10-21 08:56:37 -04:00
|
|
|
describe "View profile" do
|
|
|
|
it "should be available" do
|
|
|
|
visit(team_project_path(@project))
|
2011-10-26 09:46:25 -04:00
|
|
|
within "#team-table" do
|
2011-10-25 00:32:02 -04:00
|
|
|
click_link(@user.name)
|
|
|
|
end
|
2011-10-21 08:56:37 -04:00
|
|
|
page.should have_content @user.skype
|
|
|
|
page.should_not have_content 'Twitter'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-01-19 02:27:23 -05:00
|
|
|
describe "New Team member" do
|
2011-10-26 09:46:25 -04:00
|
|
|
before do
|
2011-10-08 17:36:38 -04:00
|
|
|
@user_1 = Factory :user
|
|
|
|
visit team_project_path(@project)
|
2012-01-11 02:35:21 -05:00
|
|
|
click_link "New Team Member"
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
it "should open new team member popup" do
|
2012-01-14 12:54:41 -05:00
|
|
|
page.should have_content("New Team member")
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
describe "fill in" do
|
2011-10-08 17:36:38 -04:00
|
|
|
before do
|
2011-12-07 03:04:57 -05:00
|
|
|
within "#team_member_new" do
|
|
|
|
select @user_1.name, :from => "team_member_user_id"
|
|
|
|
select "Report", :from => "team_member_project_access"
|
|
|
|
select "Pull", :from => "team_member_repo_access"
|
2011-10-21 15:44:08 -04:00
|
|
|
end
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
|
2011-10-21 15:44:08 -04:00
|
|
|
it { expect { click_button "Save";sleep(1) }.to change {UsersProject.count}.by(1) }
|
2011-10-08 17:36:38 -04:00
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
it "should add new member to table" do
|
2011-10-08 17:36:38 -04:00
|
|
|
click_button "Save"
|
2011-10-21 15:44:08 -04:00
|
|
|
@member = UsersProject.last
|
2011-10-08 17:36:38 -04:00
|
|
|
|
|
|
|
page.should have_content @user_1.name
|
2011-10-21 15:44:08 -04:00
|
|
|
|
2011-12-07 03:04:57 -05:00
|
|
|
@member.reload
|
|
|
|
@member.project_access.should == Project::PROJECT_RW
|
|
|
|
@member.repo_access.should == Repository::REPO_R
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
describe "Cancel membership" do
|
|
|
|
it "should cancel membership" do
|
2011-10-08 17:36:38 -04:00
|
|
|
visit team_project_path(@project)
|
|
|
|
expect { click_link "Cancel" }.to change { UsersProject.count }.by(-1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|