Commit 9a696e6ef341e12a7bfbb8e5e4feee4a628a95d6

Authored by JoenioCosta
1 parent 6c9215c3

ActionItem428: added enabled field to profiles


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1991 3f533792-8f58-4932-b0fe-aaf55b0a4547
db/migrate/041_add_enabled_to_profile.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +class AddEnabledToProfile < ActiveRecord::Migration
  2 + def self.up
  3 + add_column :profiles, :enabled, :boolean, :default => true
  4 + end
  5 +
  6 + def self.down
  7 + remove_column :profiles, :enabled
  8 + end
  9 +end
... ...
db/schema.rb
... ... @@ -9,7 +9,7 @@
9 9 #
10 10 # It's strongly recommended to check this file into your version control system.
11 11  
12   -ActiveRecord::Schema.define(:version => 39) do
  12 +ActiveRecord::Schema.define(:version => 41) do
13 13  
14 14 create_table "article_versions", :force => true do |t|
15 15 t.integer "article_id"
... ... @@ -186,6 +186,7 @@ ActiveRecord::Schema.define(:version =&gt; 39) do
186 186 t.float "lat"
187 187 t.float "lng"
188 188 t.integer "geocode_precision"
  189 + t.boolean "enabled", :default => true
189 190 end
190 191  
191 192 create_table "region_validators", :id => false, :force => true do |t|
... ...
test/unit/profile_test.rb
... ... @@ -537,6 +537,11 @@ class ProfileTest &lt; Test::Unit::TestCase
537 537 assert_includes Profile.find_by_contents('interesting'), p
538 538 end
539 539  
  540 + should 'enabled by default on creation' do
  541 + profile = Profile.create!(:name => 'my test profile', :identifier => 'mytestprofile')
  542 + assert profile.enabled?
  543 + end
  544 +
540 545 private
541 546  
542 547 def assert_invalid_identifier(id)
... ...