summaryrefslogtreecommitdiff
path: root/spec/requests/team_members_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/team_members_spec.rb')
-rw-r--r--spec/requests/team_members_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/requests/team_members_spec.rb b/spec/requests/team_members_spec.rb
new file mode 100644
index 00000000000..db7513ae956
--- /dev/null
+++ b/spec/requests/team_members_spec.rb
@@ -0,0 +1,46 @@
+require 'spec_helper'
+
+describe "TeamMembers" do
+ before do
+ login_as :user
+ @project = Factory :project
+ @project.add_access(@user, :read, :admin)
+ end
+
+ describe "New Team member", :js => true do
+ before do
+ @user_1 = Factory :user
+ visit team_project_path(@project)
+ click_link "Add new"
+ end
+
+ it "should open new team member popup" do
+ page.should have_content("Add new member to project")
+ end
+
+ describe "fill in" do
+ before do
+ check "team_member_read"
+ click_link "Select user"
+ click_link @user_1.name
+ #select @user_1.name, :from => "team_member_user_id"
+ end
+
+ it { expect { click_button "Save" }.to change {UsersProject.count}.by(1) }
+
+ it "should add new member to table" do
+ click_button "Save"
+
+ page.should_not have_content("Add new member")
+ page.should have_content @user_1.name
+ end
+ end
+ end
+
+ describe "Cancel membership" do
+ it "should cancel membership" do
+ visit team_project_path(@project)
+ expect { click_link "Cancel" }.to change { UsersProject.count }.by(-1)
+ end
+ end
+end