>
- <%= labelled_form_field _('Please provide an explanation for the rejection'), f.text_area(:closing_statement, :style => 'height:200px; width:80%;') %>
-
-
-
-
- <% button_bar do %>
- <%= submit_button(:ok, _('Ok!')) %>
- <% end %>
-<% end %>
diff --git a/app/views/tasks/_create_enterprise_reject_details.rhtml b/app/views/tasks/_create_enterprise_reject_details.rhtml
new file mode 100644
index 0000000..3dde979
--- /dev/null
+++ b/app/views/tasks/_create_enterprise_reject_details.rhtml
@@ -0,0 +1,2 @@
+<%= required labelled_form_field(_('Rejection explanation'), f.text_area(:reject_explanation, :rows => 5)) %>
+
diff --git a/app/views/tasks/_invite_friend.rhtml b/app/views/tasks/_invite_friend.rhtml
deleted file mode 100644
index 10b812f..0000000
--- a/app/views/tasks/_invite_friend.rhtml
+++ /dev/null
@@ -1 +0,0 @@
-<%= render :partial => 'add_friend', :locals => {:task => task} %>
diff --git a/app/views/tasks/_invite_friend_accept_details.rhtml b/app/views/tasks/_invite_friend_accept_details.rhtml
new file mode 120000
index 0000000..b688e0c
--- /dev/null
+++ b/app/views/tasks/_invite_friend_accept_details.rhtml
@@ -0,0 +1 @@
+_add_friend_accept_details.rhtml
\ No newline at end of file
diff --git a/app/views/tasks/_invite_member.rhtml b/app/views/tasks/_invite_member.rhtml
deleted file mode 100644
index 9bdecf6..0000000
--- a/app/views/tasks/_invite_member.rhtml
+++ /dev/null
@@ -1,29 +0,0 @@
-
- <%= item.description %>
+ <%= item.information %>
<%= _('Created:') +' '+ show_date(item.created_at) %>
diff --git a/features/approve_article.feature b/features/approve_article.feature
index 3667504..80c75b8 100644
--- a/features/approve_article.feature
+++ b/features/approve_article.feature
@@ -28,7 +28,8 @@ Feature: approve article
And I go to Sample Community's control panel
And I follow "Process requests"
And I fill in "Text" with "This is an article edited"
- And I press "Ok!"
+ And I choose "Accept"
+ And I press "Apply!"
And I go to Sample Community's sitemap
When I follow "Sample Article"
Then I should see "This is an article edited"
diff --git a/features/create_community.feature b/features/create_community.feature
index 9de12c2..0c54499 100644
--- a/features/create_community.feature
+++ b/features/create_community.feature
@@ -51,8 +51,8 @@ Feature: create community
And I go to the Control panel
And I follow "Process requests"
And I should see "admin_user wants to create community Community for approval"
- And I choose "Approve"
- When I press "Ok!"
+ And I choose "Accept"
+ When I press "Apply!"
Then I should not see "admin_user wants to create community Community for approval"
When I go to the Control panel
And I follow "Manage my groups"
@@ -66,7 +66,7 @@ Feature: create community
And I follow "Process requests"
And I should see "admin_user wants to create community Community for approval"
And I choose "Reject"
- When I press "Ok!"
+ When I press "Apply!"
Then I should not see "admin_user wants to create community Community for approval"
When I go to the Control panel
And I follow "Manage my groups"
@@ -89,12 +89,3 @@ Feature: create community
When I go to the Control panel
And I follow "Manage my groups"
Then I should not see "Community for approval"
-
- Scenario: environment admin accepts new community task but identifier was already taken
- Given I am logged in as admin
- And feature "admin_must_approve_new_communities" is enabled on environment
- And I create community "Community for approval"
- And I create community "Community for approval"
- When I approve community "Community for approval"
- Then I should see "This name was already taken, this community cannot be approved"
- And I should see "admin_user wants to create community Community for approval"
diff --git a/features/invitation.feature b/features/invitation.feature
index a660b94..a8507fb 100644
--- a/features/invitation.feature
+++ b/features/invitation.feature
@@ -93,7 +93,7 @@ Feature: invitation
Given there are no pending jobs
When I am logged in as "josesantos"
And I go to the Control panel
- And I should see "josesilva invited you to join the community 26 Bsslines"
+ And I should see "josesilva invited you to join 26 Bsslines."
Scenario: noosfero user accepts to join community
Given I invite email "santos@invalid.br" to join community "26 Bsslines"
@@ -101,10 +101,10 @@ Feature: invitation
When I am logged in as "josesantos"
And I go to the Control panel
And I follow "Process requests"
- And I should see "josesilva invited you to join the community 26 Bsslines"
+ And I should see "josesilva invited you to join 26 Bsslines."
And I choose "Accept"
- When I press "Ok!"
- Then I should not see "josesilva invited you to join the community 26 Bsslines"
+ When I press "Apply!"
+ Then I should not see "josesilva invited you to join 26 Bsslines."
When I go to the Control panel
And I follow "Manage my groups"
Then I should see "26 Bsslines"
@@ -115,10 +115,10 @@ Feature: invitation
When I am logged in as "josesantos"
And I go to the Control panel
And I follow "Process requests"
- And I should see "josesilva invited you to join the community 26 Bsslines"
+ And I should see "josesilva invited you to join 26 Bsslines."
And I choose "Reject"
- When I press "Ok!"
- Then I should not see "josesilva invited you to join the community 26 Bsslines"
+ When I press "Apply!"
+ Then I should not see "josesilva invited you to join 26 Bsslines."
When I go to the Control panel
And I follow "Manage my groups"
Then I should not see "26 Bsslines"
@@ -135,7 +135,7 @@ Feature: invitation
When I am logged in as "josesantos"
And I go to the Control panel
And I follow "Process requests"
- And I should see "josesilva wants to be your friend."
+ Then I should see "josesilva wants to be your friend."
Scenario: noosfero user accepts to be friend
Given I invite email "santos@invalid.br" to be my friend
@@ -145,7 +145,7 @@ Feature: invitation
And I follow "Process requests"
And I should see "josesilva wants to be your friend."
And I choose "Accept"
- When I press "Ok!"
+ When I press "Apply!"
And I should not see "josesilva wants to be your friend."
When I go to the Control panel
And I follow "Manage friends"
@@ -158,8 +158,8 @@ Feature: invitation
And I go to the Control panel
And I follow "Process requests"
And I should see "josesilva wants to be your friend."
- And I choose "Ignore"
- When I press "Ok!"
+ And I choose "Reject"
+ When I press "Apply!"
And I should not see "josesilva wants to be your friend."
When I go to the Control panel
And I follow "Manage friends"
diff --git a/features/publish_article.feature b/features/publish_article.feature
index 2876db0..5b62015 100644
--- a/features/publish_article.feature
+++ b/features/publish_article.feature
@@ -95,6 +95,33 @@ Feature: publish article
When I go to Another Community2's sitemap
Then I should see "Sample Article"
+ Scenario: publishing articles with the same name in a moderated community
+ Given I am logged in as "joaosilva"
+ And "Joao Silva" is a member of "Sample Community"
+ And "Joao Silva" is admin of "Sample Community"
+ And I am on Sample Community's control panel
+ And I follow "Community Info and settings"
+ And I choose "profile_data_moderated_articles_true"
+ And I press "Save"
+ And I am on Joao Silva's control panel
+ And I follow "Manage Content"
+ And I follow "Spread"
+ And I check "Sample Community"
+ And I press "Spread this"
+ And I am on Joao Silva's control panel
+ And I follow "Manage Content"
+ And I follow "Spread"
+ And I check "Sample Community"
+ And I press "Spread this"
+ And I am on Sample Community's control panel
+ And I follow "Tasks"
+ And I choose "Accept"
+ And I press "Apply!"
+ And I should not see "The title (article name) is already being used by another article, please use another title."
+ And I choose "Accept"
+ When I press "Apply!"
+ Then I should see "The title (article name) is already being used by another article, please use another title."
+
Scenario: ask to publish an article that was deleted before approval
Given I am logged in as "joaosilva"
And "Joao Silva" is admin of "Sample Community"
@@ -110,6 +137,6 @@ Feature: publish article
And "joaosilva" has no articles
And I am on Sample Community's control panel
When I follow "Tasks"
- Then I should see /Joao Silva wanted.*deleted/
- And I press "Ok!"
- Then I should not see /Joao Silva wanted.*deleted/
+ Then I should see "The article was removed."
+ And I press "Apply!"
+ Then I should not see "The article was removed."
diff --git a/features/register_enterprise.feature b/features/register_enterprise.feature
index e81bb70..f01aa40 100644
--- a/features/register_enterprise.feature
+++ b/features/register_enterprise.feature
@@ -94,9 +94,10 @@ Feature: register enterprise
And I am logged in as admin
And I go to the Control panel
When I follow "Tasks"
- Then I should see /Processing task: Enterprise registration: "My Enterprise"/
+ Then I should see "Joao Silva wants to create enterprise My Enterprise."
And the first mail is to admin_user@example.com
- And I press "Ok"
+ And I choose "Accept"
+ And I press "Apply!"
Then the last mail is to joaosilva@example.com
And I am logged in as "joaosilva"
And I am on Joao Silva's control panel
@@ -120,11 +121,11 @@ Feature: register enterprise
And I am logged in as admin
And I go to the Control panel
When I follow "Tasks"
- Then I should see /Processing task: Enterprise registration: "My Enterprise"/
+ Then I should see "Joao Silva wants to create enterprise My Enterprise."
And the first mail is to admin_user@example.com
- And I choose "Cancel"
+ And I choose "Reject"
And I fill in "Rejection explanation" with "This enterprise has some irregularities."
- When I press "Ok"
+ And I press "Apply!"
Then the last mail is to joaosilva@example.com
And I am logged in as "joaosilva"
And I am on Joao Silva's control panel
@@ -157,9 +158,9 @@ Feature: register enterprise
Then I should see "Enterprise registration completed"
And I am on Validator's control panel
When I follow "Tasks"
- Then I should see /Processing task: Enterprise registration: "My Enterprise"/
- And I choose "Ok"
- And I press "Ok"
+ Then I should see "Joao Silva wants to create enterprise My Enterprise."
+ And I choose "Accept"
+ And I press "Apply!"
And I am on Joao Silva's control panel
When I follow "Manage my groups"
Then I should see "My Enterprise"
@@ -190,10 +191,10 @@ Feature: register enterprise
Then I should see "Enterprise registration completed"
And I am on Validator's control panel
When I follow "Tasks"
- Then I should see /Processing task: Enterprise registration: "My Enterprise"/
- And I choose "Cancel"
+ Then I should see "Joao Silva wants to create enterprise My Enterprise."
+ And I choose "Reject"
And I fill in "Rejection explanation" with "This enterprise has some irregularities."
- And I press "Ok"
+ And I press "Apply"
And I am on Joao Silva's control panel
When I follow "Manage my groups"
Then I should not see "My Enterprise"
diff --git a/features/step_definitions/create_community_steps.rb b/features/step_definitions/create_community_steps.rb
index 82c36d3..672fb5e 100644
--- a/features/step_definitions/create_community_steps.rb
+++ b/features/step_definitions/create_community_steps.rb
@@ -11,7 +11,7 @@ Given /^I approve community "(.+)"$/ do |community|
Given 'I go to the Control panel'
click_link('Process requests')
choose("decision-finish-#{task.id}")
- click_button('OK!')
+ click_button('Apply!')
end
Given /^I reject community "(.+)"$/ do |community|
@@ -19,5 +19,5 @@ Given /^I reject community "(.+)"$/ do |community|
Given 'I go to the Control panel'
click_link('Process requests')
choose("decision-cancel-#{task.id}")
- click_button('OK!')
+ click_button('Apply!')
end
diff --git a/public/images/icons-app/article-minor.png b/public/images/icons-app/article-minor.png
new file mode 100644
index 0000000..04f2680
Binary files /dev/null and b/public/images/icons-app/article-minor.png differ
diff --git a/public/images/icons-app/article-portrait.png b/public/images/icons-app/article-portrait.png
new file mode 100644
index 0000000..339c3ca
Binary files /dev/null and b/public/images/icons-app/article-portrait.png differ
diff --git a/public/images/icons-app/article-thumb.png b/public/images/icons-app/article-thumb.png
new file mode 100644
index 0000000..0580ccb
Binary files /dev/null and b/public/images/icons-app/article-thumb.png differ
diff --git a/public/images/icons-task/closed-arrow-hover.png b/public/images/icons-task/closed-arrow-hover.png
new file mode 100644
index 0000000..a797866
Binary files /dev/null and b/public/images/icons-task/closed-arrow-hover.png differ
diff --git a/public/images/icons-task/closed-arrow.png b/public/images/icons-task/closed-arrow.png
new file mode 100644
index 0000000..e2a51f7
Binary files /dev/null and b/public/images/icons-task/closed-arrow.png differ
diff --git a/public/images/icons-task/opened-arrow-hover.png b/public/images/icons-task/opened-arrow-hover.png
new file mode 100644
index 0000000..db9e2fe
Binary files /dev/null and b/public/images/icons-task/opened-arrow-hover.png differ
diff --git a/public/images/icons-task/opened-arrow.png b/public/images/icons-task/opened-arrow.png
new file mode 100644
index 0000000..72f3edf
Binary files /dev/null and b/public/images/icons-task/opened-arrow.png differ
diff --git a/public/img-source/article-icon.svg b/public/img-source/article-icon.svg
new file mode 100644
index 0000000..5232a84
--- /dev/null
+++ b/public/img-source/article-icon.svg
@@ -0,0 +1,788 @@
+
+
+
+
diff --git a/public/javascripts/tasks.js b/public/javascripts/tasks.js
new file mode 100644
index 0000000..52f450b
--- /dev/null
+++ b/public/javascripts/tasks.js
@@ -0,0 +1,49 @@
+(function($) {
+
+ $("input.task_accept_radio").click(function(){
+ task_id = this.getAttribute("task_id");
+ $('#on-accept-information-' + task_id).show('fast');
+ $('#on-reject-information-' + task_id).hide('fast');
+ $('#on-skip-information-' + task_id).hide('fast');
+ })
+
+ $("input.task_reject_radio").click(function(){
+ task_id = this.getAttribute("task_id");
+ $('#on-accept-information-' + task_id).hide('fast');
+ $('#on-reject-information-' + task_id).show('fast');
+ $('#on-skip-information-' + task_id).hide('fast');
+ })
+
+ $("input.task_skip_radio").click(function(){
+ task_id = this.getAttribute("task_id");
+ $('#on-accept-information-' + task_id).hide('fast');
+ $('#on-reject-information-' + task_id).hide('fast');
+ $('#on-skip-information-' + task_id).show('fast');
+ })
+
+ // There is probably an elegant way to do this...
+ $('#up-set-all-tasks-to').selectedIndex = 0;
+ $('#down-set-all-tasks-to').selectedIndex = 0;
+
+ $('#down-set-all-tasks-to').change(function(){
+ value = $('#down-set-all-tasks-to').selected().val();
+ up = $('#up-set-all-tasks-to')
+ up.attr('value', value).change();
+ })
+
+ $('#up-set-all-tasks-to').change(function(){
+ value = $('#up-set-all-tasks-to').selected().val();
+ down = $('#down-set-all-tasks-to')
+ down.attr('value', value);
+ $('.task_'+value+'_radio').each( function(){
+ if(!this.disabled){
+ $(this).attr('checked', 'checked').click();
+ }
+ })
+ })
+
+ $('.task_title').css('margin-right', $('.task_decisions').width()+'px');
+ $('.task_title').css('margin-left', $('.task_arrow').width()+'px');
+
+})(jQuery)
+
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 5c3f508..5aa7bcc 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -305,7 +305,7 @@ div.auto-complete li.selected {
color: #204A87;
}
-/* pending tasks list */
+/* pending tasks */
div.pending-tasks {
padding: 10px;
@@ -313,6 +313,19 @@ div.pending-tasks {
margin-bottom: 20px;
}
+#pending-tasks-count {
+ padding-left: 5px;
+ padding-right: 5px;
+ margin-left: 2px;
+ text-decoration: none;
+ background-color: #F57900;
+ color: #FFFFFF;
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+ -khtml-border-radius: 2px;
+ border-radius: 2px;
+}
+
/* sitemap and agenda */
.agenda-item a.icon,
diff --git a/public/stylesheets/tasks.css b/public/stylesheets/tasks.css
new file mode 100644
index 0000000..425117a
--- /dev/null
+++ b/public/stylesheets/tasks.css
@@ -0,0 +1,46 @@
+.task_box {
+ position: relative;
+ border: 1px solid #888;
+ -moz-border-radius: 10px;
+ -webkit-border-radius: 10px;
+ -khtml-border-radius: 10px;
+ border-radius: 10px;
+ padding: 6px 4px 9px 4px;
+ margin-top: 5px;
+ background: #EEE;
+}
+
+.task_title {
+ margin: 0px;
+ display: block;
+ line-height: 28px;
+ font-size: 120%;
+}
+
+.task_icon {
+ float: left;
+ margin-right: 10px;
+ width: 50px;
+ height: 50px;
+ text-align: center;
+}
+
+.task_decisions {
+ float: right;
+ padding-right: 5px;
+}
+
+.task_information {
+ line-height: 18px;
+ padding: 2px 0px;
+ clear: right;
+}
+
+.task_information p {
+ margin: 0px;
+}
+
+.task_target {
+ text-decoration: underline;
+ font-weight: bold;
+}
diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb
index 8641ae3..9b4948d 100644
--- a/test/functional/tasks_controller_test.rb
+++ b/test/functional/tasks_controller_test.rb
@@ -46,7 +46,7 @@ class TasksControllerTest < Test::Unit::TestCase
should 'be able to finish a task' do
t = profile.tasks.build; t.save!
- post :close, :decision => 'finish', :id => t.id
+ post :close, :tasks => {t.id => {:decision => 'finish', :task => {}}}
assert_redirected_to :action => 'index'
t.reload
@@ -56,52 +56,46 @@ class TasksControllerTest < Test::Unit::TestCase
should 'be able to cancel a task' do
t = profile.tasks.build; t.save!
- post :close, :decision => 'cancel', :id => t.id
+ post :close, :tasks => {t.id => {:decision => 'cancel', :task => {}}}
assert_redirected_to :action => 'index'
t.reload
ok('task should be cancelled') { t.status == Task::Status::CANCELLED }
end
- should 'affiliate roles to user after finish add member task' do
- t = AddMember.create!(:person => profile, :organization => profile)
- count = profile.members.size
- post :close, :decision => 'finish', :id => t.id
- profile = Profile.find(@profile.id)
- assert_equal count + 1, profile.members.size
- end
+ should 'be able to skip a task' do
+ t = profile.tasks.build; t.save!
- should 'display custom form to add members task' do
- t = AddMember.create!(:person => profile, :organization => profile)
- get :index, :profile => profile.identifier
- assert_tag :tag => 'form', :attributes => { :action => "/myprofile/#{profile.identifier}/tasks/close/#{t.id}" }
- end
+ post :close, :tasks => {t.id => {:decision => 'skip', :task => {}}}
+ assert_redirected_to :action => 'index'
- should 'display member role checked if target has members' do
- profile.affiliate(profile, Profile::Roles.admin(profile.environment.id))
- assert_equal 1, profile.members.size
- t = AddMember.create!(:person => profile, :organization => profile)
- get :index, :profile => profile.identifier
- assert_tag :tag => 'input', :attributes => { :name => 'task[roles][]', :checked => 'checked', :value => Profile::Roles.member(profile.environment.id).id }
+ t.reload
+ ok('task should be skipped') { t.status == Task::Status::ACTIVE }
end
- should 'display roles besides role member unchecked if target has members' do
- profile.affiliate(profile, Profile::Roles.admin(profile.environment.id))
- assert_equal 1, profile.members.size
- t = AddMember.create!(:person => profile, :organization => profile)
- get :index, :profile => profile.identifier
- Role.find(:all).select{ |r| r.has_kind?('Profile') and r.id != Profile::Roles.member(profile.environment.id).id }.each do |i|
- assert_no_tag :tag => 'input', :attributes => { :name => 'task[roles][]', :checked => 'checked', :value => i.id }
- end
+ should 'be able to apply different decisions to multiples tasks at the same time' do
+ t1 = profile.tasks.build; t1.save!
+ t2 = profile.tasks.build; t2.save!
+ t3 = profile.tasks.build; t3.save!
+
+ post :close, :tasks => {t1.id => {:decision => 'finish', :task => {}}, t2.id => {:decision => 'cancel', :task => {}}, t3.id => {:decision => 'skip', :task => {}}}
+ assert_redirected_to :action => 'index'
+
+ t1.reload
+ t2.reload
+ t3.reload
+
+ ok('task should be finished') { t1.status == Task::Status::FINISHED }
+ ok('task should be canceled') { t2.status == Task::Status::CANCELLED }
+ ok('task should be skipped') { t3.status == Task::Status::ACTIVE }
end
- should 'display all roles checked if target has no members' do
- assert_equal 0, profile.members.size
+ should 'affiliate roles to user after finish add member task' do
t = AddMember.create!(:person => profile, :organization => profile)
- get :index, :profile => profile.identifier
- Role.find(:all).select{ |r| r.has_kind?('Profile') }.each do |i|
- assert_tag :tag => 'input', :attributes => { :name => 'task[roles][]', :checked => 'checked', :value => i.id }
- end
+ count = profile.members.size
+ post :close, :tasks => {t.id => {:decision => 'finish', :task => {}}}
+ profile = Profile.find(@profile.id)
+ assert_equal count + 1, profile.members.size
end
should 'display a create ticket form' do
@@ -161,8 +155,8 @@ class TasksControllerTest < Test::Unit::TestCase
article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
t = ApproveArticle.create!(:name => 'test name', :article => article, :target => c, :requestor => profile)
- post :close, :decision => 'finish', :id => t.id, :task => { :name => 'new name'}
- assert_equal article, c.articles.find_by_name('new name').reference_article
+ post :close, :tasks => {t.id => {:decision => 'finish', :task => {:name => 'new_name'}}}
+ assert_equal article, c.articles.find_by_name('new_name').reference_article
end
should 'create published article in folder after finish approve article task' do
@@ -174,8 +168,8 @@ class TasksControllerTest < Test::Unit::TestCase
article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
t = ApproveArticle.create!(:name => 'test name', :article => article, :target => c, :requestor => profile)
- post :close, :decision => 'finish', :id => t.id, :task => { :name => 'new name', :article_parent_id => folder.id}
- assert_equal folder, c.articles.find_by_name('new name').parent
+ post :close, :tasks => {t.id => {:decision => 'finish', :task => {:name => 'new_name', :article_parent_id => folder.id}}}
+ assert_equal folder, c.articles.find_by_name('new_name').parent
end
should 'be highlighted if asked when approving a published article' do
@@ -187,8 +181,8 @@ class TasksControllerTest < Test::Unit::TestCase
article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
t = ApproveArticle.create!(:article => article, :target => c, :requestor => profile)
- post :close, :decision => 'finish', :id => t.id, :task => { :name => 'new name', :article_parent_id => folder.id, :highlighted => true}
- assert_equal true, c.articles.find_by_name('new name').highlighted
+ post :close, :tasks => {t.id => {:decision => 'finish', :task => {:name => 'new_name', :article_parent_id => folder.id, :highlighted => true}}}
+ assert_equal true, c.articles.find_by_name('new_name').highlighted
end
should 'create article of same class after choosing root folder on approve article task' do
@@ -199,8 +193,8 @@ class TasksControllerTest < Test::Unit::TestCase
article = profile.articles.create!(:name => 'something interesting', :body => 'ruby on rails')
t = ApproveArticle.create!(:article => article, :target => c, :requestor => profile)
- post :close, :decision => 'finish', :id => t.id, :task => { :name => 'new name', :article_parent_id => ""}
- assert_equal article.class, c.articles.find_by_name('new name').class
+ post :close, :tasks => {t.id => {:decision => 'finish', :task => {:name => 'new_name', :article_parent_id => ""}}}
+ assert_not_nil c.articles.find_by_name('new_name')
end
should 'handle blank names for published articles' do
@@ -217,24 +211,24 @@ class TasksControllerTest < Test::Unit::TestCase
assert_includes c.tasks, a
assert_difference article.class, :count do
- post :close, {"commit"=>"Ok!", "id"=> a.id.to_s, "task"=>{"name"=>"", "closing_statment"=>"", "highlighted"=>"0", "article_parent_id"=>c_blog2.id.to_s}, "decision"=>"finish"}
+ post :close, :tasks => {a.id => {:decision => 'finish', :task => {:name => "", :highlighted => "0", :article_parent_id => c_blog2.id.to_s}}}
end
assert p_article = article.class.find_by_reference_article_id(article.id)
assert_includes c_blog2.children(true), p_article
end
- should 'cancel an enterprise registration task even if there is an enterprise with the same identifier' do
+ should 'raise error if there is an enterprise with the same identifier and keep the task active' do
e = Environment.default
e.add_admin(profile)
task = CreateEnterprise.create!(:name => "My Enterprise", :identifier => "my-enterprise", :requestor => profile, :target => e)
enterprise = fast_create(Enterprise, :name => "My Enterprise", :identifier => "my-enterprise")
- assert_nothing_raised do
- post :close, {:profile => profile.identifier, :id => task.id, :task => {:reject_explanation => "Bla bla"}, :decision => "cancel"}
+ assert_raise ActiveRecord::RecordInvalid do
+ post :close, :tasks => {task.id => { :task => {:reject_explanation => "Bla bla"}, :decision => "cancel"}}
end
task.reload
- assert_equal Task::Status::CANCELLED, task.status
+ assert_equal Task::Status::ACTIVE, task.status
end
should 'create TinyMceArticle article after finish approve suggested article task' do
@@ -245,7 +239,7 @@ class TasksControllerTest < Test::Unit::TestCase
SuggestArticle.skip_captcha!
t = SuggestArticle.create!(:article_name => 'test name', :article_body => 'test body', :name => 'some name', :email => 'test@localhost.com', :target => c)
- post :close, :decision => 'finish', :id => t.id, :task => {}
+ post :close, :tasks => {t.id => { :task => {}, :decision => "finish"}}
assert_not_nil TinyMceArticle.find(:first)
end
@@ -265,7 +259,7 @@ class TasksControllerTest < Test::Unit::TestCase
t.target = c
t.save!
- post :close, :decision => 'finish', :id => t.id, :task => {:article_name => 'new article name', :article_body => 'new body', :source => 'http://www.noosfero.com', :source_name => 'new source', :name => 'new name'}
+ post :close, :tasks => {t.id => { :task => {:article_name => 'new article name', :article_body => 'new body', :source => 'http://www.noosfero.com', :source_name => 'new source', :name => 'new name'}, :decision => "finish"}}
assert_equal 'new article name', TinyMceArticle.find(:first).name
assert_equal 'new name', TinyMceArticle.find(:first).author_name
assert_equal 'new body', TinyMceArticle.find(:first).body
diff --git a/test/unit/add_friend_test.rb b/test/unit/add_friend_test.rb
index 956d2ba..7799614 100644
--- a/test/unit/add_friend_test.rb
+++ b/test/unit/add_friend_test.rb
@@ -71,15 +71,6 @@ class AddFriendTest < ActiveSupport::TestCase
task = AddFriend.create!(:person => p1, :friend => p2)
end
- should 'provide proper description' do
- p1 = create_user('testuser1').person
- p2 = create_user('testuser2').person
-
- task = fast_create(AddFriend, :requestor_id => p1.id, :target_id => p2.id)
-
- assert_equal 'testuser1 wants to be your friend.', task.description
- end
-
should 'has permission to manage friends' do
t = AddFriend.new
assert_equal :manage_friends, t.permission
diff --git a/test/unit/add_member_test.rb b/test/unit/add_member_test.rb
index c6d76a2..7d09b40 100644
--- a/test/unit/add_member_test.rb
+++ b/test/unit/add_member_test.rb
@@ -49,18 +49,6 @@ class AddMemberTest < ActiveSupport::TestCase
task = AddMember.create!(:person => p, :organization => c)
end
- should 'provide proper description' do
- p = create_user('testuser1').person
- c = fast_create(Community, :name => 'closed community')
- c.update_attribute(:closed, true)
-
- TaskMailer.stubs(:deliver_target_notification)
-
- task = fast_create(AddMember, :requestor_id => p.id, :target_id => c.id, :target_type => 'Community')
-
- assert_equal 'testuser1 wants to be a member of "closed community".', task.description
- end
-
should 'has permission to manage members' do
t = AddMember.new
assert_equal :manage_memberships, t.permission
diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb
index e637854..42b76d9 100644
--- a/test/unit/application_helper_test.rb
+++ b/test/unit/application_helper_test.rb
@@ -588,6 +588,12 @@ class ApplicationHelperTest < Test::Unit::TestCase
assert_equal ["1 for b", "2 for c", "3 for a"], unique_with_count(%w(a b c a c a))
end
+ should 'show task information with the requestor' do
+ person = create_user('usertest').person
+ task = Task.create(:requestor => person)
+ assert_match person.name, task_information(task)
+ end
+
protected
def url_for(args = {})
diff --git a/test/unit/approve_article_test.rb b/test/unit/approve_article_test.rb
index 0bcf1c1..e5f17ed 100644
--- a/test/unit/approve_article_test.rb
+++ b/test/unit/approve_article_test.rb
@@ -62,7 +62,7 @@ class ApproveArticleTest < ActiveSupport::TestCase
article.destroy
a.reload
- assert_match /text was removed/, a.description
+ assert_equal "The article was removed.", a.information[:message]
end
should 'preserve article_parent' do
diff --git a/test/unit/email_activation_test.rb b/test/unit/email_activation_test.rb
index ba15261..9f3f7b5 100644
--- a/test/unit/email_activation_test.rb
+++ b/test/unit/email_activation_test.rb
@@ -37,7 +37,7 @@ class EmailActivationTest < Test::Unit::TestCase
task = EmailActivation.create!(:requestor => ze.person, :target => Environment.default)
task.finish
- assert_equal ['zezinho@colivre.net'], ActionMailer::Base.deliveries.first.to
+ assert_equal ["zezinho@#{ze.email_domain}"], ActionMailer::Base.deliveries.first.to
end
should 'create only once pending task by user' do
@@ -49,11 +49,4 @@ class EmailActivationTest < Test::Unit::TestCase
assert !anothertask.save
end
- should 'display email address on description of task' do
- ze = create_user('zezinho', :environment_id => Environment.default.id)
- Environment.default.domains = [Domain.create!(:name => 'env_test.invalid')]
- task = EmailActivation.new(:requestor => ze.person, :target => Environment.default)
- assert_match /zezinho@env_test.invalid/, task.description
- end
-
end
diff --git a/test/unit/invite_friend_test.rb b/test/unit/invite_friend_test.rb
index 85fd1a2..32d21a5 100644
--- a/test/unit/invite_friend_test.rb
+++ b/test/unit/invite_friend_test.rb
@@ -105,13 +105,6 @@ class InviteFriendTest < ActiveSupport::TestCase
task = InviteFriend.create!(:person => p1, :friend => p2)
end
- should 'mention inviter in description' do
- p1 = create_user('testuser1').person
- task = InviteFriend.new(:person => p1)
-
- assert_match 'testuser1', task.description
- end
-
should 'has permission to manage friends' do
t = InviteFriend.new
assert_equal :manage_friends, t.permission
diff --git a/test/unit/invite_member_test.rb b/test/unit/invite_member_test.rb
index b75dcf1..d0ef5d5 100644
--- a/test/unit/invite_member_test.rb
+++ b/test/unit/invite_member_test.rb
@@ -85,19 +85,6 @@ class InviteMemberTest < ActiveSupport::TestCase
task = InviteMember.create!(:person => p1, :friend => p2, :community_id => fast_create(Community).id)
end
- should 'provide proper description' do
- p1 = create_user('testuser1').person
- p2 = create_user('testuser2').person
-
- TaskMailer.expects(:deliver_task_finished).never
- TaskMailer.expects(:deliver_task_created).never
-
- community = fast_create(Community)
- task = InviteMember.create!(:person => p1, :friend => p2, :community_id => community.id)
-
- assert_match(/#{p1.name}.*#{community.name}/, task.description)
- end
-
should 'not invite yourself' do
p = create_user('testuser1').person
diff --git a/test/unit/pending_task_notifier_test.rb b/test/unit/pending_task_notifier_test.rb
index ec56c3b..2643bba 100644
--- a/test/unit/pending_task_notifier_test.rb
+++ b/test/unit/pending_task_notifier_test.rb
@@ -23,10 +23,10 @@ class PendingTaskNotifierTest < Test::Unit::TestCase
p = create_user('maelcum').person
c = fast_create(Community)
c.add_admin(p)
- c.tasks << Task.new
+ c.tasks << Task.new(:requestor => p)
response = PendingTaskNotifier.deliver_notification(p)
- assert_match /Generic task/, response.body
+ assert_match /sent you a task/, response.body
end
private
diff --git a/test/unit/rss_feed_test.rb b/test/unit/rss_feed_test.rb
index 727f0b6..511e033 100644
--- a/test/unit/rss_feed_test.rb
+++ b/test/unit/rss_feed_test.rb
@@ -206,7 +206,7 @@ class RssFeedTest < Test::Unit::TestCase
end
should 'display the referenced body of a article published' do
- article = fast_create(TextileArticle, :body => 'This is the content of the Sample Article.')
+ article = fast_create(TextileArticle, :body => 'This is the content of the Sample Article.', :profile_id => fast_create(Person).id)
profile = fast_create(Profile)
blog = fast_create(Blog, :profile_id => profile.id)
a = ApproveArticle.create!(:name => 'test name', :article => article, :target => profile, :requestor => fast_create(Person))
diff --git a/test/unit/suggest_article_test.rb b/test/unit/suggest_article_test.rb
index 96e99d0..aeb2c17 100644
--- a/test/unit/suggest_article_test.rb
+++ b/test/unit/suggest_article_test.rb
@@ -97,12 +97,6 @@ class SuggestArticleTest < ActiveSupport::TestCase
assert_equal 'http://www.gnu.org/', article.source
end
- should 'use sender name in description' do
- t = build(SuggestArticle, :target => @profile)
- t.stubs(:sender).returns('XYZ')
- assert_match(/XYZ/, t.description)
- end
-
should 'use name and e-mail as sender info' do
t = build(SuggestArticle, :target => @profile)
t.name = 'Some One'
diff --git a/test/unit/task_mailer_test.rb b/test/unit/task_mailer_test.rb
index 224fa3c..d593a4d 100644
--- a/test/unit/task_mailer_test.rb
+++ b/test/unit/task_mailer_test.rb
@@ -17,7 +17,7 @@ class TaskMailerTest < Test::Unit::TestCase
task = Task.new
task.expects(:task_finished_message).returns('the message')
- task.expects(:description).returns('the task')
+ task.expects(:information).returns('the task')
requestor = mock()
requestor.expects(:notification_emails).returns(['requestor@example.com'])
@@ -40,7 +40,7 @@ class TaskMailerTest < Test::Unit::TestCase
task = Task.new
task.expects(:task_cancelled_message).returns('the message')
- task.expects(:description).returns('the task')
+ task.expects(:information).returns('the task')
requestor = mock()
requestor.expects(:notification_emails).returns(['requestor@example.com'])
@@ -64,7 +64,7 @@ class TaskMailerTest < Test::Unit::TestCase
task = Task.new
task.expects(:task_created_message).returns('the message')
- task.expects(:description).returns('the task')
+ task.expects(:information).returns('the task')
requestor = mock()
requestor.expects(:notification_emails).returns(['requestor@example.com'])
@@ -85,7 +85,7 @@ class TaskMailerTest < Test::Unit::TestCase
should 'be able to send a "target notification" message' do
task = Task.new
- task.expects(:description).returns('the task')
+ task.expects(:information).returns('the task')
target = mock()
target.expects(:notification_emails).returns(['target@example.com'])
@@ -104,18 +104,18 @@ class TaskMailerTest < Test::Unit::TestCase
assert !ActionMailer::Base.deliveries.empty?
end
- should 'be able to send a "invitatiom notification" message' do
+ should 'be able to send a "invitation notification" message' do
task = InviteFriend.new
- task.expects(:description).returns('the task')
task.expects(:code).returns('123456')
- task.expects(:message).returns('Hello , invite you, please follow this link: ')
+ task.stubs(:message).returns('Hello , invite you, please follow this link: ')
task.expects(:friend_email).returns('friend@exemple.com')
task.expects(:friend_name).returns('friend name').at_least_once
requestor = mock()
- requestor.expects(:name).returns('my name')
+ requestor.stubs(:name).returns('my name')
+ requestor.stubs(:public_profile_url).returns('requestor_path')
environment = mock()
environment.expects(:contact_email).returns('sender@example.com')
diff --git a/test/unit/task_test.rb b/test/unit/task_test.rb
index ac91249..4af6436 100644
--- a/test/unit/task_test.rb
+++ b/test/unit/task_test.rb
@@ -87,7 +87,8 @@ class TaskTest < Test::Unit::TestCase
end
should 'provide a description method' do
- assert_kind_of String, Task.new.description
+ requestor = create_user('requestor').person
+ assert_kind_of Hash, Task.new(:requestor => requestor).information
end
should 'notify just after the task is created' do
--
libgit2 0.21.2