gitlab-org--gitlab-foss/spec/requests/team_members_spec.rb

59 lines
1.5 KiB
Ruby
Raw Normal View History

2011-10-08 17:36:38 -04:00
require 'spec_helper'
describe "TeamMembers" do
before do
2011-10-08 17:36:38 -04:00
login_as :user
@project = Factory :project
@project.add_access(@user, :read, :admin)
end
describe "View profile" do
it "should be available" do
visit(team_project_path(@project))
2012-01-29 17:43:14 -05:00
click_link(@user.name)
page.should have_content @user.skype
page.should_not have_content 'Twitter'
end
end
describe "New Team member" do
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
it "should open new team member popup" do
page.should have_content("New Team member")
2011-10-08 17:36:38 -04:00
end
describe "fill in" do
2011-10-08 17:36:38 -04:00
before do
2012-02-11 13:34:25 -05:00
within "#new_team_member" do
2011-12-07 03:04:57 -05:00
select @user_1.name, :from => "team_member_user_id"
2012-02-16 02:03:55 -05:00
select "Reporter", :from => "team_member_project_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
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
2012-02-16 02:03:55 -05:00
@member.project_access.should == UsersProject::REPORTER
2011-10-08 17:36:38 -04:00
end
end
end
describe "Cancel membership" do
it "should cancel membership" do
2012-01-29 17:43:14 -05:00
visit project_team_member_path(@project, @project.users_projects.last)
expect { click_link "Remove from team" }.to change { UsersProject.count }.by(-1)
2011-10-08 17:36:38 -04:00
end
end
end