Commit d62bc305fb8ed4ca5bbca2665a34dc577bc45418
1 parent
09cf54dc
Exists in
spb_to_rails4
Fixes gov_user unit tests
Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com> Signed-off-by: Pedro de Lyra <pedrodelyra@gmail.com>
Showing
6 changed files
with
25 additions
and
43 deletions
Show diff stats
src/noosfero-spb/gov_user/lib/institution.rb
| @@ -8,7 +8,7 @@ class Institution < ActiveRecord::Base | @@ -8,7 +8,7 @@ class Institution < ActiveRecord::Base | ||
| 8 | :display => %w[compact] | 8 | :display => %w[compact] |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | - CNPJ_FORMAT = /^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/ | 11 | + CNPJ_FORMAT = /\A\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}\z/ |
| 12 | 12 | ||
| 13 | VALID_STATES = { "AC"=>"Acre", "AL"=>"Alagoas", "AM"=>"Amazonas", "AP"=>"Amapá", "BA"=>"Bahia", "CE"=>"Ceará", | 13 | VALID_STATES = { "AC"=>"Acre", "AL"=>"Alagoas", "AM"=>"Amazonas", "AP"=>"Amapá", "BA"=>"Bahia", "CE"=>"Ceará", |
| 14 | "DF"=>"Distrito Federal", "ES"=>"Espírito Santo", "GO"=>"Goiás", "MA"=>"Maranhão", "MT"=>"Mato Grosso", | 14 | "DF"=>"Distrito Federal", "ES"=>"Espírito Santo", "GO"=>"Goiás", "MA"=>"Maranhão", "MT"=>"Mato Grosso", |
src/noosfero-spb/gov_user/test/helpers/plugin_test_helper.rb
| @@ -9,17 +9,17 @@ module PluginTestHelper | @@ -9,17 +9,17 @@ module PluginTestHelper | ||
| 9 | password, | 9 | password, |
| 10 | password_confirmation | 10 | password_confirmation |
| 11 | ) | 11 | ) |
| 12 | - person = Person::new | ||
| 13 | - | ||
| 14 | - user.person = person | ||
| 15 | - person.user = user | 12 | + person = Person.new |
| 16 | 13 | ||
| 17 | person.name = name | 14 | person.name = name |
| 18 | person.identifier = name.to_slug | 15 | person.identifier = name.to_slug |
| 19 | person.state = state | 16 | person.state = state |
| 20 | person.city = city | 17 | person.city = city |
| 21 | 18 | ||
| 19 | + user.person = person | ||
| 22 | user.save | 20 | user.save |
| 21 | + | ||
| 22 | + person.user_id = user.id | ||
| 23 | person.save | 23 | person.save |
| 24 | 24 | ||
| 25 | person | 25 | person |
src/noosfero-spb/gov_user/test/unit/institutions_block_test.rb
| @@ -23,6 +23,7 @@ class InstitutionsBlockTest < ActiveSupport::TestCase | @@ -23,6 +23,7 @@ class InstitutionsBlockTest < ActiveSupport::TestCase | ||
| 23 | end | 23 | end |
| 24 | 24 | ||
| 25 | should 'list institutions' do | 25 | should 'list institutions' do |
| 26 | + Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([GovUserPlugin.new]) | ||
| 26 | user = create_person("Jose_Augusto", | 27 | user = create_person("Jose_Augusto", |
| 27 | "jose_augusto@email.com", | 28 | "jose_augusto@email.com", |
| 28 | "aaaaaaa", | 29 | "aaaaaaa", |
| @@ -40,7 +41,6 @@ class InstitutionsBlockTest < ActiveSupport::TestCase | @@ -40,7 +41,6 @@ class InstitutionsBlockTest < ActiveSupport::TestCase | ||
| 40 | "00.111.222/3333-44" | 41 | "00.111.222/3333-44" |
| 41 | ) | 42 | ) |
| 42 | institution.community.add_member(user) | 43 | institution.community.add_member(user) |
| 43 | - | ||
| 44 | block = InstitutionsBlock.new | 44 | block = InstitutionsBlock.new |
| 45 | block.expects(:owner).at_least_once.returns(user) | 45 | block.expects(:owner).at_least_once.returns(user) |
| 46 | 46 |
src/noosfero-spb/software_communities/features/software_block.feature
| @@ -10,36 +10,26 @@ Feature: edit adherent fields | @@ -10,36 +10,26 @@ Feature: edit adherent fields | ||
| 10 | And I check "SoftwareCommunitiesPlugin" | 10 | And I check "SoftwareCommunitiesPlugin" |
| 11 | And I press "Save changes" | 11 | And I press "Save changes" |
| 12 | And the following softwares | 12 | And the following softwares |
| 13 | - | name | public_software | finality | | ||
| 14 | - | Public Software | true | some finality | | ||
| 15 | - | Generic Software | false | some finality | | ||
| 16 | - | ||
| 17 | - Scenario: Add software block | ||
| 18 | - Given I follow "Control panel" | ||
| 19 | - And I follow "Edit sideboxes" | ||
| 20 | - When I follow "Add a block" | ||
| 21 | - And I choose "Softwares" | ||
| 22 | - And I press "Add" | ||
| 23 | - Then I should see "softwares" | 13 | + | name | public_software | finality | |
| 14 | + | Public Software | true | some finality | | ||
| 15 | + | Generic Software | false | some finality | | ||
| 16 | + And the following blocks | ||
| 17 | + | owner | type | | ||
| 18 | + | mpog-admin | SoftwaresBlock | | ||
| 24 | 19 | ||
| 25 | Scenario: Change software block to generic software block | 20 | Scenario: Change software block to generic software block |
| 26 | Given I follow "Control panel" | 21 | Given I follow "Control panel" |
| 27 | And I follow "Edit sideboxes" | 22 | And I follow "Edit sideboxes" |
| 28 | - When I follow "Add a block" | ||
| 29 | - And I choose "Softwares" | ||
| 30 | - And I press "Add" | 23 | + And I print the page |
| 31 | And I follow "Edit" within ".softwares-block" | 24 | And I follow "Edit" within ".softwares-block" |
| 32 | - And I select "Generic" from "block_software_type" | 25 | + When I select "Generic" from "block_software_type" |
| 33 | And I press "Save" | 26 | And I press "Save" |
| 34 | Then I should see "generic software" | 27 | Then I should see "generic software" |
| 35 | 28 | ||
| 36 | Scenario: Change software block to generic software block | 29 | Scenario: Change software block to generic software block |
| 37 | Given I follow "Control panel" | 30 | Given I follow "Control panel" |
| 38 | And I follow "Edit sideboxes" | 31 | And I follow "Edit sideboxes" |
| 39 | - When I follow "Add a block" | ||
| 40 | - And I choose "Softwares" | ||
| 41 | - And I press "Add" | ||
| 42 | And I follow "Edit" within ".softwares-block" | 32 | And I follow "Edit" within ".softwares-block" |
| 43 | - And I select "Public" from "block_software_type" | 33 | + When I select "Public" from "block_software_type" |
| 44 | And I press "Save" | 34 | And I press "Save" |
| 45 | Then I should see "public software" | 35 | Then I should see "public software" |
src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb
| @@ -252,6 +252,9 @@ Given /^I am logged in as mpog_admin$/ do | @@ -252,6 +252,9 @@ Given /^I am logged in as mpog_admin$/ do | ||
| 252 | user.person = person | 252 | user.person = person |
| 253 | user.save! | 253 | user.save! |
| 254 | 254 | ||
| 255 | + person.user_id = user.id | ||
| 256 | + person.save! | ||
| 257 | + | ||
| 255 | user.activate | 258 | user.activate |
| 256 | e = Environment.default | 259 | e = Environment.default |
| 257 | e.add_admin(user.person) | 260 | e.add_admin(user.person) |
src/noosfero-spb/software_communities/features/use_report.feature
| @@ -15,23 +15,17 @@ Feature: Use report | @@ -15,23 +15,17 @@ Feature: Use report | ||
| 15 | And the following softwares | 15 | And the following softwares |
| 16 | | name | public_software | finality | | 16 | | name | public_software | finality | |
| 17 | | Noosfero | true | some finality | | 17 | | Noosfero | true | some finality | |
| 18 | + And the following blocks | ||
| 19 | + | owner | type | | ||
| 20 | + | noosfero | OrganizationRatingsBlock | | ||
| 21 | + | noosfero | AverageRatingBlock | | ||
| 18 | 22 | ||
| 19 | - Scenario: Add Organization Ratings Block | 23 | + Scenario: See Organization Ratings and Average Rating blocks |
| 20 | Given I go to Noosfero's control panel | 24 | Given I go to Noosfero's control panel |
| 21 | And I follow "Edit sideboxes" | 25 | And I follow "Edit sideboxes" |
| 22 | - When I follow "Add a block" | ||
| 23 | - And I choose "Organization Ratings" | ||
| 24 | - And I press "Add" | ||
| 25 | Then I should see "Report your experiences" | 26 | Then I should see "Report your experiences" |
| 26 | - | ||
| 27 | - Scenario: Add Average Rating Block | ||
| 28 | - Given I go to Noosfero's control panel | ||
| 29 | - And I follow "Edit sideboxes" | ||
| 30 | - When I follow "Add a block" | ||
| 31 | - And I choose "Organization Average Rating" | ||
| 32 | - And I press "Add" | ||
| 33 | - Then I should see "Be the first to rate!" | ||
| 34 | - | 27 | + And I should see "Be the first to rate!" |
| 28 | + | ||
| 35 | @selenium | 29 | @selenium |
| 36 | Scenario: Test Additional Fields JavaScript | 30 | Scenario: Test Additional Fields JavaScript |
| 37 | Given I go to /profile/noosfero/plugin/organization_ratings/new_rating | 31 | Given I go to /profile/noosfero/plugin/organization_ratings/new_rating |
| @@ -47,11 +41,6 @@ Feature: Use report | @@ -47,11 +41,6 @@ Feature: Use report | ||
| 47 | And the following public institutions | 41 | And the following public institutions |
| 48 | | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | corporate_name | | 42 | | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | corporate_name | |
| 49 | | Ministerio do Planejamento | MP | BR | Distrito Federal | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento | | 43 | | Ministerio do Planejamento | MP | BR | Distrito Federal | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento | |
| 50 | - And I go to Noosfero's control panel | ||
| 51 | - And I follow "Edit sideboxes" | ||
| 52 | - When I follow "Add a block" | ||
| 53 | - And I choose "Organization Ratings" | ||
| 54 | - And I press "Add" | ||
| 55 | And I am on Noosfero's homepage | 44 | And I am on Noosfero's homepage |
| 56 | And I follow "Rate Community" | 45 | And I follow "Rate Community" |
| 57 | When I click on anything with selector "comments-additional-information" | 46 | When I click on anything with selector "comments-additional-information" |