Commit c705f8809968afd921a0b41e43a358db376eecf8

Authored by Keilla Menezes
Committed by Daniela Feitosa
1 parent e2108aed

Accept a member as admin in a closed community

(ActionItem1916)
app/views/tasks/_add_member_accept_details.rhtml
1 1 <%= content = _("Roles:")+"<br />"
2 2 roles = Profile::Roles.organization_member_roles(task.target.environment.id)
3 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 5 end
6 6 content_tag('p', content, :class => 'member-classify-suggestion')
7 7 %>
... ...
features/accept_member.feature 0 → 100644
... ... @@ -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 /^&quot;(.+)&quot; should be admin of &quot;(.+)&quot;$/ do |person, organization|
245 245 org.admins.should include(user)
246 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 254 Given /^"([^\"]*)" has no articles$/ do |profile|
249 255 (Profile[profile] || Profile.find_by_name(profile)).articles.delete_all
250 256 end
... ... @@ -375,3 +381,10 @@ Given /^the following units?$/ do |table|
375 381 Unit.create!(row.merge(:environment_id => 1))
376 382 end
377 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 +
... ...