Fix random failing tests with project teams

This commit is contained in:
Dmitriy Zaporozhets 2013-06-19 19:38:43 +03:00
parent 6e35aceff2
commit d274ca3888
2 changed files with 5 additions and 19 deletions

View file

@ -1,6 +1,6 @@
- user = member.user
- allow_admin = current_user_can_admin_project
%li{id: dom_id(user), class: "team_member_row user_#{user.id}"}
%li{id: dom_id(user), class: "team_member_row access-#{member.human_access.downcase}"}
.pull-right
- if allow_admin
.pull-left

View file

@ -30,35 +30,27 @@ class ProjectTeamManagement < Spinach::FeatureSteps
end
Then 'I should see "Mike" in team list as "Reporter"' do
user = User.find_by_name("Mike")
within "#user_#{user.id}" do
within ".access-reporter" do
page.should have_content('Mike')
page.find('#team_member_project_access').value.should == access_value(:reporter)
end
end
Given 'I should see "Sam" in team list as "Developer"' do
user = User.find_by_name("Sam")
within "#user_#{user.id}" do
within ".access-developer" do
page.should have_content('Sam')
page.find('#team_member_project_access').value.should == access_value(:developer)
end
end
And 'I change "Sam" role to "Reporter"' do
user = User.find_by_name("Sam")
within ".user_#{user.id}" do
within "#user_#{user.id}" do
select "Reporter", from: "team_member_project_access"
end
end
And 'I should see "Sam" in team list as "Reporter"' do
user = User.find_by_name("Sam")
within ".user_#{user.id}" do
within ".access-reporter" do
page.should have_content('Sam')
page.find('#team_member_project_access').value.should == access_value(:reporter)
end
end
@ -111,10 +103,4 @@ class ProjectTeamManagement < Spinach::FeatureSteps
click_link('Remove user from team')
end
end
private
def access_value(key)
UsersProject.roles_hash[key].to_s
end
end