Commit c705f8809968afd921a0b41e43a358db376eecf8
Committed by
Daniela Feitosa
1 parent
e2108aed
Exists in
master
and in
28 other branches
Accept a member as admin in a closed community
(ActionItem1916)
Showing
3 changed files
with
62 additions
and
1 deletions
Show diff stats
app/views/tasks/_add_member_accept_details.rhtml
1 | <%= content = _("Roles:")+"<br />" | 1 | <%= content = _("Roles:")+"<br />" |
2 | roles = Profile::Roles.organization_member_roles(task.target.environment.id) | 2 | roles = Profile::Roles.organization_member_roles(task.target.environment.id) |
3 | roles.each do |role| | 3 | roles.each do |role| |
4 | - content += labelled_check_box(role.name, "tasks[#{task.id}][roles][]", role.id, false)+"<br />" | 4 | + content += labelled_check_box(role.name, "tasks[#{task.id}][task][roles][]", role.id, false)+"<br />" |
5 | end | 5 | end |
6 | content_tag('p', content, :class => 'member-classify-suggestion') | 6 | content_tag('p', content, :class => 'member-classify-suggestion') |
7 | %> | 7 | %> |
@@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
1 | +Feature: accept member | ||
2 | + As an admin user | ||
3 | + I want to accept a member request | ||
4 | + In order to join a community | ||
5 | + | ||
6 | + Background: | ||
7 | + Given the following users | ||
8 | + | login | name | | ||
9 | + | mario | Mario Souto | | ||
10 | + | marie | Marie Curie | | ||
11 | + And the following community | ||
12 | + | identifier | name | | ||
13 | + | mycommunity | My Community | | ||
14 | + And the community "My Community" is closed | ||
15 | + And "Mario Souto" is admin of "My Community" | ||
16 | + | ||
17 | + Scenario: approve a task to accept a member as admin in a closed community | ||
18 | + Given "Marie Curie" asked to join "My Community" | ||
19 | + And I am logged in as "mario" | ||
20 | + And I go to My Community's control panel | ||
21 | + And I follow "Process requests" | ||
22 | + And I should see "Marie Curie wants to be a member" | ||
23 | + When I choose "Accept" | ||
24 | + And I check "Profile Administrator" | ||
25 | + And I press "Apply!" | ||
26 | + Then "Marie Curie" should be admin of "My Community" | ||
27 | + | ||
28 | + Scenario: approve a task to accept a member as member in a closed community | ||
29 | + Given "Marie Curie" asked to join "My Community" | ||
30 | + And I am logged in as "mario" | ||
31 | + And I go to My Community's control panel | ||
32 | + And I follow "Process requests" | ||
33 | + And I should see "Marie Curie wants to be a member" | ||
34 | + When I choose "Accept" | ||
35 | + And I check "Profile Member" | ||
36 | + And I press "Apply!" | ||
37 | + Then "Marie Curie" should be a member of "My Community" | ||
38 | + | ||
39 | + Scenario: approve a task to accept a member as moderator in a closed community | ||
40 | + Given "Marie Curie" asked to join "My Community" | ||
41 | + And I am logged in as "mario" | ||
42 | + And I go to My Community's control panel | ||
43 | + And I follow "Process requests" | ||
44 | + And I should see "Marie Curie wants to be a member" | ||
45 | + When I choose "Accept" | ||
46 | + And I check "Profile Moderator" | ||
47 | + And I press "Apply!" | ||
48 | + Then "Marie Curie" should be moderator of "My Community" |
features/step_definitions/noosfero_steps.rb
@@ -245,6 +245,12 @@ Then /^"(.+)" should be admin of "(.+)"$/ do |person, organization| | @@ -245,6 +245,12 @@ Then /^"(.+)" should be admin of "(.+)"$/ do |person, organization| | ||
245 | org.admins.should include(user) | 245 | org.admins.should include(user) |
246 | end | 246 | end |
247 | 247 | ||
248 | +Then /^"(.+)" should be moderator of "(.+)"$/ do |person,profile| | ||
249 | + profile = Profile.find_by_name(profile) | ||
250 | + person = Person.find_by_name(person) | ||
251 | + profile.members_by_role(Profile::Roles.moderator(profile.environment.id)).should include(person) | ||
252 | +end | ||
253 | + | ||
248 | Given /^"([^\"]*)" has no articles$/ do |profile| | 254 | Given /^"([^\"]*)" has no articles$/ do |profile| |
249 | (Profile[profile] || Profile.find_by_name(profile)).articles.delete_all | 255 | (Profile[profile] || Profile.find_by_name(profile)).articles.delete_all |
250 | end | 256 | end |
@@ -375,3 +381,10 @@ Given /^the following units?$/ do |table| | @@ -375,3 +381,10 @@ Given /^the following units?$/ do |table| | ||
375 | Unit.create!(row.merge(:environment_id => 1)) | 381 | Unit.create!(row.merge(:environment_id => 1)) |
376 | end | 382 | end |
377 | end | 383 | end |
384 | + | ||
385 | +Given /^"([^\"]*)" asked to join "([^\"]*)"$/ do |person, organization| | ||
386 | + person = Person.find_by_name(person) | ||
387 | + organization = Organization.find_by_name(organization) | ||
388 | + AddMember.create!(:person => person, :organization => organization) | ||
389 | +end | ||
390 | + |