Commit 4bf11ff9d7f6cbc79d2bc85216f1000aa6741efd
1 parent
450e11f4
Exists in
master
and in
22 other branches
stoa-plugin: Fixes broken tests
Showing
3 changed files
with
4 additions
and
4 deletions
Show diff stats
lib/tasks/plugins_tests.rake
| @@ -4,7 +4,6 @@ $broken_plugins = %w[ | @@ -4,7 +4,6 @@ $broken_plugins = %w[ | ||
| 4 | comment_classification | 4 | comment_classification |
| 5 | ldap | 5 | ldap |
| 6 | solr | 6 | solr |
| 7 | - stoa | ||
| 8 | ] | 7 | ] |
| 9 | 8 | ||
| 10 | @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template'] | 9 | @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template'] |
plugins/stoa/lib/stoa_plugin.rb
| @@ -60,13 +60,14 @@ class StoaPlugin < Noosfero::Plugin | @@ -60,13 +60,14 @@ class StoaPlugin < Noosfero::Plugin | ||
| 60 | end | 60 | end |
| 61 | 61 | ||
| 62 | def account_controller_filters | 62 | def account_controller_filters |
| 63 | - block = lambda do |context| | 63 | + block = proc do |
| 64 | params[:profile_data] ||= {} | 64 | params[:profile_data] ||= {} |
| 65 | params[:profile_data][:invitation_code] = params[:invitation_code] | 65 | params[:profile_data][:invitation_code] = params[:invitation_code] |
| 66 | invitation = Task.pending.find(:first, :conditions => {:code => params[:invitation_code]}) | 66 | invitation = Task.pending.find(:first, :conditions => {:code => params[:invitation_code]}) |
| 67 | if request.post? | 67 | if request.post? |
| 68 | if !invitation && !StoaPlugin::UspUser.matches?(params[:profile_data][:usp_id], params[:confirmation_field], params[params[:confirmation_field]]) | 68 | if !invitation && !StoaPlugin::UspUser.matches?(params[:profile_data][:usp_id], params[:confirmation_field], params[params[:confirmation_field]]) |
| 69 | - @person = Person.new(:environment => context.environment) | 69 | + # `self` below is evaluated in the context of account_controller |
| 70 | + @person = Person.new(:environment => self.environment) | ||
| 70 | @person.errors.add(:usp_id, _(' validation failed')) | 71 | @person.errors.add(:usp_id, _(' validation failed')) |
| 71 | render :action => :signup | 72 | render :action => :signup |
| 72 | end | 73 | end |
plugins/stoa/test/functional/invite_controller_test.rb
| @@ -57,7 +57,7 @@ class InviteControllerTest < ActionController::TestCase | @@ -57,7 +57,7 @@ class InviteControllerTest < ActionController::TestCase | ||
| 57 | organization.add_admin(admin) | 57 | organization.add_admin(admin) |
| 58 | 58 | ||
| 59 | login_as(admin.identifier) | 59 | login_as(admin.identifier) |
| 60 | - get :search_friend, :profile => organization.identifier, :q => '1234' | 60 | + get :search, :profile => organization.identifier, :q => '1234' |
| 61 | 61 | ||
| 62 | assert_equal [{"id" => person.id, "name" => person.name}].to_json, @response.body | 62 | assert_equal [{"id" => person.id, "name" => person.name}].to_json, @response.body |
| 63 | assert_response 200 | 63 | assert_response 200 |