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 | 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 | 13 | VALID_STATES = { "AC"=>"Acre", "AL"=>"Alagoas", "AM"=>"Amazonas", "AP"=>"Amapá", "BA"=>"Bahia", "CE"=>"Ceará", |
| 14 | 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 | 9 | password, |
| 10 | 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 | 14 | person.name = name |
| 18 | 15 | person.identifier = name.to_slug |
| 19 | 16 | person.state = state |
| 20 | 17 | person.city = city |
| 21 | 18 | |
| 19 | + user.person = person | |
| 22 | 20 | user.save |
| 21 | + | |
| 22 | + person.user_id = user.id | |
| 23 | 23 | person.save |
| 24 | 24 | |
| 25 | 25 | person | ... | ... |
src/noosfero-spb/gov_user/test/unit/institutions_block_test.rb
| ... | ... | @@ -23,6 +23,7 @@ class InstitutionsBlockTest < ActiveSupport::TestCase |
| 23 | 23 | end |
| 24 | 24 | |
| 25 | 25 | should 'list institutions' do |
| 26 | + Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([GovUserPlugin.new]) | |
| 26 | 27 | user = create_person("Jose_Augusto", |
| 27 | 28 | "jose_augusto@email.com", |
| 28 | 29 | "aaaaaaa", |
| ... | ... | @@ -40,7 +41,6 @@ class InstitutionsBlockTest < ActiveSupport::TestCase |
| 40 | 41 | "00.111.222/3333-44" |
| 41 | 42 | ) |
| 42 | 43 | institution.community.add_member(user) |
| 43 | - | |
| 44 | 44 | block = InstitutionsBlock.new |
| 45 | 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 | 10 | And I check "SoftwareCommunitiesPlugin" |
| 11 | 11 | And I press "Save changes" |
| 12 | 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 | 20 | Scenario: Change software block to generic software block |
| 26 | 21 | Given I follow "Control panel" |
| 27 | 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 | 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 | 26 | And I press "Save" |
| 34 | 27 | Then I should see "generic software" |
| 35 | 28 | |
| 36 | 29 | Scenario: Change software block to generic software block |
| 37 | 30 | Given I follow "Control panel" |
| 38 | 31 | And I follow "Edit sideboxes" |
| 39 | - When I follow "Add a block" | |
| 40 | - And I choose "Softwares" | |
| 41 | - And I press "Add" | |
| 42 | 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 | 34 | And I press "Save" |
| 45 | 35 | Then I should see "public software" | ... | ... |
src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb
src/noosfero-spb/software_communities/features/use_report.feature
| ... | ... | @@ -15,23 +15,17 @@ Feature: Use report |
| 15 | 15 | And the following softwares |
| 16 | 16 | | name | public_software | finality | |
| 17 | 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 | 24 | Given I go to Noosfero's control panel |
| 21 | 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 | 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 | 29 | @selenium |
| 36 | 30 | Scenario: Test Additional Fields JavaScript |
| 37 | 31 | Given I go to /profile/noosfero/plugin/organization_ratings/new_rating |
| ... | ... | @@ -47,11 +41,6 @@ Feature: Use report |
| 47 | 41 | And the following public institutions |
| 48 | 42 | | name | acronym | country | state | city | cnpj | juridical_nature | governmental_power | governmental_sphere | corporate_name | |
| 49 | 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 | 44 | And I am on Noosfero's homepage |
| 56 | 45 | And I follow "Rate Community" |
| 57 | 46 | When I click on anything with selector "comments-additional-information" | ... | ... |