Commit 617e73a64216fe49ba2af40e43d292f9e9098c72
1 parent
66101891
Exists in
gov-user-refactoring-rails4
gov-user: adapt to rails4
Showing
11 changed files
with
12 additions
and
31 deletions
Show diff stats
src/noosfero-spb/gov_user/features/institution_registration.feature
src/noosfero-spb/gov_user/features/step_definitions/gov_user_steps.rb
... | ... | @@ -69,22 +69,3 @@ end |
69 | 69 | Given /^I sleep for (\d+) seconds$/ do |time| |
70 | 70 | sleep time.to_i |
71 | 71 | end |
72 | - | |
73 | -Given /^I am logged in as mpog_admin$/ do | |
74 | - visit('/account/logout') | |
75 | - | |
76 | - user = User.new(:login => 'admin_user', :password => '123456', :password_confirmation => '123456', :email => 'admin_user@example.com') | |
77 | - person = Person.new :name=>"Mpog Admin", :identifier=>"mpog-admin" | |
78 | - user.person = person | |
79 | - user.save! | |
80 | - | |
81 | - user.activate | |
82 | - e = Environment.default | |
83 | - e.add_admin(user.person) | |
84 | - | |
85 | - visit('/account/login') | |
86 | - fill_in("Username", :with => user.login) | |
87 | - fill_in("Password", :with => '123456') | |
88 | - click_button("Log in") | |
89 | -end | |
90 | - | ... | ... |
src/noosfero-spb/gov_user/lib/gov_user_plugin/governmental_power.rb
src/noosfero-spb/gov_user/lib/gov_user_plugin/governmental_sphere.rb
src/noosfero-spb/gov_user/lib/gov_user_plugin/institution.rb
1 | -class GovUserPlugin::Institution < Noosfero::Plugin::ActiveRecord | |
1 | +class GovUserPlugin::Institution < ActiveRecord::Base | |
2 | 2 | has_many :comments |
3 | 3 | |
4 | 4 | SEARCH_FILTERS = { |
... | ... | @@ -28,8 +28,8 @@ class GovUserPlugin::Institution < Noosfero::Plugin::ActiveRecord |
28 | 28 | |
29 | 29 | belongs_to :community |
30 | 30 | |
31 | - scope :public, :conditions => { :type => "GovUserPlugin::PublicInstitution" } | |
32 | - scope :private, :conditions => { :type => "GovUserPlugin::PrivateInstitution" } | |
31 | + scope :is_public, :conditions => { :type => "GovUserPlugin::PublicInstitution" } | |
32 | + scope :is_private, :conditions => { :type => "GovUserPlugin::PrivateInstitution" } | |
33 | 33 | scope :search_institution, lambda{ |value| |
34 | 34 | where("name ilike ? OR acronym ilike ?", "%#{value}%", "%#{value}%" ) |
35 | 35 | } | ... | ... |
src/noosfero-spb/gov_user/lib/gov_user_plugin/institutions_organization_ratings.rb
src/noosfero-spb/gov_user/lib/gov_user_plugin/institutions_users.rb
src/noosfero-spb/gov_user/lib/gov_user_plugin/juridical_nature.rb
src/noosfero-spb/gov_user/lib/gov_user_plugin/public_institution.rb
... | ... | @@ -7,7 +7,7 @@ class GovUserPlugin::PublicInstitution < GovUserPlugin::Institution |
7 | 7 | |
8 | 8 | validates_format_of( |
9 | 9 | :cnpj, |
10 | - :with => /^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/, | |
10 | + :with => /\A\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}\z/, | |
11 | 11 | :allow_nil => true, :allow_blank => true |
12 | 12 | ) |
13 | 13 | end | ... | ... |
src/noosfero-spb/gov_user/test/unit/gov_user_plugin/governmental_power_test.rb
... | ... | @@ -28,6 +28,6 @@ class GovUserPlugin::GovernmentalPowerTest < ActiveSupport::TestCase |
28 | 28 | inst_cnpj |
29 | 29 | ) |
30 | 30 | |
31 | - assert_equal gov_power.institutions.public.count, GovUserPlugin::PublicInstitution.count | |
31 | + assert_equal gov_power.institutions.is_public.count, GovUserPlugin::PublicInstitution.count | |
32 | 32 | end |
33 | 33 | end | ... | ... |
src/noosfero-spb/gov_user/test/unit/gov_user_plugin/juridical_nature_test.rb
... | ... | @@ -18,6 +18,6 @@ class GovUserPlugin::JuridicalNatureTest < ActiveSupport::TestCase |
18 | 18 | juridical_nature = GovUserPlugin::JuridicalNature.create(:name => "Autarquia") |
19 | 19 | create_public_institution("Ministerio Publico da Uniao", "MPU", "BR", "DF", "Gama", juridical_nature, @govPower, @govSphere, "22.333.444/5555-66") |
20 | 20 | create_public_institution("Tribunal Regional da Uniao", "TRU", "BR", "DF", "Brasilia", juridical_nature, @govPower, @govSphere, "22.333.444/5555-77") |
21 | - assert juridical_nature.institutions.public.count == GovUserPlugin::PublicInstitution.count | |
21 | + assert juridical_nature.institutions.is_public.count == GovUserPlugin::PublicInstitution.count | |
22 | 22 | end |
23 | 23 | end | ... | ... |