From 4dcb9b6e35bbe2e478f14a82e82af26e32ad43b2 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Fri, 20 Feb 2009 12:15:28 -0300 Subject: [PATCH] ActionItem942: force display of mandatory fields on signup --- app/helpers/application_helper.rb | 2 +- test/unit/application_helper_test.rb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d43eb14..ad28396 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -686,7 +686,7 @@ module ApplicationHelper field_html += capture(&block) end if (controller.action_name == 'signup') - if profile.signup_fields.include?(name) + if profile.signup_fields.include?(name) || profile.required_fields.include?(name) result = field_html end else diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index 505643c..08de7f1 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -332,6 +332,21 @@ class ApplicationHelperTest < Test::Unit::TestCase assert_equal 'SIGNUP_FIELD', optional_field(profile, 'field', 'SIGNUP_FIELD') end + should 'display required fields on signup even if admin did not marked field to show up in signup' do + env = Environment.create!(:name => 'env test') + stubs(:environment).returns(env) + + controller = mock + stubs(:controller).returns(controller) + controller.expects(:action_name).returns('signup') + + stubs(:required).with('SIGNUP_FIELD').returns('SIGNUP_FIELD') + profile = Person.new + profile.stubs(:required_fields).returns(['field']) + profile.stubs(:signup_fields).returns([]) + assert_equal 'SIGNUP_FIELD', optional_field(profile, 'field', 'SIGNUP_FIELD') + end + should 'not ask_to_join unless profile defined' do e = Environment.default e.stubs(:enabled?).with(:disable_join_community_popup).returns(false) -- libgit2 0.21.2