diff --git a/app/views/tasks/_add_member_accept_details.rhtml b/app/views/tasks/_add_member_accept_details.rhtml
index 8f586a3..71e5cee 100644
--- a/app/views/tasks/_add_member_accept_details.rhtml
+++ b/app/views/tasks/_add_member_accept_details.rhtml
@@ -1,7 +1,7 @@
<%= content = _("Roles:")+"
"
roles = Profile::Roles.organization_member_roles(task.target.environment.id)
roles.each do |role|
- content += labelled_check_box(role.name, "tasks[#{task.id}][roles][]", role.id, false)+"
"
+ content += labelled_check_box(role.name, "tasks[#{task.id}][task][roles][]", role.id, false)+"
"
end
content_tag('p', content, :class => 'member-classify-suggestion')
%>
diff --git a/features/accept_member.feature b/features/accept_member.feature
new file mode 100644
index 0000000..155145f
--- /dev/null
+++ b/features/accept_member.feature
@@ -0,0 +1,48 @@
+Feature: accept member
+ As an admin user
+ I want to accept a member request
+ In order to join a community
+
+ Background:
+ Given the following users
+ | login | name |
+ | mario | Mario Souto |
+ | marie | Marie Curie |
+ And the following community
+ | identifier | name |
+ | mycommunity | My Community |
+ And the community "My Community" is closed
+ And "Mario Souto" is admin of "My Community"
+
+ Scenario: approve a task to accept a member as admin in a closed community
+ Given "Marie Curie" asked to join "My Community"
+ And I am logged in as "mario"
+ And I go to My Community's control panel
+ And I follow "Process requests"
+ And I should see "Marie Curie wants to be a member"
+ When I choose "Accept"
+ And I check "Profile Administrator"
+ And I press "Apply!"
+ Then "Marie Curie" should be admin of "My Community"
+
+ Scenario: approve a task to accept a member as member in a closed community
+ Given "Marie Curie" asked to join "My Community"
+ And I am logged in as "mario"
+ And I go to My Community's control panel
+ And I follow "Process requests"
+ And I should see "Marie Curie wants to be a member"
+ When I choose "Accept"
+ And I check "Profile Member"
+ And I press "Apply!"
+ Then "Marie Curie" should be a member of "My Community"
+
+ Scenario: approve a task to accept a member as moderator in a closed community
+ Given "Marie Curie" asked to join "My Community"
+ And I am logged in as "mario"
+ And I go to My Community's control panel
+ And I follow "Process requests"
+ And I should see "Marie Curie wants to be a member"
+ When I choose "Accept"
+ And I check "Profile Moderator"
+ And I press "Apply!"
+ Then "Marie Curie" should be moderator of "My Community"
diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb
index eac3939..0b4b51a 100644
--- a/features/step_definitions/noosfero_steps.rb
+++ b/features/step_definitions/noosfero_steps.rb
@@ -245,6 +245,12 @@ Then /^"(.+)" should be admin of "(.+)"$/ do |person, organization|
org.admins.should include(user)
end
+Then /^"(.+)" should be moderator of "(.+)"$/ do |person,profile|
+ profile = Profile.find_by_name(profile)
+ person = Person.find_by_name(person)
+ profile.members_by_role(Profile::Roles.moderator(profile.environment.id)).should include(person)
+end
+
Given /^"([^\"]*)" has no articles$/ do |profile|
(Profile[profile] || Profile.find_by_name(profile)).articles.delete_all
end
@@ -375,3 +381,10 @@ Given /^the following units?$/ do |table|
Unit.create!(row.merge(:environment_id => 1))
end
end
+
+Given /^"([^\"]*)" asked to join "([^\"]*)"$/ do |person, organization|
+ person = Person.find_by_name(person)
+ organization = Organization.find_by_name(organization)
+ AddMember.create!(:person => person, :organization => organization)
+end
+
--
libgit2 0.21.2