diff --git a/features/user_registration.feature b/features/user_registration.feature index a42bec5..ff453e9 100644 --- a/features/user_registration.feature +++ b/features/user_registration.feature @@ -32,6 +32,15 @@ Feature: User Registration | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | + And I fill in the following within ".no-boxes": + | e-Mail | josesilva@serpro.gov.br| + | Username | josesilva | + | Password | secret | + | Password confirmation | secret | + | Full name | José da Silva | + | State | Bahia | + | City | Salvador | + | Secondary e-Mail | josesilva@example.com | And I type in "Minis" into autocomplete list "input_institution" and I choose "Ministerio do Planejamento" And I follow "Add new institution" Then I should see "Ministerio do Planejamento" within ".institutions_added" @@ -45,10 +54,157 @@ Feature: User Registration | Ministerio das Cidades | MC | BR | DF | Gama | 58.745.189/0001-21 | Autarquia | Executivo | Federal | | Governo do DF | GDF | BR | DF | Taguatinga | 12.645.166/0001-44 | Autarquia | Legislativo | Federal | | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | + And I fill in the following within ".no-boxes": + | e-Mail | josesilva@serpro.gov.br| + | Username | josesilva | + | Password | secret | + | Password confirmation | secret | + | Full name | José da Silva | + | State | Bahia | + | City | Salvador | + | Secondary e-Mail | josesilva@example.com | And I type in "MP" into autocomplete list "input_institution" and I choose "Ministerio do Planejamento" And I follow "Add new institution" - Then I should see "Ministerio do Planejamento" within ".institutions_added" - + And I press "Create my account" + When José da Silva's account is activated + And I go to login page + And I fill in "Username" with "josesilva" + And I fill in "Password" with "secret" + And I press "Log in" + Then I should be logged in as "josesilva" + + @selenium + Scenario: Unsuccessfull registration due to the existance of e-mail as secondary another user's e-mail + Given the following users + | login | name | email | country | state | city | + | maria | Maria Silva | maria@example.com | Brazil | DF | Brasilia | + And the user "maria" has "user@example.com" as secondary e-mail + And I go to /account/signup + And I fill in the following within ".no-boxes": + | e-Mail | user@example.com | + | Username | josesilva | + | Password | secret | + | Password confirmation | secret | + | Full name | José da Silva | + | State | Bahia | + | City | Salvador | + And wait for the captcha signup time + And I select "Brazil" from "profile_data[country]" + When I press "Create my account" + Then I should see "E-mail or secondary e-mail already taken." + + @selenium + Scenario: Unsuccessfull registration due to the existance of secondary e-mail as another user's secondary e-mail + Given the following users + | login | name | email | country | state | city | + | maria | Maria Silva | maria@example.com | Brazil | DF | Brasilia | + And the user "maria" has "user@example.com" as secondary e-mail + And I go to /account/signup + And I fill in the following within ".no-boxes": + | e-Mail | josesilva@example.com | + | Username | josesilva | + | Password | secret | + | Password confirmation | secret | + | Full name | José da Silva | + | State | Bahia | + | City | Salvador | + | Secondary e-Mail | user@example.com | + And I select "Brazil" from "profile_data[country]" + And wait for the captcha signup time + When I press "Create my account" + Then I should see "E-mail or secondary e-mail already taken." + + @selenium + Scenario: Unsuccessfull registration due to the existance of secondary e-mail as another user's e-mail + Given the following users + | login | name | email | country | state | city | + | maria | Maria Silva | user@example.com | Brazil | DF | Brasilia | + And I go to /account/signup + And I fill in the following within ".no-boxes": + | e-Mail | josesilva@example.com | + | Username | josesilva | + | Password | secret | + | Password confirmation | secret | + | Full name | José da Silva | + | State | Bahia | + | City | Salvador | + | Secondary e-Mail | user@example.com | + And I select "Brazil" from "profile_data[country]" + And wait for the captcha signup time + When I press "Create my account" + Then I should see "E-mail or secondary e-mail already taken." + + @selenium + Scenario: Unsuccessfull registration due to both primary e-mail and secondary e-mail being equal + Given I go to /account/signup + And I fill in the following within ".no-boxes": + | Username | josesilva | + | e-Mail | josesilva@example.com | + | Password | secret | + | Password confirmation | secret | + | Full name | José da Silva | + | State | Bahia | + | City | Salvador | + | Secondary e-Mail | josesilva@example.com | + And I select "Brazil" from "profile_data[country]" + And wait for the captcha signup time + When I press "Create my account" + Then I should see "Email must be different from secondary email." + + @selenium + Scenario: Unsuccessfull registration due to government fields being blank + Given I go to /account/signup + And I fill in the following within ".no-boxes": + | Username | josesilva | + | e-Mail | josesilva@serpro.gov.br| + | Password | secret | + | Password confirmation | secret | + | Full name | José da Silva | + | Secondary e-Mail | josesilva@example.com | + And wait for the captcha signup time + When I press "Create my account" + And I should see "Institution is obligatory if user has a government email." + And I should see "State can't be blank" + And I should see "City can't be blank" + + @selenium + Scenario: Unsuccessfull registration due to secondary email is governmental and primary is not + Given I go to /account/signup + And I fill in the following within ".no-boxes": + | Username | josesilva | + | e-Mail | josesilva@example.com | + | Password | secret | + | Password confirmation | secret | + | Full name | José da Silva | + | State | Bahia | + | City | Salvador | + | Secondary e-Mail | josesilva@serpro.gov.br| + And wait for the captcha signup time + When I press "Create my account" + Then I should see "The governamental email must be the primary one." + + @selenium-fixme + Scenario: Show incomplete resgistration percentage + Given I go to /account/signup + And I fill in the following within ".no-boxes": + | e-Mail | josesilva@gmail.com | + | Password | secret | + | Password confirmation | secret | + | Full name | José da Silva | + | State | Bahia | + | City | Salvador | + | Secondary e-Mail | josesilva@example.com | + And I select "Brazil" from "profile_data[country]" + And I fill in "Username" with "josesilva" + And wait for the captcha signup time + And I press "Create my account" + When José da Silva's account is activated + And I go to login page + And I fill in "Username" with "josesilva" + And I fill in "Password" with "secret" + And I press "Log in" + Then I should see "Complete Profile: 37%" +>>>>>>> a8e75c7... corrections: remove area of interest from forms. @selenium Scenario: Remove the incomplete resgistration percentage message diff --git a/lib/ext/person.rb b/lib/ext/person.rb index 7eacd04..8c0b2f7 100644 --- a/lib/ext/person.rb +++ b/lib/ext/person.rb @@ -2,10 +2,8 @@ require_dependency 'person' class Person - settings_items :area_interest, :type => :string, :default => "" settings_items :percentage_incomplete, :type => :string, :default => "" - attr_accessible :area_interest attr_accessible :percentage_incomplete scope :search, lambda { |name="", state="", city="", email=""| diff --git a/lib/mpog_software_plugin.rb b/lib/mpog_software_plugin.rb index 078ea6b..d6908c4 100644 --- a/lib/mpog_software_plugin.rb +++ b/lib/mpog_software_plugin.rb @@ -31,15 +31,6 @@ class MpogSoftwarePlugin < Noosfero::Plugin content_tag(:div, labelled_form_field( - _('Areas of Interest'), - text_field(:profile_data, :area_interest, :id => 'area_interest_field')+ - content_tag( - :small,_('Fill with your interest areas'),:class => 'signup-form',:id =>'area-interest-balloon')), - :id => 'signup-area-interest' - ) + - - content_tag(:div, - labelled_form_field( _('Institutions'), content_tag(:div, text_field(:institution, :name, :id=>"input_institution"), @@ -274,7 +265,7 @@ class MpogSoftwarePlugin < Noosfero::Plugin end def profile_required_list - required_list = ["cell_phone","contact_phone","institutions","comercial_phone","country","city","state","organization_website","area_interest","image"] + required_list = ["cell_phone","contact_phone","institutions","comercial_phone","country","city","state","organization_website","image"] end def profile_required_empty_list person diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index cdc6b3f..81b447f 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -41,7 +41,6 @@ class AccountControllerTest < ActionController::TestCase @profile_data_info = { :name=>"Um novo usuario", - :area_interest=>"uma area ai" } @second_profile_data_info = { @@ -161,24 +160,23 @@ class AccountControllerTest < ActionController::TestCase institution end - # def form_params - # user = { - # :login=>"novo_usuario", - # :password=>"nova_senha", - # :password_confirmation=>"nova_senha", - # :email=>"um@novo.usuario", - # :secondary_email=>"outro@email.com", - # :institution_ids=>[@institution_list.last.id] - # } - - # profile_data = { - # :name=>"Um novo usuario", - # :area_interest=>"uma area ai" - # } - - # user["profile_data"] = profile_data - # user - # end + def form_params + user = { + :login=>"novo_usuario", + :password=>"nova_senha", + :password_confirmation=>"nova_senha", + :email=>"um@novo.usuario", + :secondary_email=>"outro@email.com", + :institution_ids=>[@institution_list.last.id] + } + + profile_data = { + :name=>"Um novo usuario", + } + + user["profile_data"] = profile_data + user + end def disable_signup_bot_check(environment = Environment.default) environment.min_signup_delay = 0 diff --git a/test/unit/mpog_software_plugin_test.rb b/test/unit/mpog_software_plugin_test.rb index aec4a74..bada2b1 100644 --- a/test/unit/mpog_software_plugin_test.rb +++ b/test/unit/mpog_software_plugin_test.rb @@ -24,7 +24,7 @@ class MpogSoftwarePluginTest < ActiveSupport::TestCase @person.name = "Person Name" @person.cell_phone = "76888919" - required_list = ["cell_phone","contact_phone","institution","comercial_phone","country","city","state","organization_website","area_interest","image"] + required_list = ["cell_phone","contact_phone","institution","comercial_phone","country","city","state","organization_website","image"] empty_fields = required_list.count - 1 test_percentege = 100 - ((empty_fields * 100) / required_list.count) diff --git a/views/person_editor_extras.html.erb b/views/person_editor_extras.html.erb index 074c0bb..d4b0fc6 100644 --- a/views/person_editor_extras.html.erb +++ b/views/person_editor_extras.html.erb @@ -6,14 +6,6 @@ -
- <%= label_tag 'profile_data[area_interest]', _('Areas of Interest'), :class=>"formlabel" %> - -
- <%= text_field_tag 'profile_data[area_interest]', context.profile.area_interest %> -
-
-
<%= label_tag "user[institution_ids]", _('Institutions'), :class=>"formlabel" %> diff --git a/views/profile/_profile_tab.html.erb b/views/profile/_profile_tab.html.erb index 307dc29..ce58c54 100644 --- a/views/profile/_profile_tab.html.erb +++ b/views/profile/_profile_tab.html.erb @@ -4,6 +4,5 @@ <%= display_field(_('Secondary E-mail:'), profile, :secondary_email, true) %> - <%= display_field(_('Areas of Interest:'), profile, :area_interest, true) %> <%= display_field(_('Institution:'), profile, :institutions, true) %> -- libgit2 0.21.2