Skip to content

Commit

Permalink
Fixin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dzaporozhets committed Jun 18, 2013
1 parent 48019f1 commit 4e5b3d9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/views/admin/groups/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
.span6
.ui-box
%h5.title
Add user to the group:
Add user(s):
.ui-box-body.form-holder
%p.light
Read more about project permissions
Expand All @@ -77,7 +77,7 @@
%div.prepend-top-10
= select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span2"}
%hr
= submit_tag 'Add user to the group', class: "btn btn-create"
= submit_tag 'Add users into group', class: "btn btn-create"
.ui-box
%h5.title
Users from #{@group.name} Group
Expand Down
2 changes: 1 addition & 1 deletion features/steps/admin/admin_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AdminGroups < Spinach::FeatureSteps
within "#new_team_member" do
select "Reporter", from: "project_access"
end
click_button "Add user to projects in group"
click_button "Add users into group"
end

Then 'I should see "John" in team list in every project as "Reporter"' do
Expand Down
20 changes: 17 additions & 3 deletions features/steps/project/project_team_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@ class ProjectTeamManagement < Spinach::FeatureSteps
end

Then 'I should see "Mike" in team list as "Reporter"' do
within '.reporters' do
user = User.find_by_name("Mike")

within "#user_#{user.id}" 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
within '.developers' do
user = User.find_by_name("Sam")

within "#user_#{user.id}" do
page.should have_content('Sam')
page.find('#team_member_project_access').value.should == access_value(:developer)
end
end

Expand All @@ -49,8 +55,10 @@ class ProjectTeamManagement < Spinach::FeatureSteps
end

And 'I should see "Sam" in team list as "Reporter"' do
within '.reporters' do
user = User.find_by_name("Sam")
within ".user_#{user.id}" do
page.should have_content('Sam')
page.find('#team_member_project_access').value.should == access_value(:reporter)
end
end

Expand Down Expand Up @@ -103,4 +111,10 @@ 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

0 comments on commit 4e5b3d9

Please sign in to comment.