Commit fafb323e7bc2ff38aeecb28ca96ad254879f062b
1 parent
1cc34ff8
Exists in
master
and in
20 other branches
rails4: fix most functional tests
Showing
121 changed files
with
160 additions
and
567 deletions
Show diff stats
Gemfile
... | ... | @@ -20,7 +20,7 @@ gem 'exception_notification', '~> 4.0.1' |
20 | 20 | gem 'gettext', '~> 2.2.1', :require => false |
21 | 21 | gem 'locale', '~> 2.0.5' |
22 | 22 | gem 'whenever', :require => false |
23 | -gem 'eita-jrails', '>= 0.9.8', require: 'jrails' | |
23 | +gem 'eita-jrails', '>= 0.9.9', require: 'jrails' | |
24 | 24 | |
25 | 25 | # asset pipeline |
26 | 26 | gem 'uglifier', '>= 1.0.3' | ... | ... |
app/controllers/application_controller.rb
... | ... | @@ -156,7 +156,7 @@ class ApplicationController < ActionController::Base |
156 | 156 | def render_not_found(path = nil) |
157 | 157 | @no_design_blocks = true |
158 | 158 | @path ||= request.path |
159 | - render :template => 'shared/not_found.html.erb', :status => 404, :layout => get_layout | |
159 | + render template: 'shared/not_found', status: 404, layout: get_layout | |
160 | 160 | end |
161 | 161 | alias :render_404 :render_not_found |
162 | 162 | |
... | ... | @@ -164,7 +164,7 @@ class ApplicationController < ActionController::Base |
164 | 164 | @no_design_blocks = true |
165 | 165 | @message = message |
166 | 166 | @title = title |
167 | - render :template => 'shared/access_denied.html.erb', :status => 403 | |
167 | + render template: 'shared/access_denied', status: 403 | |
168 | 168 | end |
169 | 169 | |
170 | 170 | def load_category | ... | ... |
app/controllers/public/account_controller.rb
... | ... | @@ -113,7 +113,7 @@ class AccountController < ApplicationController |
113 | 113 | @user.signup! |
114 | 114 | owner_role = Role.find_by_name('owner') |
115 | 115 | @user.person.affiliate(@user.person, [owner_role]) if owner_role |
116 | - invitation = Task.from_code @invitation_code | |
116 | + invitation = Task.from_code(@invitation_code).first | |
117 | 117 | if invitation |
118 | 118 | invitation.update_attributes!({:friend => @user.person}) |
119 | 119 | invitation.finish |
... | ... | @@ -205,7 +205,7 @@ class AccountController < ApplicationController |
205 | 205 | # |
206 | 206 | # Posts back. |
207 | 207 | def new_password |
208 | - @change_password = ChangePassword.from_code params[:code] | |
208 | + @change_password = ChangePassword.from_code(params[:code]).first | |
209 | 209 | |
210 | 210 | unless @change_password |
211 | 211 | render :action => 'invalid_change_password_code', :status => 403 |
... | ... | @@ -398,7 +398,7 @@ class AccountController < ApplicationController |
398 | 398 | end |
399 | 399 | |
400 | 400 | def load_enterprise_activation |
401 | - @enterprise_activation ||= EnterpriseActivation.from_code params[:enterprise_code] | |
401 | + @enterprise_activation ||= EnterpriseActivation.from_code(params[:enterprise_code]).first | |
402 | 402 | end |
403 | 403 | |
404 | 404 | def load_enterprise | ... | ... |
app/controllers/public/search_controller.rb
... | ... | @@ -67,7 +67,7 @@ class SearchController < PublicController |
67 | 67 | end |
68 | 68 | |
69 | 69 | def contents |
70 | - redirect_to params.merge(:action => :articles) | |
70 | + redirect_to url_for(params.merge action: :articles) | |
71 | 71 | end |
72 | 72 | |
73 | 73 | def people |
... | ... | @@ -124,7 +124,7 @@ class SearchController < PublicController |
124 | 124 | # keep old URLs workings |
125 | 125 | def assets |
126 | 126 | params[:action] = params[:asset].is_a?(Array) ? :index : params.delete(:asset) |
127 | - redirect_to params | |
127 | + redirect_to url_for(params) | |
128 | 128 | end |
129 | 129 | |
130 | 130 | def tags | ... | ... |
app/views/comment/_comment_form.html.erb
... | ... | @@ -55,7 +55,7 @@ function check_captcha(button, confirm_action) { |
55 | 55 | <div class="post_comment_box <%= ((defined? show_form) && show_form) ? 'opened' : 'closed' %>"> |
56 | 56 | |
57 | 57 | <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form') if display_link && @comment.reply_of_id.blank? %> |
58 | -<%= remote_form_for(:comment, @comment, :url => {:profile => profile.identifier, :controller => 'comment', :action => (edition_mode ? 'update' : 'create'), :id => (edition_mode ? @comment.id : @page.id)}, :html => { :class => 'comment_form' } ) do |f| %> | |
58 | +<%= remote_form_for(@comment, :url => {:profile => profile.identifier, :controller => 'comment', :action => (edition_mode ? 'update' : 'create'), :id => (edition_mode ? @comment.id : @page.id)}, :html => { :class => 'comment_form' } ) do |f| %> | |
59 | 59 | |
60 | 60 | <%= required_fields_message %> |
61 | 61 | ... | ... |
app/views/manage_products/new.html.erb
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | |
3 | 3 | <div id='request_result_message' style='display: none'></div> |
4 | 4 | |
5 | -<%= remote_form_for :product, @product, | |
5 | +<%= remote_form_for @product, | |
6 | 6 | :loading => "open_loading('#{ _('loading...') }')", |
7 | 7 | :update => "request_result_message", |
8 | 8 | :url => {:action => 'new'}, | ... | ... |
app/views/profile_search/_results-list.html.erb
... | ... | @@ -1,15 +0,0 @@ |
1 | -<div id='search-content'> | |
2 | - <% if @results %> | |
3 | - <div class='results-found-message'> | |
4 | - <%= _("%s results found") % @results.total_entries %> | |
5 | - </div> | |
6 | - | |
7 | - <ul class='results-list'> | |
8 | - <% @results.sort_by { |r| r.is_image? ? 0 : 1}.each do |result| %> | |
9 | - <%= render :partial => partial_for_class(result.class), :locals => { :article => result } %> | |
10 | - <% end %> | |
11 | - </ul> | |
12 | - | |
13 | - <%= pagination_links @results %> | |
14 | - <% end %> | |
15 | -</div> |
... | ... | @@ -0,0 +1,15 @@ |
1 | +<div id='search-content'> | |
2 | + <% if @results %> | |
3 | + <div class='results-found-message'> | |
4 | + <%= _("%s results found") % @results.total_entries %> | |
5 | + </div> | |
6 | + | |
7 | + <ul class='results-list'> | |
8 | + <% @results.sort_by { |r| r.is_image? ? 0 : 1}.each do |result| %> | |
9 | + <%= render :partial => partial_for_class(result.class), :locals => { :article => result } %> | |
10 | + <% end %> | |
11 | + </ul> | |
12 | + | |
13 | + <%= pagination_links @results %> | |
14 | + <% end %> | |
15 | +</div> | ... | ... |
app/views/profile_search/index.html.erb
app/views/profile_search/index.js.erb
app/views/shared/logged_in/xmpp_chat.html.erb
1 | - <%= javascript_include_tag 'strophejs-1.1.3/strophe.min', 'jquery.emoticon', '../designs/icons/pidgin/emoticons.js', 'ba-linkify', 'jquery.ba-hashchange', 'jquery.sound', 'chat', 'perfect-scrollbar.min.js', 'perfect-scrollbar.with-mousewheel.min.js', 'jquery.timeago.js', :cache => 'cache/chat' %> | |
1 | + <%= javascript_include_tag 'strophejs-1.1.3/strophe.min', 'jquery.emoticon', '../designs/icons/pidgin/emoticons.js', 'ba-linkify', 'jquery.ba-hashchange', 'jquery.sound', 'chat', 'perfect-scrollbar.min.js', 'perfect-scrollbar.with-mousewheel.min.js', 'jquery.timeago.js' %> | |
2 | 2 | <%= stylesheet_link_tag 'perfect-scrollbar.min.css' %> |
3 | 3 | |
4 | 4 | <% extend ChatHelper %> | ... | ... |
plugins/breadcrumbs/test/functional/profile_design_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | |
3 | -class ProfileDesignController | |
4 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
5 | - def rescue_action(e) | |
6 | - raise e | |
7 | - end | |
8 | -end | |
9 | - | |
10 | 3 | class ProfileDesignControllerTest < ActionController::TestCase |
11 | 4 | |
12 | 5 | def setup | ... | ... |
plugins/bsc/test/functional/bsc_plugin_admin_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/bsc_plugin_admin_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class BscPluginAdminController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class BscPluginAdminControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | VALID_CNPJ = '94.132.024/0001-48' | ... | ... |
plugins/bsc/test/functional/bsc_plugin_myprofile_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/bsc_plugin_myprofile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class BscPluginMyprofileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class BscPluginMyprofileControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | VALID_CNPJ = '94.132.024/0001-48' | ... | ... |
plugins/classify_members/test/functional/classify_members_plugin_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | |
3 | -# Re-raise errors caught by the controller. | |
4 | -class HomeController | |
5 | - def rescue_action(e) | |
6 | - raise e | |
7 | - end | |
8 | -end | |
9 | - | |
10 | 3 | class ProfileControllerTest < ActionController::TestCase |
11 | 4 | def setup |
12 | 5 | @env = Environment.default | ... | ... |
plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/profile/comment_group_plugin_profile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CommentGroupPluginProfileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CommentGroupPluginProfileControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/comment_group/test/functional/comment_group_plugin_public_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/public/comment_group_plugin_public_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CommentGroupPluginPublicController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CommentGroupPluginPublicControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/comment_group/test/functional/content_viewer_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | |
3 | -class ContentViewerController | |
4 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
5 | - def rescue_action(e) | |
6 | - raise e | |
7 | - end | |
8 | -end | |
9 | - | |
10 | 3 | class ContentViewerControllerTest < ActionController::TestCase |
11 | 4 | |
12 | 5 | def setup | ... | ... |
plugins/community_block/test/functional/commmunity_block_plugin_profile_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | |
3 | -# Re-raise errors caught by the controller. | |
4 | -class ProfileController | |
5 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
6 | - def rescue_action(e) | |
7 | - raise e | |
8 | - end | |
9 | -end | |
10 | - | |
11 | 3 | class ProfileControllerTest < ActionController::TestCase |
12 | 4 | |
13 | 5 | def setup | ... | ... |
plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb
plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb
plugins/community_track/test/functional/community_track_plugin_myprofile_controller_test.rb
1 | 1 | require_relative '../test_helper' |
2 | 2 | require_relative '../../controllers/myprofile/community_track_plugin_myprofile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CommunityTrackPluginMyprofileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CommunityTrackPluginMyprofileControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb
1 | 1 | require_relative '../test_helper' |
2 | 2 | require_relative '../../controllers/public/community_track_plugin_public_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CommunityTrackPluginPublicController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CommunityTrackPluginPublicControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/container_block/test/functional/container_block_environment_design_controller_test.rb
1 | 1 | require 'test_helper' |
2 | 2 | |
3 | -# Re-raise errors caught by the controller. | |
4 | -class EnvironmentDesignController | |
5 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
6 | - def rescue_action(e) | |
7 | - raise e | |
8 | - end | |
9 | -end | |
10 | - | |
11 | 3 | class EnvironmentDesignControllerTest < ActionController::TestCase |
12 | 4 | |
13 | 5 | def setup | ... | ... |
plugins/container_block/test/functional/container_block_home_controller_test.rb
1 | 1 | require 'test_helper' |
2 | 2 | |
3 | -# Re-raise errors caught by the controller. | |
4 | -class HomeController | |
5 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
6 | - def rescue_action(e) | |
7 | - raise e | |
8 | - end | |
9 | -end | |
10 | - | |
11 | 3 | class HomeControllerTest < ActionController::TestCase |
12 | 4 | |
13 | 5 | def setup |
... | ... | @@ -22,7 +14,7 @@ class HomeControllerTest < ActionController::TestCase |
22 | 14 | |
23 | 15 | box = create(Box, :owner => @environment) |
24 | 16 | @block = create(ContainerBlockPlugin::ContainerBlock, :box => box) |
25 | - | |
17 | + | |
26 | 18 | @environment.boxes = [box] |
27 | 19 | end |
28 | 20 | ... | ... |
plugins/context_content/test/functional/content_viewer_controller_test.rb
plugins/context_content/test/functional/profile_design_controller_test.rb
plugins/custom_forms/test/functional/custom_forms_plugin_myprofile_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/custom_forms_plugin_myprofile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CustomFormsPluginMyprofileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase |
8 | 5 | def setup |
9 | 6 | @controller = CustomFormsPluginMyprofileController.new | ... | ... |
plugins/custom_forms/test/functional/custom_forms_plugin_profile_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/custom_forms_plugin_profile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CustomFormsPluginProfileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CustomFormsPluginProfileControllerTest < ActionController::TestCase |
8 | 5 | def setup |
9 | 6 | @controller = CustomFormsPluginProfileController.new | ... | ... |
plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/display_content_plugin_admin_controller' |
3 | 3 | |
4 | - | |
5 | -# Re-raise errors caught by the controller. | |
6 | -class DisplayContentPluginAdminControllerController; def rescue_action(e) raise e end; end | |
7 | - | |
8 | 4 | class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
9 | 5 | |
10 | 6 | def setup | ... | ... |
plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/display_content_plugin_myprofile_controller' |
3 | 3 | |
4 | - | |
5 | -# Re-raise errors caught by the controller. | |
6 | -class DisplayContentPluginMyprofileControllerController; def rescue_action(e) raise e end; end | |
7 | - | |
8 | 4 | class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
9 | 5 | |
10 | 6 | def setup | ... | ... |
plugins/event/test/functional/event_block_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | |
3 | -# Re-raise errors caught by the controller. | |
4 | -class HomeController | |
5 | - #append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
6 | - def rescue_action(e) | |
7 | - raise e | |
8 | - end | |
9 | -end | |
10 | - | |
11 | 3 | class HomeControllerTest < ActionController::TestCase |
12 | 4 | |
13 | 5 | def setup | ... | ... |
plugins/google_analytics/test/functional/profile_editor_controller_test.rb
plugins/google_cse/test/functional/google_cse_plugin_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/google_cse_plugin_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class GoogleCsePluginController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class GoogleCsePluginControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/html5_video/test/functional/content_viewer_controler_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require 'content_viewer_controller' |
3 | 3 | |
4 | -class ContentViewerController | |
5 | - # Re-raise errors caught by the controller. | |
6 | - def rescue_action(e) raise e end | |
7 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
8 | -end | |
9 | - | |
10 | 4 | class ContentViewerControllerTest < ActionController::TestCase |
11 | 5 | |
12 | 6 | all_fixtures | ... | ... |
plugins/ldap/test/functional/account_controller_plugin_test.rb
plugins/ldap/test/functional/ldap_plugin_admin_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/ldap_plugin_admin_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class LdapPluginAdminController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class LdapPluginAdminControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/mark_comment_as_read/test/functional/mark_comment_as_read_plugin_profile_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/mark_comment_as_read_plugin_profile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class MarkCommentAsReadPluginProfileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class MarkCommentAsReadPluginProfileControllerTest < ActionController::TestCase |
8 | 5 | def setup |
9 | 6 | @controller = MarkCommentAsReadPluginProfileController.new | ... | ... |
plugins/metadata/test/functional/content_viewer_controller_test.rb
plugins/metadata/test/functional/home_controller_test.rb
plugins/metadata/test/functional/manage_products_controller_test.rb
plugins/people_block/test/functional/people_block_plugin_environment_design_controller_test.rb
plugins/people_block/test/functional/people_block_plugin_profile_controller_test.rb
1 | 1 | require_relative '../test_helper' |
2 | 2 | require_relative '../../controllers/people_block_plugin_profile_controller' |
3 | 3 | |
4 | - | |
5 | -# Re-raise errors caught by the controller. | |
6 | -class PeopleBlockPluginProfileController; def rescue_action(e) raise e end; end | |
7 | - | |
8 | 4 | class PeopleBlockPluginProfileControllerTest < ActionController::TestCase |
9 | 5 | |
10 | 6 | def setup | ... | ... |
plugins/people_block/test/functional/people_block_plugin_profile_design_controller_test.rb
plugins/people_block/test/functional/profile_controller_test.rb
plugins/piwik/test/functional/piwik_plugin_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/piwik_plugin_admin_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class PiwikPluginAdminController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class PiwikPluginAdminControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/relevant_content/test/unit/article.rb
plugins/relevant_content/test/unit/relevant_content_block_test.rb
plugins/remote_user/test/functional/remote_user_plugin_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | |
3 | -# Re-raise errors caught by the controller. | |
4 | -class AccountController; def rescue_action(e) raise e end; end | |
5 | - | |
6 | 3 | class AccountControllerTest < ActionController::TestCase |
7 | 4 | def setup |
8 | 5 | @environment = Environment.default | ... | ... |
plugins/shopping_cart/test/functional/shopping_cart_plugin_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/shopping_cart_plugin_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class ShoppingCartPluginController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class ShoppingCartPluginControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/social_share_privacy/test/functional/content_viewer_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../../../app/controllers/public/invite_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class ContentViewerController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class ContentViewerControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/social_share_privacy/test/functional/social_share_privacy_plugin_admin_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/social_share_privacy_plugin_admin_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class SocialSharePrivacyPluginAdminController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class SocialSharePrivacyPluginAdminControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/solr/test/functional/search_controller_test.rb
1 | 1 | require "#{File.dirname(__FILE__)}/../test_helper" |
2 | 2 | require File.dirname(__FILE__) + '/../../lib/ext/facets_browse' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class SearchController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class SearchControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/spaminator/test/functional/spaminator_plugin_admin_controller_test.rb
1 | 1 | require 'test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/spaminator_plugin_admin_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class SpaminatorPluginAdminController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class SpaminatorPluginAdminControllerTest < ActionController::TestCase |
8 | 5 | def setup |
9 | 6 | @controller = SpaminatorPluginAdminController.new | ... | ... |
plugins/statistics/test/functional/statistics_plugin_environment_design_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | |
3 | -# Re-raise errors caught by the controller. | |
4 | -class EnvironmentDesignController; def rescue_action(e) raise e end; end | |
5 | - | |
6 | 3 | class EnvironmentDesignControllerTest < ActionController::TestCase |
7 | 4 | |
8 | 5 | def setup |
... | ... | @@ -136,7 +133,7 @@ class EnvironmentDesignControllerTest < ActionController::TestCase |
136 | 133 | |
137 | 134 | assert_tag :input, :attributes => {:id => 'block_product_counter'} |
138 | 135 | assert_no_tag :input, :attributes => {:id => 'block_product_counter', :checked => 'checked'} |
139 | - end | |
136 | + end | |
140 | 137 | |
141 | 138 | should 'not input category counter be checked by default' do |
142 | 139 | get :edit, :id => @block.id |
... | ... | @@ -162,4 +159,4 @@ class EnvironmentDesignControllerTest < ActionController::TestCase |
162 | 159 | |
163 | 160 | assert_no_tag :input, :attributes => {:id => 'block_hit_counter', :checked => 'checked'} |
164 | 161 | end |
165 | -end | |
166 | 162 | \ No newline at end of file |
163 | +end | ... | ... |
plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb
plugins/statistics/test/functional/statistics_plugin_profile_design_controller_test.rb
plugins/stoa/test/functional/account_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../../../app/controllers/public/account_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class AccountController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class AccountControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | SALT=YAML::load(File.open(StoaPlugin.root_path + 'config.yml'))['salt'] | ... | ... |
plugins/stoa/test/functional/invite_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../../../app/controllers/public/invite_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class InviteController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class InviteControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/stoa/test/functional/profile_editor_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../../../app/controllers/my_profile/profile_editor_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class ProfileEditorController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class StoaPluginProfileEditorControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | SALT=YAML::load(File.open(StoaPlugin.root_path + 'config.yml'))['salt'] | ... | ... |
plugins/stoa/test/functional/stoa_plugin_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/stoa_plugin_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class StoaPluginController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class StoaPluginControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | SALT=YAML::load(File.open(StoaPlugin.root_path + 'config.yml'))['salt'] | ... | ... |
plugins/sub_organizations/test/functional/sub_organizations_plugin_myprofile_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/sub_organizations_plugin_myprofile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class SubOrganizationsPluginMyprofileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class SubOrganizationsPluginMyprofileControllerTest < ActionController::TestCase |
8 | 5 | def setup |
9 | 6 | @controller = SubOrganizationsPluginMyprofileController.new |
... | ... | @@ -94,7 +91,7 @@ class SubOrganizationsPluginMyprofileControllerTest < ActionController::TestCase |
94 | 91 | get :index, :profile => organization.identifier |
95 | 92 | |
96 | 93 | assert_response 403 |
97 | - assert_template 'access_denied' | |
94 | + assert_template 'shared/access_denied' | |
98 | 95 | end |
99 | 96 | |
100 | 97 | should 'not search organizations if dont have permission' do |
... | ... | @@ -107,7 +104,7 @@ class SubOrganizationsPluginMyprofileControllerTest < ActionController::TestCase |
107 | 104 | get :search_organization, :profile => organization.identifier, :q => 'sampl' |
108 | 105 | |
109 | 106 | assert_response 403 |
110 | - assert_template 'access_denied' | |
107 | + assert_template 'shared/access_denied' | |
111 | 108 | end |
112 | 109 | |
113 | 110 | end | ... | ... |
plugins/sub_organizations/test/functional/sub_organizations_plugin_profile_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/sub_organizations_plugin_profile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class SubOrganizationsPluginProfileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class SubOrganizationsPluginProfileControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/video/test/functional/video_plugin_environment_design_controller_test.rb
plugins/video/test/functional/video_plugin_profile_design_controller_test.rb
plugins/vote/test/functional/vote_plugin_admin_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/vote_plugin_admin_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class VotePluginAdminController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class VotePluginAdminControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/vote/test/functional/vote_plugin_profile_controller_test.rb
1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | require File.dirname(__FILE__) + '/../../controllers/vote_plugin_profile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class VotePluginProfileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class VotePluginProfileControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup | ... | ... |
plugins/work_assignment/test/functional/cms_controller_test.rb
1 | 1 | require File.expand_path(File.dirname(__FILE__) + "/../../../../test/test_helper") |
2 | 2 | require 'cms_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CmsController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CmsControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup |
... | ... | @@ -22,7 +19,7 @@ class CmsControllerTest < ActionController::TestCase |
22 | 19 | work_assignment = create_work_assignment('Work Assignment', @organization, nil, nil) |
23 | 20 | get :upload_files, :profile => @organization.identifier, :parent_id => work_assignment.id |
24 | 21 | assert_response :forbidden |
25 | - assert_template 'access_denied' | |
22 | + assert_template 'shared/access_denied' | |
26 | 23 | end |
27 | 24 | |
28 | 25 | should 'allow members to upload submissions on work_assignment' do | ... | ... |
plugins/work_assignment/test/functional/content_viewer_controller_test.rb
1 | 1 | require File.expand_path(File.dirname(__FILE__) + "/../../../../test/test_helper") |
2 | 2 | require 'content_viewer_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class ContentViewerController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class ContentViewerControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup |
... | ... | @@ -30,7 +27,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
30 | 27 | |
31 | 28 | get :view_page, :profile => @organization.identifier, :page => submission.path |
32 | 29 | assert_response :forbidden |
33 | - assert_template 'access_denied' | |
30 | + assert_template 'shared/access_denied' | |
34 | 31 | |
35 | 32 | WorkAssignmentPlugin.stubs(:can_download_submission?).returns(true) |
36 | 33 | ... | ... |
plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb
1 | 1 | require File.expand_path(File.dirname(__FILE__) + "/../../../../test/test_helper") |
2 | 2 | require 'work_assignment_plugin_myprofile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class WorkAssignmentPluginMyprofileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup |
... | ... | @@ -40,9 +37,9 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase |
40 | 37 | assert_equal false, submission.parent.published |
41 | 38 | |
42 | 39 | post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id |
43 | - assert_template 'access_denied' | |
40 | + assert_template 'shared/access_denied' | |
44 | 41 | post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => true } |
45 | - assert_template 'access_denied' | |
42 | + assert_template 'shared/access_denied' | |
46 | 43 | |
47 | 44 | submission.reload |
48 | 45 | assert_equal false, submission.published |
... | ... | @@ -56,9 +53,9 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase |
56 | 53 | assert_equal true, @person.is_admin? |
57 | 54 | |
58 | 55 | post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id |
59 | - assert_template 'access_denied' | |
56 | + assert_template 'shared/access_denied' | |
60 | 57 | post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => true } |
61 | - assert_template 'access_denied' | |
58 | + assert_template 'shared/access_denied' | |
62 | 59 | |
63 | 60 | submission.reload |
64 | 61 | assert_equal false, submission.published |
... | ... | @@ -120,10 +117,10 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase |
120 | 117 | assert_equal(submission.author, @person) |
121 | 118 | |
122 | 119 | post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id |
123 | - assert_template 'access_denied' | |
120 | + assert_template 'shared/access_denied' | |
124 | 121 | |
125 | 122 | post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => true } |
126 | - assert_template 'access_denied' | |
123 | + assert_template 'shared/access_denied' | |
127 | 124 | |
128 | 125 | submission.reload |
129 | 126 | assert_equal false, submission.parent.published |
... | ... | @@ -174,10 +171,10 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase |
174 | 171 | assert_equal false, (@person.is_member_of? submission.profile) |
175 | 172 | |
176 | 173 | post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id |
177 | - assert_template 'access_denied' | |
174 | + assert_template 'shared/access_denied' | |
178 | 175 | |
179 | 176 | post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => true } |
180 | - assert_template 'access_denied' | |
177 | + assert_template 'shared/access_denied' | |
181 | 178 | |
182 | 179 | submission.reload |
183 | 180 | assert_equal false, submission.parent.published | ... | ... |
test/functional/account_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'account_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class AccountController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class AccountControllerTest < ActionController::TestCase |
8 | 5 | # Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead |
9 | 6 | # Then, you can remove it from this and the units test. |
... | ... | @@ -240,28 +237,20 @@ class AccountControllerTest < ActionController::TestCase |
240 | 237 | end |
241 | 238 | |
242 | 239 | should 'provide interface for entering new password' do |
243 | - change = ChangePassword.new | |
244 | - ChangePassword.expects(:from_code).with('osidufgiashfkjsadfhkj99999').returns(change) | |
245 | - person = mock | |
246 | - person.stubs(:identifier).returns('joe') | |
247 | - person.stubs(:name).returns('Joe') | |
248 | - change.stubs(:requestor).returns(person) | |
240 | + code = 'osidufgiashfkjsadfhkj99999' | |
241 | + person = create_user('joe').person | |
242 | + change = ChangePassword.create! code: code, requestor: person | |
249 | 243 | |
250 | - get :new_password, :code => 'osidufgiashfkjsadfhkj99999' | |
244 | + get :new_password, code: code | |
251 | 245 | assert_equal change, assigns(:change_password) |
252 | 246 | end |
253 | 247 | |
254 | 248 | should 'actually change password after entering new password' do |
255 | - change = ChangePassword.new | |
256 | - ChangePassword.expects(:from_code).with('osidufgiashfkjsadfhkj99999').returns(change) | |
249 | + code = 'osidufgiashfkjsadfhkj99999' | |
250 | + person = create_user('joe').person | |
251 | + ChangePassword.create! code: code, requestor: person | |
257 | 252 | |
258 | - requestor = mock | |
259 | - requestor.stubs(:identifier).returns('joe') | |
260 | - change.stubs(:requestor).returns(requestor) | |
261 | - change.expects(:update_attributes!).with({'password' => 'newpass', 'password_confirmation' => 'newpass'}) | |
262 | - change.expects(:finish) | |
263 | - | |
264 | - post :new_password, :code => 'osidufgiashfkjsadfhkj99999', :change_password => { :password => 'newpass', :password_confirmation => 'newpass' } | |
253 | + post :new_password, code: code, change_password: { password: 'newpass', password_confirmation: 'newpass' } | |
265 | 254 | |
266 | 255 | assert_template 'new_password_ok' |
267 | 256 | end |
... | ... | @@ -323,8 +312,6 @@ class AccountControllerTest < ActionController::TestCase |
323 | 312 | person = create_user('mylogin').person |
324 | 313 | login_as(person.identifier) |
325 | 314 | |
326 | - EnterpriseActivation.expects(:from_code).with('some_invalid_code').returns(nil).at_least_once | |
327 | - | |
328 | 315 | get :activation_question, :enterprise_code => 'some_invalid_code' |
329 | 316 | |
330 | 317 | assert_template 'invalid_enterprise_code' |
... | ... | @@ -336,9 +323,7 @@ class AccountControllerTest < ActionController::TestCase |
336 | 323 | |
337 | 324 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => true) |
338 | 325 | ent.update_attribute(:cnpj, '0'*14) |
339 | - task = mock | |
340 | - task.expects(:enterprise).returns(ent).at_least_once | |
341 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
326 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
342 | 327 | |
343 | 328 | get :activation_question, :enterprise_code => '0123456789' |
344 | 329 | |
... | ... | @@ -350,10 +335,7 @@ class AccountControllerTest < ActionController::TestCase |
350 | 335 | login_as(person.identifier) |
351 | 336 | |
352 | 337 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent') |
353 | - | |
354 | - task = mock | |
355 | - task.expects(:enterprise).returns(ent).at_least_once | |
356 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
338 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
357 | 339 | |
358 | 340 | get :activation_question, :enterprise_code => '0123456789' |
359 | 341 | |
... | ... | @@ -365,10 +347,7 @@ class AccountControllerTest < ActionController::TestCase |
365 | 347 | login_as(person.identifier) |
366 | 348 | |
367 | 349 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) |
368 | - | |
369 | - task = mock | |
370 | - task.expects(:enterprise).returns(ent).at_least_once | |
371 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
350 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
372 | 351 | |
373 | 352 | get :activation_question, :enterprise_code => '0123456789' |
374 | 353 | |
... | ... | @@ -381,10 +360,7 @@ class AccountControllerTest < ActionController::TestCase |
381 | 360 | |
382 | 361 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) |
383 | 362 | ent.update_attribute(:foundation_year, 1998) |
384 | - | |
385 | - task = mock | |
386 | - task.expects(:enterprise).returns(ent).at_least_once | |
387 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
363 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
388 | 364 | |
389 | 365 | get :activation_question, :enterprise_code => '0123456789' |
390 | 366 | |
... | ... | @@ -397,10 +373,7 @@ class AccountControllerTest < ActionController::TestCase |
397 | 373 | |
398 | 374 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) |
399 | 375 | ent.update_attribute(:cnpj, '0'*14) |
400 | - | |
401 | - task = mock | |
402 | - task.expects(:enterprise).returns(ent).at_least_once | |
403 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
376 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
404 | 377 | |
405 | 378 | get :activation_question, :enterprise_code => '0123456789' |
406 | 379 | |
... | ... | @@ -414,10 +387,7 @@ class AccountControllerTest < ActionController::TestCase |
414 | 387 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) |
415 | 388 | ent.update_attribute(:foundation_year, 1998) |
416 | 389 | ent.block |
417 | - | |
418 | - task = mock | |
419 | - task.expects(:enterprise).returns(ent).at_least_once | |
420 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
390 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
421 | 391 | |
422 | 392 | get :activation_question, :enterprise_code => '0123456789' |
423 | 393 | |
... | ... | @@ -430,10 +400,7 @@ class AccountControllerTest < ActionController::TestCase |
430 | 400 | |
431 | 401 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) |
432 | 402 | ent.update_attribute(:foundation_year, 1998) |
433 | - | |
434 | - task = mock | |
435 | - task.expects(:enterprise).returns(ent).at_least_once | |
436 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
403 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
437 | 404 | |
438 | 405 | get :activation_question, :enterprise_code => '0123456789' |
439 | 406 | |
... | ... | @@ -443,10 +410,7 @@ class AccountControllerTest < ActionController::TestCase |
443 | 410 | should 'require login for accept terms' do |
444 | 411 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) |
445 | 412 | ent.update_attribute(:foundation_year, 1998) |
446 | - | |
447 | - task = mock | |
448 | - task.expects(:enterprise).returns(ent).never | |
449 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).never | |
413 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
450 | 414 | |
451 | 415 | post :accept_terms, :enterprise_code => '0123456789', :answer => '1998' |
452 | 416 | |
... | ... | @@ -459,10 +423,7 @@ class AccountControllerTest < ActionController::TestCase |
459 | 423 | |
460 | 424 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) |
461 | 425 | ent.update_attribute(:foundation_year, 1998) |
462 | - | |
463 | - task = mock | |
464 | - task.expects(:enterprise).returns(ent).at_least_once | |
465 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
426 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
466 | 427 | |
467 | 428 | post :accept_terms, :enterprise_code => '0123456789', :answer => '1997' |
468 | 429 | |
... | ... | @@ -483,8 +444,7 @@ class AccountControllerTest < ActionController::TestCase |
483 | 444 | |
484 | 445 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) |
485 | 446 | ent.update_attribute(:foundation_year, 1998) |
486 | - task = EnterpriseActivation.create!(:enterprise => ent) | |
487 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
447 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
488 | 448 | |
489 | 449 | post :accept_terms, :enterprise_code => '0123456789', :answer => '1998' |
490 | 450 | |
... | ... | @@ -500,10 +460,7 @@ class AccountControllerTest < ActionController::TestCase |
500 | 460 | ent.update_attribute(:foundation_year, 1998) |
501 | 461 | ent.block |
502 | 462 | ent.save |
503 | - | |
504 | - task = mock | |
505 | - task.expects(:enterprise).returns(ent).at_least_once | |
506 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
463 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
507 | 464 | |
508 | 465 | get :accept_terms, :enterprise_code => '0123456789', :answer => 1998 |
509 | 466 | |
... | ... | @@ -516,8 +473,7 @@ class AccountControllerTest < ActionController::TestCase |
516 | 473 | env.save! |
517 | 474 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) |
518 | 475 | ent.update_attribute(:foundation_year, 1998) |
519 | - task = EnterpriseActivation.create!(:enterprise => ent) | |
520 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).never | |
476 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
521 | 477 | |
522 | 478 | post :activate_enterprise, :enterprise_code => '0123456789', :answer => '1998', :terms_accepted => true |
523 | 479 | |
... | ... | @@ -525,13 +481,12 @@ class AccountControllerTest < ActionController::TestCase |
525 | 481 | end |
526 | 482 | |
527 | 483 | should 'not activate if user does not accept terms' do |
528 | - ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) | |
529 | - ent.update_attribute(:foundation_year, 1998) | |
530 | 484 | p = create_user('test_user', :password => 'blih', :password_confirmation => 'blih', :email => 'test@noosfero.com').person |
531 | 485 | login_as(p.identifier) |
532 | 486 | |
533 | - task = EnterpriseActivation.create!(:enterprise => ent) | |
534 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
487 | + ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) | |
488 | + ent.update_attribute(:foundation_year, 1998) | |
489 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
535 | 490 | |
536 | 491 | post :activate_enterprise, :enterprise_code => '0123456789', :answer => '1998', :terms_accepted => false |
537 | 492 | ent.reload |
... | ... | @@ -541,13 +496,12 @@ class AccountControllerTest < ActionController::TestCase |
541 | 496 | end |
542 | 497 | |
543 | 498 | should 'activate enterprise and make logged user admin' do |
544 | - ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) | |
545 | - ent.update_attribute(:foundation_year, 1998) | |
546 | 499 | p = create_user('test_user', :password => 'blih', :password_confirmation => 'blih', :email => 'test@noosfero.com').person |
547 | 500 | login_as(p.identifier) |
548 | 501 | |
549 | - task = EnterpriseActivation.create!(:enterprise => ent) | |
550 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
502 | + ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) | |
503 | + ent.update_attribute(:foundation_year, 1998) | |
504 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
551 | 505 | |
552 | 506 | post :activate_enterprise, :enterprise_code => '0123456789', :answer => '1998', :terms_accepted => true |
553 | 507 | ent.reload |
... | ... | @@ -565,8 +519,7 @@ class AccountControllerTest < ActionController::TestCase |
565 | 519 | env.save! |
566 | 520 | ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) |
567 | 521 | ent.update_attribute(:foundation_year, 1998) |
568 | - task = EnterpriseActivation.create!(:enterprise => ent) | |
569 | - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once | |
522 | + EnterpriseActivation.create! code: '0123456789', enterprise: ent | |
570 | 523 | |
571 | 524 | post :activate_enterprise, :enterprise_code => '0123456789', :answer => '1998', :terms_accepted => true |
572 | 525 | ... | ... |
test/functional/admin_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'admin_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class AdminController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class AdminControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | should 'inherit from ApplicationController' do | ... | ... |
test/functional/admin_panel_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'admin_panel_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class AdminPanelController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class AdminPanelControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | all_fixtures |
... | ... | @@ -127,7 +124,7 @@ class AdminPanelControllerTest < ActionController::TestCase |
127 | 124 | should 'sanitize message for disabled enterprise with white_list' do |
128 | 125 | post :site_info, :environment => { :message_for_disabled_enterprise => "This <strong>is</strong> <script>alert('alow')</script>my new environment" } |
129 | 126 | assert_redirected_to :action => 'index' |
130 | - assert_equal "This <strong>is</strong> my new environment", Environment.default.message_for_disabled_enterprise | |
127 | + assert_equal "This <strong>is</strong> alert('alow')my new environment", Environment.default.message_for_disabled_enterprise | |
131 | 128 | end |
132 | 129 | |
133 | 130 | should 'save site article date format option' do | ... | ... |
test/functional/application_controller_test.rb
... | ... | @@ -2,9 +2,6 @@ |
2 | 2 | require_relative "../test_helper" |
3 | 3 | require 'test_controller' |
4 | 4 | |
5 | -# Re-raise errors caught by the controller. | |
6 | -class TestController; def rescue_action(e) raise e end; end | |
7 | - | |
8 | 5 | class ApplicationControllerTest < ActionController::TestCase |
9 | 6 | all_fixtures |
10 | 7 | def setup | ... | ... |
test/functional/catalog_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'catalog_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CatalogController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CatalogControllerTest < ActionController::TestCase |
8 | 5 | def setup |
9 | 6 | @controller = CatalogController.new | ... | ... |
test/functional/categories_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'categories_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CategoriesController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CategoriesControllerTest < ActionController::TestCase |
8 | 5 | all_fixtures |
9 | 6 | def setup |
10 | 7 | @controller = CategoriesController.new |
11 | 8 | @request = ActionController::TestRequest.new |
12 | 9 | @response = ActionController::TestResponse.new |
13 | - | |
10 | + | |
14 | 11 | @env = fast_create(Environment, :name => "My test environment") |
15 | 12 | Environment.stubs(:default).returns(env) |
16 | 13 | assert (@cat1 = env.categories.create(:name => 'a test category')) |
... | ... | @@ -25,9 +22,6 @@ class CategoriesControllerTest < ActionController::TestCase |
25 | 22 | get :index |
26 | 23 | assert_response :success |
27 | 24 | assert_template 'index' |
28 | - assert_kind_of Array, assigns(:categories) | |
29 | - assert_kind_of Array, assigns(:product_categories) | |
30 | - assert_kind_of Array, assigns(:regions) | |
31 | 25 | assert_tag :tag => 'a', :attributes => { :href => '/admin/categories/new'} |
32 | 26 | end |
33 | 27 | ... | ... |
test/functional/cms_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'cms_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CmsController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CmsControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | include NoosferoTestHelper |
... | ... | @@ -1237,7 +1234,7 @@ class CmsControllerTest < ActionController::TestCase |
1237 | 1234 | |
1238 | 1235 | get :new, :profile => c.identifier |
1239 | 1236 | assert_response :forbidden |
1240 | - assert_template 'access_denied' | |
1237 | + assert_template 'shared/access_denied' | |
1241 | 1238 | end |
1242 | 1239 | |
1243 | 1240 | should 'allow user with permission create an article in community' do |
... | ... | @@ -1259,7 +1256,7 @@ class CmsControllerTest < ActionController::TestCase |
1259 | 1256 | |
1260 | 1257 | get :edit, :profile => c.identifier, :id => a.id |
1261 | 1258 | assert_response :forbidden |
1262 | - assert_template 'access_denied' | |
1259 | + assert_template 'shared/access_denied' | |
1263 | 1260 | end |
1264 | 1261 | |
1265 | 1262 | should 'not allow user edit article if he is owner but has no publish permission' do |
... | ... | @@ -1270,7 +1267,7 @@ class CmsControllerTest < ActionController::TestCase |
1270 | 1267 | |
1271 | 1268 | get :edit, :profile => c.identifier, :id => a.id |
1272 | 1269 | assert_response :forbidden |
1273 | - assert_template 'access_denied' | |
1270 | + assert_template 'shared/access_denied' | |
1274 | 1271 | end |
1275 | 1272 | |
1276 | 1273 | should 'allow user edit article if he is owner and has publish permission' do |
... | ... | @@ -1782,7 +1779,7 @@ class CmsControllerTest < ActionController::TestCase |
1782 | 1779 | |
1783 | 1780 | get :upload_files, :profile => c.identifier, :parent_id => a.id |
1784 | 1781 | assert_response :forbidden |
1785 | - assert_template 'access_denied' | |
1782 | + assert_template 'shared/access_denied' | |
1786 | 1783 | end |
1787 | 1784 | |
1788 | 1785 | should 'filter profile folders to select' do | ... | ... |
test/functional/comment_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'comment_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class CommentController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class CommentControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup |
... | ... | @@ -358,7 +355,7 @@ class CommentControllerTest < ActionController::TestCase |
358 | 355 | should "render the root comment when a reply is made" do |
359 | 356 | login_as profile.identifier |
360 | 357 | page = profile.articles.create!(:name => 'myarticle') |
361 | - | |
358 | + | |
362 | 359 | comment = fast_create(Comment, :body => 'some content', :source_id => page.id, :source_type => 'Article') |
363 | 360 | |
364 | 361 | xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => {:body => 'Some comment...', :reply_of_id => comment.id}, :confirm => 'true' | ... | ... |
test/functional/contact_controller_test.rb
... | ... | @@ -2,9 +2,6 @@ |
2 | 2 | require_relative "../test_helper" |
3 | 3 | require 'contact_controller' |
4 | 4 | |
5 | -# Re-raise errors caught by the controller. | |
6 | -class ContactController; def rescue_action(e) raise e end; end | |
7 | - | |
8 | 5 | class ContactControllerTest < ActionController::TestCase |
9 | 6 | |
10 | 7 | all_fixtures |
... | ... | @@ -140,7 +137,7 @@ class ContactControllerTest < ActionController::TestCase |
140 | 137 | post :new, :profile => community.identifier |
141 | 138 | |
142 | 139 | assert_response :forbidden |
143 | - assert_template :access_denied | |
140 | + assert_template 'shared/access_denied' | |
144 | 141 | end |
145 | 142 | |
146 | 143 | should 'show send e-mail page to members of private community' do | ... | ... |
test/functional/content_viewer_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'content_viewer_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class ContentViewerController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class ContentViewerControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | all_fixtures |
... | ... | @@ -194,7 +191,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
194 | 191 | |
195 | 192 | get :view_page, :profile => community.identifier, :page => [ folder.path ] |
196 | 193 | |
197 | - assert_template 'access_denied' | |
194 | + assert_template 'shared/access_denied' | |
198 | 195 | end |
199 | 196 | |
200 | 197 | should 'show private content to profile moderators' do |
... | ... | @@ -297,7 +294,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
297 | 294 | |
298 | 295 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
299 | 296 | |
300 | - assert_template 'access_denied' | |
297 | + assert_template 'shared/access_denied' | |
301 | 298 | end |
302 | 299 | |
303 | 300 | should 'give access to private articles if logged in and moderator' do | ... | ... |
test/functional/edit_template_controller_test.rb
... | ... | @@ -3,9 +3,6 @@ |
3 | 3 | require_relative "../test_helper" |
4 | 4 | require 'edit_template_controller' |
5 | 5 | |
6 | -# Re-raise errors caught by the controller. | |
7 | -class EditTemplateController; def rescue_action(e) raise e end; end | |
8 | - | |
9 | 6 | class EditTemplateControllerTest < ActionController::TestCase |
10 | 7 | all_fixtures |
11 | 8 | def setup | ... | ... |
test/functional/enterprise_registration_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'enterprise_registration_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class EnterpriseRegistrationController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class EnterpriseRegistrationControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | # all_fixtures:users |
... | ... | @@ -159,7 +156,7 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase |
159 | 156 | post :index, :create_enterprise => { 'name' => 'name', 'identifier' => 'mynew', :economic_activity => '<b>economic_activity</b>' } |
160 | 157 | assert_sanitized assigns(:create_enterprise).economic_activity |
161 | 158 | end |
162 | - | |
159 | + | |
163 | 160 | should 'filter html from management_information' do |
164 | 161 | post :index, :create_enterprise => { 'name' => 'name', 'identifier' => 'mynew', :management_information => '<b>management_information</b>' } |
165 | 162 | assert_sanitized assigns(:create_enterprise).management_information | ... | ... |
test/functional/enterprise_validation_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'enterprise_validation_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class EnterpriseValidationController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class EnterpriseValidationControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | all_fixtures |
... | ... | @@ -12,7 +9,7 @@ class EnterpriseValidationControllerTest < ActionController::TestCase |
12 | 9 | @controller = EnterpriseValidationController.new |
13 | 10 | @request = ActionController::TestRequest.new |
14 | 11 | @response = ActionController::TestResponse.new |
15 | - | |
12 | + | |
16 | 13 | login_as 'ze' |
17 | 14 | @org = Organization.create!(:identifier => 'myorg', :name => "My Org") |
18 | 15 | give_permission('ze', 'validate_enterprise', @org) |
... | ... | @@ -78,7 +75,7 @@ class EnterpriseValidationControllerTest < ActionController::TestCase |
78 | 75 | should 'list validations already processed' do |
79 | 76 | processed_validations = [CreateEnterprise.new] |
80 | 77 | @org.expects(:processed_validations).returns(processed_validations) |
81 | - | |
78 | + | |
82 | 79 | get :list_processed, :profile => 'myorg' |
83 | 80 | |
84 | 81 | assert_equal processed_validations, assigns(:processed_validations) |
... | ... | @@ -86,7 +83,7 @@ class EnterpriseValidationControllerTest < ActionController::TestCase |
86 | 83 | assert_response :success |
87 | 84 | assert_template 'list_processed' |
88 | 85 | end |
89 | - | |
86 | + | |
90 | 87 | should 'be able to display a validation that was already processed' do |
91 | 88 | validation = CreateEnterprise.new |
92 | 89 | @org.expects(:find_processed_validation).with('kakakaka').returns(validation) |
... | ... | @@ -106,7 +103,7 @@ class EnterpriseValidationControllerTest < ActionController::TestCase |
106 | 103 | info = ValidationInfo.new(:validation_methodology => 'none') |
107 | 104 | @org.expects(:validation_info).returns(info) |
108 | 105 | post :edit_validation_info, :profile => 'myorg', :info => {:validation_methodology => 'new methodology'} |
109 | - | |
106 | + | |
110 | 107 | assert_response :redirect |
111 | 108 | assert_redirected_to :action => 'index' |
112 | 109 | assert_equal info, assigns(:info) |
... | ... | @@ -116,7 +113,7 @@ class EnterpriseValidationControllerTest < ActionController::TestCase |
116 | 113 | info = ValidationInfo.new(:validation_methodology => 'none') |
117 | 114 | @org.expects(:validation_info).returns(info) |
118 | 115 | post :edit_validation_info, :profile => 'myorg', :info => {:validation_methodology => ''} |
119 | - | |
116 | + | |
120 | 117 | assert_response :success |
121 | 118 | assert_equal info, assigns(:info) |
122 | 119 | end | ... | ... |
test/functional/environment_design_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'environment_design_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class EnvironmentDesignController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class EnvironmentDesignControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | ALL_BLOCKS = [ArticleBlock, LoginBlock, RecentDocumentsBlock, EnterprisesBlock, CommunitiesBlock, SellersSearchBlock, LinkListBlock, FeedReaderBlock, SlideshowBlock, HighlightsBlock, FeaturedProductsBlock, CategoriesBlock, RawHTMLBlock, TagsBlock ] | ... | ... |
test/functional/environment_role_manager_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'environment_role_manager_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class EnvironmentRoleManagerController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class EnvironmentRoleManagerControllerTest < ActionController::TestCase |
8 | 5 | def setup |
9 | 6 | @controller = EnvironmentRoleManagerController.new | ... | ... |
test/functional/environment_themes_controller_test.rb
test/functional/events_controller_test.rb
... | ... | @@ -69,7 +69,7 @@ class EventsControllerTest < ActionController::TestCase |
69 | 69 | post :events, :profile => community.identifier |
70 | 70 | |
71 | 71 | assert_response :forbidden |
72 | - assert_template :access_denied | |
72 | + assert_template 'shared/access_denied' | |
73 | 73 | end |
74 | 74 | |
75 | 75 | should 'show events page to members of private community' do | ... | ... |
test/functional/favorite_enterprises_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'favorite_enterprises_controller' |
3 | 3 | |
4 | -class FavoriteEnterprisesController; def rescue_action(e) raise e end; end | |
5 | - | |
6 | 4 | class FavoriteEnterprisesControllerTest < ActionController::TestCase |
7 | 5 | |
8 | - noosfero_test :profile => 'testuser' | |
9 | - | |
6 | + self.default_params = {profile: 'testuser'} | |
10 | 7 | def setup |
11 | 8 | @controller = FavoriteEnterprisesController.new |
12 | 9 | @request = ActionController::TestRequest.new |
... | ... | @@ -31,7 +28,7 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase |
31 | 28 | assert_response :success |
32 | 29 | assert_template 'add' |
33 | 30 | |
34 | - ok("must load the favorite enterprise being added to display") { favorite_enterprise == assigns(:favorite_enterprise) } | |
31 | + ok("must load the favorite enterprise being added to display") { favorite_enterprise == assigns(:favorite_enterprise) } | |
35 | 32 | |
36 | 33 | end |
37 | 34 | ... | ... |
test/functional/features_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'features_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class FeaturesController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class FeaturesControllerTest < ActionController::TestCase |
8 | 5 | |
9 | - all_fixtures | |
6 | + all_fixtures | |
10 | 7 | def setup |
11 | 8 | @controller = FeaturesController.new |
12 | 9 | @request = ActionController::TestRequest.new |
13 | 10 | @response = ActionController::TestResponse.new |
14 | 11 | login_as(create_admin_user(Environment.find(2))) |
15 | 12 | end |
16 | - | |
13 | + | |
17 | 14 | def test_listing_features |
18 | 15 | uses_host 'anhetegua.net' |
19 | 16 | get :index |
... | ... | @@ -37,7 +34,7 @@ class FeaturesControllerTest < ActionController::TestCase |
37 | 34 | assert_kind_of String, session[:notice] |
38 | 35 | v = Environment.find(environments(:anhetegua_net).id) |
39 | 36 | assert v.enabled?('feature2') |
40 | - assert v.enabled?('feature2') | |
37 | + assert v.enabled?('feature2') | |
41 | 38 | assert !v.enabled?('feature3') |
42 | 39 | end |
43 | 40 | ... | ... |
test/functional/friends_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'friends_controller' |
3 | 3 | |
4 | -class FriendsController; def rescue_action(e) raise e end; end | |
5 | - | |
6 | 4 | class FriendsControllerTest < ActionController::TestCase |
7 | 5 | |
8 | - noosfero_test :profile => 'testuser' | |
9 | - | |
6 | + self.default_params = {profile: 'testuser'} | |
10 | 7 | def setup |
11 | 8 | @controller = FriendsController.new |
12 | 9 | @request = ActionController::TestRequest.new | ... | ... |
test/functional/home_controller_test.rb
test/functional/licenses_controller_test.rb
test/functional/manage_products_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'manage_products_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class ManageProductsController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class ManageProductsControllerTest < ActionController::TestCase |
8 | 5 | all_fixtures |
9 | 6 | def setup |
... | ... | @@ -23,7 +20,7 @@ class ManageProductsControllerTest < ActionController::TestCase |
23 | 20 | login_as :user_test |
24 | 21 | get 'index', :profile => @enterprise.identifier |
25 | 22 | assert :success |
26 | - assert_template 'access_denied' | |
23 | + assert_template 'shared/access_denied' | |
27 | 24 | end |
28 | 25 | |
29 | 26 | should "get index" do | ... | ... |
test/functional/map_balloon_controller_test.rb
test/functional/maps_controller_test.rb
... | ... | @@ -2,9 +2,6 @@ |
2 | 2 | require_relative "../test_helper" |
3 | 3 | require 'maps_controller' |
4 | 4 | |
5 | -# Re-raise errors caught by the controller. | |
6 | -class MapsController; def rescue_action(e) raise e end; end | |
7 | - | |
8 | 5 | class MapsControllerTest < ActionController::TestCase |
9 | 6 | |
10 | 7 | def setup |
... | ... | @@ -30,8 +27,8 @@ class MapsControllerTest < ActionController::TestCase |
30 | 27 | city = 'Santo Afonso' |
31 | 28 | state = 'Mato Grosso' |
32 | 29 | |
33 | - fast_create(NationalRegion, :name => 'Brasil', | |
34 | - :national_region_code => 'BR', | |
30 | + fast_create(NationalRegion, :name => 'Brasil', | |
31 | + :national_region_code => 'BR', | |
35 | 32 | :national_region_type_id => NationalRegionType::COUNTRY) |
36 | 33 | |
37 | 34 | parent_region = fast_create(NationalRegion, :name => state, |
... | ... | @@ -43,7 +40,7 @@ class MapsControllerTest < ActionController::TestCase |
43 | 40 | :national_region_type_id => NationalRegionType::CITY, |
44 | 41 | :parent_national_region_code => parent_region.national_region_code) |
45 | 42 | |
46 | - post :edit_location, :profile => profile.identifier, :profile_data => { | |
43 | + post :edit_location, :profile => profile.identifier, :profile_data => { | |
47 | 44 | :address => 'new address', |
48 | 45 | :country => 'BR', |
49 | 46 | :city => city, | ... | ... |
test/functional/memberships_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'memberships_controller' |
3 | 3 | |
4 | - | |
5 | -# Re-raise errors caught by the controller. | |
6 | -class MembershipsController; def rescue_action(e) raise e end; end | |
7 | - | |
8 | 4 | class MembershipsControllerTest < ActionController::TestCase |
9 | 5 | |
10 | 6 | include ApplicationHelper | ... | ... |
test/functional/my_profile_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'my_profile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class MyProfileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class OnlyForPersonTestController < MyProfileController |
8 | 5 | requires_profile_class Person |
9 | 6 | def index | ... | ... |
test/functional/organizations_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'organizations_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class OrganizationsController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class OrganizationsControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup |
... | ... | @@ -11,13 +8,11 @@ class OrganizationsControllerTest < ActionController::TestCase |
11 | 8 | @request = ActionController::TestRequest.new |
12 | 9 | @response = ActionController::TestResponse.new |
13 | 10 | |
14 | - Environment.destroy_all | |
15 | - @environment = fast_create(Environment, :is_default => true) | |
11 | + @environment = Environment.default | |
16 | 12 | |
17 | 13 | admin_user = create_user_with_permission('adminuser', 'manage_environment_organizations', environment) |
18 | 14 | login_as('adminuser') |
19 | 15 | end |
20 | - | |
21 | 16 | attr_accessor :environment |
22 | 17 | |
23 | 18 | should 'not access without right permission' do |
... | ... | @@ -40,7 +35,7 @@ class OrganizationsControllerTest < ActionController::TestCase |
40 | 35 | get :index, :filter => 'enabled' |
41 | 36 | |
42 | 37 | assert_match(/enabled community/, @response.body) |
43 | - assert_not_match(/disabled community/, @response.body) | |
38 | + assert_no_match(/disabled community/, @response.body) | |
44 | 39 | end |
45 | 40 | |
46 | 41 | should 'show list to activate organizations' do |
... | ... | @@ -50,7 +45,7 @@ class OrganizationsControllerTest < ActionController::TestCase |
50 | 45 | |
51 | 46 | get :index, :filter => 'disabled' |
52 | 47 | |
53 | - assert_not_match(/enabled community/, @response.body) | |
48 | + assert_no_match(/enabled community/, @response.body) | |
54 | 49 | assert_match(/disabled community/, @response.body) |
55 | 50 | end |
56 | 51 | |
... | ... | @@ -61,7 +56,7 @@ class OrganizationsControllerTest < ActionController::TestCase |
61 | 56 | get :index, :type => 'Enterprise' |
62 | 57 | |
63 | 58 | assert_match(/Enterprise Test/, @response.body) |
64 | - assert_not_match(/Community Test/, @response.body) | |
59 | + assert_no_match(/Community Test/, @response.body) | |
65 | 60 | end |
66 | 61 | |
67 | 62 | should 'show list only of communities' do |
... | ... | @@ -70,7 +65,7 @@ class OrganizationsControllerTest < ActionController::TestCase |
70 | 65 | |
71 | 66 | get :index, :type => 'Community' |
72 | 67 | |
73 | - assert_not_match(/Enterprise Test/, @response.body) | |
68 | + assert_no_match(/Enterprise Test/, @response.body) | |
74 | 69 | assert_match(/Community Test/, @response.body) |
75 | 70 | end |
76 | 71 | ... | ... |
test/functional/plugin_admin_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | +require 'plugin_admin_controller' | |
2 | 3 | |
3 | 4 | class PluginAdminController |
4 | 5 | def index |
... | ... | @@ -8,6 +9,10 @@ end |
8 | 9 | |
9 | 10 | class PluginAdminControllerTest < ActionController::TestCase |
10 | 11 | |
12 | + def setup | |
13 | + @controller = PluginAdminController.new | |
14 | + end | |
15 | + | |
11 | 16 | should 'allow user with the required permission to access plugin administration page' do |
12 | 17 | create_user_with_permission('testuser', 'edit_environment_features', Environment.default) |
13 | 18 | login_as('testuser') | ... | ... |
test/functional/plugins_controller_test.rb
test/functional/profile_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'profile_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class ProfileController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class ProfileControllerTest < ActionController::TestCase |
5 | + | |
6 | + self.default_params = {profile: 'testuser'} | |
8 | 7 | def setup |
9 | 8 | Environment.default.enable('products_for_enterprises') |
10 | 9 | @profile = create_user('testuser').person |
11 | 10 | end |
12 | 11 | attr_reader :profile |
13 | 12 | |
14 | - noosfero_test :profile => 'testuser' | |
15 | - | |
16 | 13 | should 'list friends' do |
17 | 14 | get :friends |
18 | 15 | ... | ... |
test/functional/profile_design_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'profile_design_controller' |
3 | 3 | |
4 | -class ProfileDesignController; def rescue_action(e) raise e end; end | |
5 | - | |
6 | 4 | class ProfileDesignControllerTest < ActionController::TestCase |
7 | 5 | |
8 | 6 | COMMOM_BLOCKS = [ ArticleBlock, TagsBlock, RecentDocumentsBlock, ProfileInfoBlock, LinkListBlock, MyNetworkBlock, FeedReaderBlock, ProfileImageBlock, LocationBlock, SlideshowBlock, ProfileSearchBlock, HighlightsBlock ] | ... | ... |
test/functional/profile_editor_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'profile_editor_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class ProfileEditorController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class ProfileEditorControllerTest < ActionController::TestCase |
8 | 5 | all_fixtures |
9 | 6 | ... | ... |
test/functional/profile_members_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'profile_members_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class ProfileMembersController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class ProfileMembersControllerTest < ActionController::TestCase |
8 | 5 | def setup |
9 | 6 | super |
... | ... | @@ -20,7 +17,7 @@ class ProfileMembersControllerTest < ActionController::TestCase |
20 | 17 | get 'index', :profile => 'test_enterprise' |
21 | 18 | |
22 | 19 | assert_response 403 |
23 | - assert_template 'access_denied' | |
20 | + assert_template 'shared/access_denied' | |
24 | 21 | end |
25 | 22 | |
26 | 23 | should 'access index' do | ... | ... |
test/functional/profile_roles_controller_test.rb
... | ... | @@ -28,7 +28,7 @@ class ProfileRolesControllerTest < ActionController::TestCase |
28 | 28 | post :create, :profile => community.identifier, :role => {:name => "new_admin", :permissions => ["edit_profile"] } |
29 | 29 | |
30 | 30 | assert_response 403 |
31 | - assert_template 'access_denied' | |
31 | + assert_template 'shared/access_denied' | |
32 | 32 | |
33 | 33 | role = Role.where(:name => 'new_admin') |
34 | 34 | ... | ... |
test/functional/profile_search_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'profile_search_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class ProfileSearchController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class ProfileSearchControllerTest < ActionController::TestCase |
8 | 5 | def setup |
9 | 6 | @controller = ProfileSearchController.new |
... | ... | @@ -96,7 +93,7 @@ class ProfileSearchControllerTest < ActionController::TestCase |
96 | 93 | end |
97 | 94 | |
98 | 95 | should 'display number of results found' do |
99 | - article1 = TextileArticle.create(:name => 'Article 1', :body => 'Article to test profile search', :body => 'Article to test profile search', :profile => person) | |
96 | + article1 = TextileArticle.create(:name => 'Article 1', :body => 'Article to test profile search', :profile => person) | |
100 | 97 | article2 = TextileArticle.create(:name => 'Article 2', :body => 'Another article to test profile search', :profile => person) |
101 | 98 | |
102 | 99 | get 'index', :profile => person.identifier, :q => 'article to test' | ... | ... |
test/functional/profile_themes_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | -# require 'profile_themes_controller' | |
3 | - | |
4 | -class ProfileThemesController; def rescue_action(e) raise e end; end | |
5 | 2 | |
6 | 3 | class ProfileThemesControllerTest < ActionController::TestCase |
7 | 4 | |
... | ... | @@ -116,7 +113,7 @@ class ProfileThemesControllerTest < ActionController::TestCase |
116 | 113 | |
117 | 114 | should 'create a new theme' do |
118 | 115 | post :new, :profile => 'testinguser', :name => 'My theme' |
119 | - | |
116 | + | |
120 | 117 | ok('theme should be created') do |
121 | 118 | profile.themes.first.id == 'my-theme' |
122 | 119 | end |
... | ... | @@ -197,7 +194,7 @@ class ProfileThemesControllerTest < ActionController::TestCase |
197 | 194 | should 'display "add image" button' do |
198 | 195 | theme = Theme.create('mytheme', :owner => profile) |
199 | 196 | get :edit, :profile => 'testinguser', :id => 'mytheme' |
200 | - | |
197 | + | |
201 | 198 | assert_tag :tag => 'a', :attributes => { :href => '/myprofile/testinguser/profile_themes/add_image/mytheme' } |
202 | 199 | end |
203 | 200 | ... | ... |
test/functional/public_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'public_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class PublicController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class PublicControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | should 'inherit from ApplicationController' do | ... | ... |
test/functional/region_validators_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'region_validators_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class RegionValidatorsController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class RegionValidatorsControllerTest < ActionController::TestCase |
8 | 5 | all_fixtures |
9 | 6 | def setup |
... | ... | @@ -12,7 +9,7 @@ class RegionValidatorsControllerTest < ActionController::TestCase |
12 | 9 | @response = ActionController::TestResponse.new |
13 | 10 | login_as('ze') |
14 | 11 | end |
15 | - | |
12 | + | |
16 | 13 | # Replace this with your real tests. |
17 | 14 | should 'list regions at index' do |
18 | 15 | get :index |
... | ... | @@ -39,7 +36,7 @@ class RegionValidatorsControllerTest < ActionController::TestCase |
39 | 36 | |
40 | 37 | should 'search possible validators by name' do |
41 | 38 | environment = fast_create(Environment, :name => "my environment") |
42 | - give_permission('ze', 'manage_environment_validators', environment) | |
39 | + give_permission('ze', 'manage_environment_validators', environment) | |
43 | 40 | region = Region.new(:name => 'my region') |
44 | 41 | environment.regions << region |
45 | 42 | assert !region.new_record? |
... | ... | @@ -84,7 +81,7 @@ class RegionValidatorsControllerTest < ActionController::TestCase |
84 | 81 | post :remove, :id => region.id, :validator_id => org.id |
85 | 82 | assert_response :redirect |
86 | 83 | assert_redirected_to :action => 'region', :id => region.id |
87 | - | |
84 | + | |
88 | 85 | assert !Region.find(region.id).validators.include?(org) |
89 | 86 | end |
90 | 87 | ... | ... |
test/functional/role_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'role_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class RoleController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class RoleControllerTest < ActionController::TestCase |
8 | 5 | all_fixtures |
9 | 6 | |
... | ... | @@ -26,13 +23,13 @@ class RoleControllerTest < ActionController::TestCase |
26 | 23 | assert_response :success |
27 | 24 | assert_template 'show' |
28 | 25 | assert assigns(:role) |
29 | - assert_equal @role.id, assigns(:role).id | |
26 | + assert_equal @role.id, assigns(:role).id | |
30 | 27 | end |
31 | 28 | |
32 | 29 | def test_can_edit |
33 | 30 | get 'edit', :id => @role.id |
34 | 31 | assert_not_nil assigns(:role) |
35 | - assert_equal @role.id, assigns(:role).id | |
32 | + assert_equal @role.id, assigns(:role).id | |
36 | 33 | end |
37 | 34 | |
38 | 35 | def test_should_update_to_valid_parameters |
... | ... | @@ -42,7 +39,7 @@ class RoleControllerTest < ActionController::TestCase |
42 | 39 | assert_not_nil assigns(:role) |
43 | 40 | assert_nil session[:notice] |
44 | 41 | end |
45 | - | |
42 | + | |
46 | 43 | def test_should_not_update_to_invalid_paramters |
47 | 44 | Role.any_instance.stubs(:valid?).returns(false) |
48 | 45 | post 'update', :id => @role.id | ... | ... |
test/functional/search_controller_test.rb
... | ... | @@ -2,9 +2,6 @@ |
2 | 2 | require_relative "../test_helper" |
3 | 3 | require 'search_controller' |
4 | 4 | |
5 | -# Re-raise errors caught by the controller. | |
6 | -class SearchController; def rescue_action(e) raise e end; end | |
7 | - | |
8 | 5 | class SearchControllerTest < ActionController::TestCase |
9 | 6 | |
10 | 7 | def setup |
... | ... | @@ -54,7 +51,7 @@ class SearchControllerTest < ActionController::TestCase |
54 | 51 | |
55 | 52 | should 'search only in specified types of content' do |
56 | 53 | get :articles, :query => 'something not important' |
57 | - assert_equal ['articles'], assigns(:searches).keys | |
54 | + assert_equal [:articles], assigns(:searches).keys | |
58 | 55 | end |
59 | 56 | |
60 | 57 | should 'render success in search' do | ... | ... |
test/functional/system_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'system_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class SystemController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class SystemControllerTest < ActionController::TestCase |
8 | 5 | def setup |
9 | 6 | @controller = SystemController.new | ... | ... |
test/functional/tasks_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'tasks_controller' |
3 | 3 | |
4 | -class TasksController; def rescue_action(e) raise e end; end | |
5 | - | |
6 | 4 | class TasksControllerTest < ActionController::TestCase |
7 | 5 | |
8 | - noosfero_test :profile => 'testuser' | |
9 | - | |
6 | + self.default_params = {profile: 'testuser'} | |
10 | 7 | def setup |
11 | 8 | @controller = TasksController.new |
12 | 9 | @request = ActionController::TestRequest.new |
... | ... | @@ -149,7 +146,7 @@ class TasksControllerTest < ActionController::TestCase |
149 | 146 | |
150 | 147 | should 'create a ticket with profile requestor' do |
151 | 148 | post :new, :profile => profile.identifier, :ticket => {:name => 'new task'} |
152 | - | |
149 | + | |
153 | 150 | assert_equal profile, assigns(:ticket).requestor |
154 | 151 | end |
155 | 152 | |
... | ... | @@ -628,7 +625,7 @@ class TasksControllerTest < ActionController::TestCase |
628 | 625 | |
629 | 626 | assert_select ".task_responsible select", 0 |
630 | 627 | assert_select ".task_responsible .value" |
631 | - end | |
628 | + end | |
632 | 629 | |
633 | 630 | should 'store the person who closes a task' do |
634 | 631 | t = profile.tasks.build; t.save! | ... | ... |
test/functional/templates_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'templates_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class TemplatesController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class TemplatesControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup |
10 | 7 | @controller = TemplatesController.new |
11 | 8 | @request = ActionController::TestRequest.new |
12 | 9 | @response = ActionController::TestResponse.new |
13 | - Environment.destroy_all | |
14 | - @environment = fast_create(Environment, :is_default => true) | |
10 | + | |
11 | + @environment = Environment.default | |
15 | 12 | login_as(create_admin_user(@environment)) |
16 | 13 | end |
17 | - | |
18 | 14 | attr_accessor :environment |
19 | 15 | |
20 | 16 | should 'create person template' do |
... | ... | @@ -37,9 +33,9 @@ class TemplatesControllerTest < ActionController::TestCase |
37 | 33 | c1= fast_create(Community, :is_template => true, :environment_id => environment.id) |
38 | 34 | environment.community_default_template= c1 |
39 | 35 | environment.save |
40 | - | |
36 | + | |
41 | 37 | c3 = fast_create(Community, :is_template => true, :environment_id => environment.id) |
42 | - | |
38 | + | |
43 | 39 | post :set_community_as_default, :template_id => c3.id |
44 | 40 | environment.reload |
45 | 41 | assert_equal c3, environment.community_default_template |
... | ... | @@ -50,9 +46,9 @@ class TemplatesControllerTest < ActionController::TestCase |
50 | 46 | p1= fast_create(Person, :is_template => true, :environment_id => environment.id) |
51 | 47 | environment.person_default_template= p1 |
52 | 48 | environment.save |
53 | - | |
49 | + | |
54 | 50 | p3 = fast_create(Person, :is_template => true, :environment_id => environment.id) |
55 | - | |
51 | + | |
56 | 52 | post :set_person_as_default, :template_id => p3.id |
57 | 53 | environment.reload |
58 | 54 | assert_equal p3, environment.person_default_template |
... | ... | @@ -63,9 +59,9 @@ class TemplatesControllerTest < ActionController::TestCase |
63 | 59 | e1= fast_create(Enterprise, :is_template => true, :environment_id => environment.id) |
64 | 60 | environment.enterprise_default_template= e1 |
65 | 61 | environment.save |
66 | - | |
62 | + | |
67 | 63 | e3 = fast_create(Enterprise, :is_template => true, :environment_id => environment.id) |
68 | - | |
64 | + | |
69 | 65 | post :set_enterprise_as_default, :template_id => e3.id |
70 | 66 | environment.reload |
71 | 67 | assert_equal e3, environment.enterprise_default_template |
... | ... | @@ -89,10 +85,10 @@ class TemplatesControllerTest < ActionController::TestCase |
89 | 85 | p1= fast_create(Person, :is_template => true, :environment_id => environment.id) |
90 | 86 | environment.person_default_template= p1 |
91 | 87 | environment.save |
92 | - | |
88 | + | |
93 | 89 | env2 = fast_create(Environment) |
94 | 90 | p3 = fast_create(Person, :is_template => true, :environment_id => env2.id) |
95 | - | |
91 | + | |
96 | 92 | post :set_person_as_default, :template_id => p3.id |
97 | 93 | environment.reload |
98 | 94 | assert_not_equal p3, environment.person_default_template |
... | ... | @@ -103,10 +99,10 @@ class TemplatesControllerTest < ActionController::TestCase |
103 | 99 | e1= fast_create(Enterprise, :is_template => true, :environment_id => environment.id) |
104 | 100 | environment.enterprise_default_template= e1 |
105 | 101 | environment.save |
106 | - | |
102 | + | |
107 | 103 | env2 = fast_create(Environment) |
108 | 104 | e3 = fast_create(Enterprise, :is_template => true, :environment_id => env2.id) |
109 | - | |
105 | + | |
110 | 106 | post :set_enterprise_as_default, :template_id => e3.id |
111 | 107 | environment.reload |
112 | 108 | assert_not_equal e3, environment.enterprise_default_template | ... | ... |
test/functional/trusted_sites_controller_test.rb
test/functional/users_controller_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | require 'users_controller' |
3 | 3 | |
4 | -# Re-raise errors caught by the controller. | |
5 | -class UsersController; def rescue_action(e) raise e end; end | |
6 | - | |
7 | 4 | class UsersControllerTest < ActionController::TestCase |
8 | 5 | |
9 | 6 | def setup |
... | ... | @@ -11,14 +8,11 @@ class UsersControllerTest < ActionController::TestCase |
11 | 8 | @request = ActionController::TestRequest.new |
12 | 9 | @response = ActionController::TestResponse.new |
13 | 10 | |
14 | - Environment.destroy_all | |
15 | - @environment = fast_create(Environment, :is_default => true) | |
16 | - | |
11 | + @environment = Environment.default | |
17 | 12 | |
18 | 13 | admin_user = create_user_with_permission('adminuser', 'manage_environment_users', environment) |
19 | 14 | login_as('adminuser') |
20 | 15 | end |
21 | - | |
22 | 16 | attr_accessor :environment |
23 | 17 | |
24 | 18 | should 'not access without right permission' do |
... | ... | @@ -69,7 +63,6 @@ class UsersControllerTest < ActionController::TestCase |
69 | 63 | |
70 | 64 | should 'set admin role' do |
71 | 65 | person = create_user.person |
72 | - Role.create!(:name => 'Admin', :key => 'environment_administrator', :environment => environment, :permissions => ['view_environment_admin_panel']) | |
73 | 66 | assert_equal false, person.is_admin? |
74 | 67 | post :set_admin_role, :id => person.id, :q => '' |
75 | 68 | person.reload |
... | ... | @@ -78,7 +71,6 @@ class UsersControllerTest < ActionController::TestCase |
78 | 71 | |
79 | 72 | should 'reset admin role' do |
80 | 73 | person = create_user.person |
81 | - Role.create!(:name => 'Admin', :key => 'environment_administrator', :environment => environment, :permissions => ['view_environment_admin_panel']) | |
82 | 74 | |
83 | 75 | environment.add_admin(person) |
84 | 76 | assert person.is_admin? | ... | ... |
test/test_helper.rb
... | ... | @@ -80,21 +80,6 @@ class ActiveSupport::TestCase |
80 | 80 | |
81 | 81 | end |
82 | 82 | |
83 | - def self.noosfero_test parameters | |
84 | - instance_variable_set('@noosfero_test_extra_parameters', parameters) | |
85 | - def extra_parameters | |
86 | - @noosfero_test_extra_parameters | |
87 | - end | |
88 | - end | |
89 | - | |
90 | - def get(path, parameters = nil, headers = nil) | |
91 | - super(path, (parameters ? self.class.extra_parameters.merge(parameters) : self.class.extra_parameters) , headers) | |
92 | - end | |
93 | - | |
94 | - def post(path, parameters = nil, headers = nil) | |
95 | - super(path, (parameters ? self.class.extra_parameters.merge(parameters) : self.class.extra_parameters), headers) | |
96 | - end | |
97 | - | |
98 | 83 | # deprecated on minitest |
99 | 84 | def assert_block message=nil |
100 | 85 | assert message || 'yield' do |
... | ... | @@ -298,6 +283,21 @@ module NoosferoTestHelper |
298 | 283 | |
299 | 284 | end |
300 | 285 | |
286 | +class ActionController::TestCase | |
287 | + | |
288 | + class_attribute :default_params | |
289 | + self.default_params = {} | |
290 | + | |
291 | + def get path, parameters = nil, session = nil, flash = nil | |
292 | + super path, if parameters then self.default_params.merge parameters else self.default_params end, session, flash | |
293 | + end | |
294 | + | |
295 | + def post path, parameters = nil, session = nil, flash = nil | |
296 | + super path, if parameters then self.default_params.merge parameters else self.default_params end, session, flash | |
297 | + end | |
298 | + | |
299 | +end | |
300 | + | |
301 | 301 | class ActionController::IntegrationTest |
302 | 302 | def assert_can_login |
303 | 303 | assert_tag :tag => 'a', :attributes => { :id => 'link_login' } | ... | ... |
vendor/plugins/access_control/test/permission_check_test.rb
1 | 1 | require File.join(File.dirname(__FILE__), 'test_helper') |
2 | 2 | |
3 | -class AccessControlTestController; def rescue_action(e) raise e end; end | |
4 | 3 | class PermissionCheckTest < ActionController::TestCase |
5 | 4 | |
6 | 5 | def setup |
... | ... | @@ -12,7 +11,7 @@ class PermissionCheckTest < ActionController::TestCase |
12 | 11 | def test_access_denied |
13 | 12 | get :index |
14 | 13 | assert_response 403 |
15 | - assert_template 'access_denied.html' | |
14 | + assert_template 'shared/access_denied' | |
16 | 15 | end |
17 | 16 | |
18 | 17 | def test_specific_permission_granted | ... | ... |
vendor/plugins/honeypot/init.rb
vendor/plugins/honeypot/lib/form_tag_helper.rb
1 | 1 | module ActionView |
2 | 2 | module Helpers |
3 | 3 | module FormTagHelper |
4 | - def form_tag_with_honeypot(url_for_options = {}, options = {}, *parameters_for_url, &block) | |
5 | - honeypot = options.delete(:honeypot) | |
6 | - html = form_tag_without_honeypot(url_for_options, options, *parameters_for_url, &block) | |
4 | + def form_tag_with_body_with_honeypot html_options = {}, content | |
5 | + honeypot = html_options.delete 'honeypot' | |
6 | + html = form_tag_with_body_without_honeypot html_options, content | |
7 | 7 | if honeypot |
8 | - captcha = "".respond_to?(:html_safe) ? honey_pot_captcha.html_safe : honey_pot_captcha | |
9 | - if block_given? | |
10 | - html.insert(html.index('</form>'), captcha) | |
11 | - else | |
12 | - html += captcha | |
13 | - end | |
8 | + captcha = honey_pot_captcha.html_safe | |
9 | + html.insert html.index('</form>'), captcha | |
14 | 10 | end |
15 | 11 | html |
16 | 12 | end |
17 | - alias_method_chain :form_tag, :honeypot | |
13 | + alias_method_chain :form_tag_with_body, :honeypot | |
18 | 14 | |
19 | 15 | private |
20 | 16 | ... | ... |