Commit 0346bd588d683ba891e2cf8c260302c0fd8a6ab4

Authored by Braulio Bhavamitra
1 parent fe697067

rails4: migrate set_table_name

app/models/article_categorization.rb
1 class ArticleCategorization < ActiveRecord::Base 1 class ArticleCategorization < ActiveRecord::Base
2 - set_table_name :articles_categories 2 + self.table_name = :articles_categories
  3 +
3 belongs_to :article 4 belongs_to :article
4 belongs_to :category 5 belongs_to :category
5 6
app/models/profile_categorization.rb
1 class ProfileCategorization < ActiveRecord::Base 1 class ProfileCategorization < ActiveRecord::Base
2 - set_table_name :categories_profiles 2 + self.table_name = :categories_profiles
3 belongs_to :profile 3 belongs_to :profile
4 belongs_to :category 4 belongs_to :category
5 5
db/migrate/059_add_birth_date_to_person.rb
@@ -30,7 +30,7 @@ class AddBirthDateToPerson &lt; ActiveRecord::Migration @@ -30,7 +30,7 @@ class AddBirthDateToPerson &lt; ActiveRecord::Migration
30 end 30 end
31 31
32 class Person < ActiveRecord::Base 32 class Person < ActiveRecord::Base
33 - set_table_name 'profiles' 33 + self.table_name = 'profiles'
34 serialize :data, Hash 34 serialize :data, Hash
35 end 35 end
36 36
db/migrate/069_add_enviroment_id_to_role.rb
1 class Role < ActiveRecord::Base; end 1 class Role < ActiveRecord::Base; end
2 class RoleWithEnvironment < ActiveRecord::Base 2 class RoleWithEnvironment < ActiveRecord::Base
3 - set_table_name 'roles' 3 + self.table_name = 'roles'
4 belongs_to :environment 4 belongs_to :environment
5 end 5 end
6 class RoleAssignment < ActiveRecord::Base 6 class RoleAssignment < ActiveRecord::Base
plugins/comment_classification/lib/comment_classification_plugin/comment_label_user.rb
1 class CommentClassificationPlugin::CommentLabelUser < ActiveRecord::Base 1 class CommentClassificationPlugin::CommentLabelUser < ActiveRecord::Base
2 - set_table_name :comment_classification_plugin_comment_label_user 2 + self.table_name = :comment_classification_plugin_comment_label_user
3 3
4 belongs_to :profile 4 belongs_to :profile
5 belongs_to :comment 5 belongs_to :comment
plugins/comment_classification/lib/comment_classification_plugin/comment_status_user.rb
1 class CommentClassificationPlugin::CommentStatusUser < ActiveRecord::Base 1 class CommentClassificationPlugin::CommentStatusUser < ActiveRecord::Base
2 - set_table_name :comment_classification_plugin_comment_status_user 2 + self.table_name = :comment_classification_plugin_comment_status_user
3 3
4 belongs_to :profile 4 belongs_to :profile
5 belongs_to :comment 5 belongs_to :comment
plugins/custom_forms/db/migrate/20130823151900_associate_fields_to_alternatives.rb
1 class AssociateFieldsToAlternatives < ActiveRecord::Migration 1 class AssociateFieldsToAlternatives < ActiveRecord::Migration
2 class CustomFormsPlugin::Field < ActiveRecord::Base 2 class CustomFormsPlugin::Field < ActiveRecord::Base
3 - set_table_name :custom_forms_plugin_fields 3 + self.table_name = :custom_forms_plugin_fields
4 has_many :alternatives, :class_name => 'CustomFormsPlugin::Alternative' 4 has_many :alternatives, :class_name => 'CustomFormsPlugin::Alternative'
5 serialize :choices, Hash 5 serialize :choices, Hash
6 end 6 end
plugins/custom_forms/lib/custom_forms_plugin/alternative.rb
1 class CustomFormsPlugin::Alternative < ActiveRecord::Base 1 class CustomFormsPlugin::Alternative < ActiveRecord::Base
2 - set_table_name :custom_forms_plugin_alternatives 2 + self.table_name = :custom_forms_plugin_alternatives
3 3
4 validates_presence_of :label 4 validates_presence_of :label
5 5
plugins/custom_forms/lib/custom_forms_plugin/answer.rb
1 class CustomFormsPlugin::Answer < ActiveRecord::Base 1 class CustomFormsPlugin::Answer < ActiveRecord::Base
2 - set_table_name :custom_forms_plugin_answers 2 + self.table_name = :custom_forms_plugin_answers
3 belongs_to :field, :class_name => 'CustomFormsPlugin::Field' 3 belongs_to :field, :class_name => 'CustomFormsPlugin::Field'
4 belongs_to :submission, :class_name => 'CustomFormsPlugin::Submission' 4 belongs_to :submission, :class_name => 'CustomFormsPlugin::Submission'
5 5
plugins/custom_forms/lib/custom_forms_plugin/field.rb
1 class CustomFormsPlugin::Field < ActiveRecord::Base 1 class CustomFormsPlugin::Field < ActiveRecord::Base
2 - set_table_name :custom_forms_plugin_fields 2 + self.table_name = :custom_forms_plugin_fields
3 3
4 validates_presence_of :name 4 validates_presence_of :name
5 5
plugins/custom_forms/lib/custom_forms_plugin/numeric.rb
1 class CustomFormsPlugin::Numeric < CustomFormsPlugin::Field 1 class CustomFormsPlugin::Numeric < CustomFormsPlugin::Field
2 - set_table_name :custom_forms_plugin_fields 2 + self.table_name = :custom_forms_plugin_fields
3 end 3 end
4 4
plugins/custom_forms/lib/custom_forms_plugin/select_field.rb
1 class CustomFormsPlugin::SelectField < CustomFormsPlugin::Field 1 class CustomFormsPlugin::SelectField < CustomFormsPlugin::Field
2 - set_table_name :custom_forms_plugin_fields 2 + self.table_name = :custom_forms_plugin_fields
3 validates_inclusion_of :select_field_type, :in => %w(radio check_box select multiple_select) 3 validates_inclusion_of :select_field_type, :in => %w(radio check_box select multiple_select)
4 validates_length_of :alternatives, :minimum => 1, :message => 'can\'t be empty' 4 validates_length_of :alternatives, :minimum => 1, :message => 'can\'t be empty'
5 end 5 end
plugins/custom_forms/lib/custom_forms_plugin/text_field.rb
1 class CustomFormsPlugin::TextField < CustomFormsPlugin::Field 1 class CustomFormsPlugin::TextField < CustomFormsPlugin::Field
2 - set_table_name :custom_forms_plugin_fields 2 +
  3 + self.table_name = :custom_forms_plugin_fields
  4 +
3 end 5 end
plugins/mark_comment_as_read/lib/mark_comment_as_read_plugin/read_comments.rb
1 class MarkCommentAsReadPlugin::ReadComments < ActiveRecord::Base 1 class MarkCommentAsReadPlugin::ReadComments < ActiveRecord::Base
2 - set_table_name 'mark_comment_as_read_plugin' 2 + self.table_name = 'mark_comment_as_read_plugin'
3 belongs_to :comment 3 belongs_to :comment
4 belongs_to :person 4 belongs_to :person
5 5
plugins/stoa/lib/stoa_plugin/usp_user.rb
1 class StoaPlugin::UspUser < ActiveRecord::Base 1 class StoaPlugin::UspUser < ActiveRecord::Base
2 2
3 establish_connection(:stoa) 3 establish_connection(:stoa)
4 - set_table_name('pessoa') 4 + self.table_name = 'pessoa'
5 5
6 SALT=YAML::load(File.open(StoaPlugin.root_path + 'config.yml'))['salt'] 6 SALT=YAML::load(File.open(StoaPlugin.root_path + 'config.yml'))['salt']
7 7
vendor/ezcrypto/test/active_crypto_test.rb
@@ -24,7 +24,7 @@ end @@ -24,7 +24,7 @@ end
24 class Asset<ActiveRecord::Base 24 class Asset<ActiveRecord::Base
25 encrypt :title, :base64=>true 25 encrypt :title, :base64=>true
26 has_many :caps,:dependent=>:destroy 26 has_many :caps,:dependent=>:destroy
27 - 27 +
28 def self.create(title,email) 28 def self.create(title,email)
29 asset=Asset.new 29 asset=Asset.new
30 asset.set_session_key(EzCrypto::Key.generate) 30 asset.set_session_key(EzCrypto::Key.generate)
@@ -39,17 +39,17 @@ class Asset&lt;ActiveRecord::Base @@ -39,17 +39,17 @@ class Asset&lt;ActiveRecord::Base
39 def share(email=nil) 39 def share(email=nil)
40 Cap.create_for_asset(self,email) 40 Cap.create_for_asset(self,email)
41 end 41 end
42 - 42 +
43 end 43 end
44 44
45 class AssetRaw<ActiveRecord::Base 45 class AssetRaw<ActiveRecord::Base
46 - set_table_name "assets" 46 + self.table_name = "assets"
47 end 47 end
48 48
49 class Cap < ActiveRecord::Base 49 class Cap < ActiveRecord::Base
50 belongs_to :asset 50 belongs_to :asset
51 encrypt :shared_key, :base64=>true 51 encrypt :shared_key, :base64=>true
52 - 52 +
53 def self.find_by_key(cap_key) 53 def self.find_by_key(cap_key)
54 cap_key.chop 54 cap_key.chop
55 hash=Digest::SHA1.hexdigest(cap_key) 55 hash=Digest::SHA1.hexdigest(cap_key)
@@ -64,7 +64,7 @@ class Cap &lt; ActiveRecord::Base @@ -64,7 +64,7 @@ class Cap &lt; ActiveRecord::Base
64 nil 64 nil
65 end 65 end
66 end 66 end
67 - 67 +
68 def self.create_for_asset(asset,email=nil) 68 def self.create_for_asset(asset,email=nil)
69 cap=Cap.new 69 cap=Cap.new
70 cap.email=email if email 70 cap.email=email if email
@@ -80,28 +80,28 @@ class Cap &lt; ActiveRecord::Base @@ -80,28 +80,28 @@ class Cap &lt; ActiveRecord::Base
80 nil 80 nil
81 end 81 end
82 end 82 end
83 - 83 +
84 end 84 end
85 85
86 class Group < ActiveRecord::Base 86 class Group < ActiveRecord::Base
87 belongs_to :user 87 belongs_to :user
88 has_many :group_secrets 88 has_many :group_secrets
89 - 89 +
90 encrypt :name,:group_key, :key=>:user , :base64=>true 90 encrypt :name,:group_key, :key=>:user , :base64=>true
91 end 91 end
92 92
93 class GroupSecret < ActiveRecord::Base 93 class GroupSecret < ActiveRecord::Base
94 belongs_to :group 94 belongs_to :group
95 - 95 +
96 encrypt :title,:body, :key=>:group, :base64=>true 96 encrypt :title,:body, :key=>:group, :base64=>true
97 - 97 +
98 end 98 end
99 99
100 class ActiveCryptoTest < Test::Unit::TestCase 100 class ActiveCryptoTest < Test::Unit::TestCase
101 - 101 +
102 def setup 102 def setup
103 end 103 end
104 - 104 +
105 def test_key_holder_in_record 105 def test_key_holder_in_record
106 user=User.new 106 user=User.new
107 user.name="bob" 107 user.name="bob"
@@ -112,9 +112,9 @@ class ActiveCryptoTest &lt; Test::Unit::TestCase @@ -112,9 +112,9 @@ class ActiveCryptoTest &lt; Test::Unit::TestCase
112 assert_nil user.session_key 112 assert_nil user.session_key
113 user.enter_password "shhcccc" 113 user.enter_password "shhcccc"
114 assert_not_nil user.session_key 114 assert_not_nil user.session_key
115 - assert_not_nil user.session_key.encrypt("test") 115 + assert_not_nil user.session_key.encrypt("test")
116 end 116 end
117 - 117 +
118 def test_encrypted_child 118 def test_encrypted_child
119 user=User.new 119 user=User.new
120 user.save 120 user.save
@@ -124,22 +124,22 @@ class ActiveCryptoTest &lt; Test::Unit::TestCase @@ -124,22 +124,22 @@ class ActiveCryptoTest &lt; Test::Unit::TestCase
124 assert user.kind_of?(ActiveCrypto::KeyHolder) 124 assert user.kind_of?(ActiveCrypto::KeyHolder)
125 assert user.kind_of?(ActiveRecord::Base) 125 assert user.kind_of?(ActiveRecord::Base)
126 assert user.kind_of?(User) 126 assert user.kind_of?(User)
127 - 127 +
128 jill=user.secrets.create 128 jill=user.secrets.create
129 - 129 +
130 assert_not_nil jill 130 assert_not_nil jill
131 assert jill.kind_of?(ActiveCrypto::AssociationKeyHolder) 131 assert jill.kind_of?(ActiveCrypto::AssociationKeyHolder)
132 assert jill.kind_of?(ActiveCrypto::KeyHolder) 132 assert jill.kind_of?(ActiveCrypto::KeyHolder)
133 assert jill.kind_of?(ActiveCrypto::Encrypted) 133 assert jill.kind_of?(ActiveCrypto::Encrypted)
134 assert jill.kind_of?(ActiveRecord::Base) 134 assert jill.kind_of?(ActiveRecord::Base)
135 assert jill.kind_of?(Secret) 135 assert jill.kind_of?(Secret)
136 - 136 +
137 assert jill.respond_to?(:session_key) 137 assert jill.respond_to?(:session_key)
138 - 138 +
139 assert_not_nil jill.user 139 assert_not_nil jill.user
140 assert_not_nil jill.user.session_key 140 assert_not_nil jill.user.session_key
141 -  
142 - 141 +
  142 +
143 assert_not_nil jill.session_key 143 assert_not_nil jill.session_key
144 assert_equal user.session_key,jill.session_key 144 assert_equal user.session_key,jill.session_key
145 145
@@ -148,12 +148,12 @@ class ActiveCryptoTest &lt; Test::Unit::TestCase @@ -148,12 +148,12 @@ class ActiveCryptoTest &lt; Test::Unit::TestCase
148 148
149 149
150 assert_equal "jill",jill.name 150 assert_equal "jill",jill.name
151 - 151 +
152 jill=user.secrets.first 152 jill=user.secrets.first
153 assert_not_nil jill.session_key 153 assert_not_nil jill.session_key
154 assert_equal user.session_key,jill.session_key 154 assert_equal user.session_key,jill.session_key
155 assert_equal "jill",jill.name 155 assert_equal "jill",jill.name
156 - 156 +
157 child=jill.children.create 157 child=jill.children.create
158 child.email="pelle@neubia.com" 158 child.email="pelle@neubia.com"
159 child.save 159 child.save
@@ -186,20 +186,20 @@ class ActiveCryptoTest &lt; Test::Unit::TestCase @@ -186,20 +186,20 @@ class ActiveCryptoTest &lt; Test::Unit::TestCase
186 cap=Cap.find_by_key key 186 cap=Cap.find_by_key key
187 assert_not_nil cap 187 assert_not_nil cap
188 assert_not_nil cap.asset 188 assert_not_nil cap.asset
189 - 189 +
190 assert_equal "title",cap.asset.title 190 assert_equal "title",cap.asset.title
191 assert_equal "title",cap.asset["title"] 191 assert_equal "title",cap.asset["title"]
192 assert_equal "pelle@neubia.com",cap.email 192 assert_equal "pelle@neubia.com",cap.email
193 assert_equal "pelle@neubia.com",cap["email"] 193 assert_equal "pelle@neubia.com",cap["email"]
194 - 194 +
195 # Non decrypting version 195 # Non decrypting version
196 raw=AssetRaw.find cap.asset.id 196 raw=AssetRaw.find cap.asset.id
197 assert_not_equal "title",raw.title 197 assert_not_equal "title",raw.title
198 assert_not_equal "title",raw["title"] 198 assert_not_equal "title",raw["title"]
199 - 199 +
200 bob_key=cap.asset.share("bob@bob.com") 200 bob_key=cap.asset.share("bob@bob.com")
201 bob_cap=Cap.find_by_key bob_key 201 bob_cap=Cap.find_by_key bob_key
202 - 202 +
203 assert_not_equal key,bob_key 203 assert_not_equal key,bob_key
204 assert_not_nil bob_cap 204 assert_not_nil bob_cap
205 assert_not_nil bob_cap.asset 205 assert_not_nil bob_cap.asset
vendor/ezcrypto/test/encrypt_test.rb
1 require 'association_key_holder_test' 1 require 'association_key_holder_test'
2 2
3 class EncUser < ActiveRecord::Base 3 class EncUser < ActiveRecord::Base
4 - set_table_name "users" 4 + self.table_name = "users"
5 encrypt :name, :base64=>true 5 encrypt :name, :base64=>true
6 end 6 end
7 7
8 class RawUser < ActiveRecord::Base 8 class RawUser < ActiveRecord::Base
9 - set_table_name "users" 9 + self.table_name = "users"
10 end 10 end
11 11
12 class EncryptTest < AssociationKeyHolderTest 12 class EncryptTest < AssociationKeyHolderTest
13 def setup 13 def setup
14 - @key_holder=EncUser.create 14 + @key_holder=EncUser.create
15 end 15 end
16 - 16 +
17 def test_should_be_base64 17 def test_should_be_base64
18 assert EncUser.ezcrypto_base64? 18 assert EncUser.ezcrypto_base64?
19 end 19 end
20 - 20 +
21 def test_should_retain_session_key_on_reload 21 def test_should_retain_session_key_on_reload
22 key=EzCrypto::Key.generate 22 key=EzCrypto::Key.generate
23 key_holder.set_session_key key 23 key_holder.set_session_key key
24 assert_not_nil key_holder.session_key 24 assert_not_nil key_holder.session_key
25 assert_equal key.raw,key_holder.session_key.raw 25 assert_equal key.raw,key_holder.session_key.raw
26 - 26 +
27 key_holder.name="bob" 27 key_holder.name="bob"
28 key_holder.save 28 key_holder.save
29 - 29 +
30 assert_equal "bob",key_holder.name 30 assert_equal "bob",key_holder.name
31 - 31 +
32 found=EncUser.find key_holder.id 32 found=EncUser.find key_holder.id
33 assert_equal key_holder.name,found.name 33 assert_equal key_holder.name,found.name
34 - 34 +
35 raw=RawUser.find key_holder.id 35 raw=RawUser.find key_holder.id
36 assert_not_nil raw.name 36 assert_not_nil raw.name
37 assert_not_equal key_holder.name,raw.name 37 assert_not_equal key_holder.name,raw.name
38 - 38 +
39 end 39 end
40 - 40 +
41 end 41 end
vendor/plugins/access_control/test/test_helper.rb
1 ENV["RAILS_ENV"] = "test" 1 ENV["RAILS_ENV"] = "test"
2 require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment") 2 require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
3 - 3 +
4 require 'test/unit' 4 require 'test/unit'
5 require 'mocha' 5 require 'mocha'
6 6
@@ -11,12 +11,12 @@ require &#39;rails/test_help&#39; @@ -11,12 +11,12 @@ require &#39;rails/test_help&#39;
11 ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log") 11 ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
12 load(File.dirname(__FILE__) + '/schema.rb') 12 load(File.dirname(__FILE__) + '/schema.rb')
13 # change the table names for the tests to not touch 13 # change the table names for the tests to not touch
14 -Role.set_table_name 'access_control_test_roles'  
15 -RoleAssignment.set_table_name 'access_control_test_role_assignments' 14 +Role.table_name = 'access_control_test_roles'
  15 +RoleAssignment.table_name = 'access_control_test_role_assignments'
16 16
17 # accessor example class to access some resources 17 # accessor example class to access some resources
18 class AccessControlTestAccessor < ActiveRecord::Base 18 class AccessControlTestAccessor < ActiveRecord::Base
19 - set_table_name 'access_control_test_accessors' 19 + self.table_name = 'access_control_test_accessors'
20 acts_as_accessor 20 acts_as_accessor
21 attr_accessible :name 21 attr_accessible :name
22 def cache_keys(arg) 22 def cache_keys(arg)
@@ -29,8 +29,8 @@ end @@ -29,8 +29,8 @@ end
29 29
30 # resource example class to be accessed by some accessor 30 # resource example class to be accessed by some accessor
31 class AccessControlTestResource < ActiveRecord::Base 31 class AccessControlTestResource < ActiveRecord::Base
32 - set_table_name 'access_control_test_resources'  
33 - acts_as_accessible 32 + self.table_name = 'access_control_test_resources'
  33 + acts_as_accessible
34 PERMISSIONS[self.class.name] = {'bla' => N_('Bla')} 34 PERMISSIONS[self.class.name] = {'bla' => N_('Bla')}
35 35
36 attr_accessible :name 36 attr_accessible :name
vendor/plugins/action_tracker/test/action_tracker_model_test.rb
@@ -19,7 +19,7 @@ ActiveRecord::Schema.define do @@ -19,7 +19,7 @@ ActiveRecord::Schema.define do
19 end 19 end
20 20
21 class SomeModel < ActiveRecord::Base 21 class SomeModel < ActiveRecord::Base
22 - set_table_name :some_table 22 + self.table_name = :some_table
23 acts_as_trackable 23 acts_as_trackable
24 end 24 end
25 25
@@ -37,7 +37,7 @@ class ActionTrackerModelTest &lt; ActiveSupport::TestCase @@ -37,7 +37,7 @@ class ActionTrackerModelTest &lt; ActiveSupport::TestCase
37 end 37 end
38 38
39 def test_params_is_a_hash 39 def test_params_is_a_hash
40 - assert_kind_of Hash, @tracked_action.params 40 + assert_kind_of Hash, @tracked_action.params
41 end 41 end
42 42
43 def test_has_a_polymorphic_relation_with_user 43 def test_has_a_polymorphic_relation_with_user
@@ -57,7 +57,7 @@ class ActionTrackerModelTest &lt; ActiveSupport::TestCase @@ -57,7 +57,7 @@ class ActionTrackerModelTest &lt; ActiveSupport::TestCase
57 ta = ActionTracker::Record.create! :user => SomeModel.create!, :verb => :some_verb 57 ta = ActionTracker::Record.create! :user => SomeModel.create!, :verb => :some_verb
58 assert_equal "some_verb", ta.verb 58 assert_equal "some_verb", ta.verb
59 end 59 end
60 - 60 +
61 def test_verb_is_mandatory 61 def test_verb_is_mandatory
62 ta = ActionTracker::Record.new 62 ta = ActionTracker::Record.new
63 ta.valid? 63 ta.valid?
vendor/plugins/action_tracker/test/action_tracker_test.rb
@@ -23,12 +23,12 @@ ActiveRecord::Schema.define do @@ -23,12 +23,12 @@ ActiveRecord::Schema.define do
23 end 23 end
24 24
25 class SomeModel < ActiveRecord::Base 25 class SomeModel < ActiveRecord::Base
26 - set_table_name :some_table 26 + self.table_name = :some_table
27 acts_as_trackable 27 acts_as_trackable
28 end 28 end
29 29
30 class OtherModel < ActiveRecord::Base 30 class OtherModel < ActiveRecord::Base
31 - set_table_name :other_table 31 + self.table_name = :other_table
32 acts_as_trackable 32 acts_as_trackable
33 end 33 end
34 34
@@ -108,7 +108,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -108,7 +108,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
108 end 108 end
109 109
110 def test_track_actions_executes_block 110 def test_track_actions_executes_block
111 - @controller = create_controller do 111 + @controller = create_controller do
112 track_actions :some_verb do 112 track_actions :some_verb do
113 throw :some_symbol 113 throw :some_symbol
114 end 114 end
@@ -162,7 +162,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -162,7 +162,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
162 assert_difference 'ActionTracker::Record.count' do 162 assert_difference 'ActionTracker::Record.count' do
163 get :index, :foo => 5 163 get :index, :foo => 5
164 end 164 end
165 - assert_equal({"action"=>"index", "foo"=>"5", "controller"=>"things"}, ActionTracker::Record.first.params) 165 + assert_equal({"action"=>"index", "foo"=>"5", "controller"=>"things"}, ActionTracker::Record.first.params)
166 end 166 end
167 167
168 def test_keep_params_not_set_should_store_all_params 168 def test_keep_params_not_set_should_store_all_params
@@ -237,7 +237,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -237,7 +237,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
237 end 237 end
238 assert_equal "test", ActionTracker::Record.last.user.some_column 238 assert_equal "test", ActionTracker::Record.last.user.some_column
239 end 239 end
240 - 240 +
241 def test_should_update_when_verb_is_updatable_and_no_timeout 241 def test_should_update_when_verb_is_updatable_and_no_timeout
242 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something", :type => :updatable } } 242 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something", :type => :updatable } }
243 ActionTrackerConfig.timeout = 5.minutes 243 ActionTrackerConfig.timeout = 5.minutes
@@ -252,7 +252,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -252,7 +252,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
252 assert_no_difference 'ActionTracker::Record.count' do 252 assert_no_difference 'ActionTracker::Record.count' do
253 get :test 253 get :test
254 end 254 end
255 - end 255 + end
256 256
257 def test_should_create_when_verb_is_updatable_and_timeout 257 def test_should_create_when_verb_is_updatable_and_timeout
258 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something", :type => :updatable } } 258 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something", :type => :updatable } }
@@ -268,7 +268,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -268,7 +268,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
268 assert_difference 'ActionTracker::Record.count' do 268 assert_difference 'ActionTracker::Record.count' do
269 get :test 269 get :test
270 end 270 end
271 - end 271 + end
272 272
273 def test_should_update_when_verb_is_groupable_and_no_timeout 273 def test_should_update_when_verb_is_groupable_and_no_timeout
274 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something", :type => :groupable } } 274 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something", :type => :groupable } }
@@ -284,7 +284,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -284,7 +284,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
284 assert_no_difference 'ActionTracker::Record.count' do 284 assert_no_difference 'ActionTracker::Record.count' do
285 get :test, :foo => "test" 285 get :test, :foo => "test"
286 end 286 end
287 - end 287 + end
288 288
289 def test_should_create_when_verb_is_groupable_and_timeout 289 def test_should_create_when_verb_is_groupable_and_timeout
290 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something", :type => :groupable } } 290 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something", :type => :groupable } }
@@ -330,7 +330,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -330,7 +330,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
330 def test_should_get_time_spent_doing_something 330 def test_should_get_time_spent_doing_something
331 ActionTrackerConfig.verbs = { :some_verb => { :type => :updatable }, :other_verb => { :type => :updatable } } 331 ActionTrackerConfig.verbs = { :some_verb => { :type => :updatable }, :other_verb => { :type => :updatable } }
332 m = SomeModel.create! 332 m = SomeModel.create!
333 - @controller = create_controller do 333 + @controller = create_controller do
334 track_actions :some_verb 334 track_actions :some_verb
335 end 335 end
336 @controller.stubs(:current_user).returns(m) 336 @controller.stubs(:current_user).returns(m)
@@ -394,7 +394,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -394,7 +394,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
394 assert_equal "foo", ActionTracker::Record.last.params["other_column"] 394 assert_equal "foo", ActionTracker::Record.last.params["other_column"]
395 assert_nil ActionTracker::Record.last.params["another_column"] 395 assert_nil ActionTracker::Record.last.params["another_column"]
396 end 396 end
397 - 397 +
398 def test_replace_dots_by_underline_in_param_name 398 def test_replace_dots_by_underline_in_param_name
399 ActionTrackerConfig.verbs = { :test => { :description => "Some" } } 399 ActionTrackerConfig.verbs = { :test => { :description => "Some" } }
400 model = create_model do 400 model = create_model do
@@ -407,7 +407,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -407,7 +407,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
407 assert_equal 3, ActionTracker::Record.last.params["other_column_size"] 407 assert_equal 3, ActionTracker::Record.last.params["other_column_size"]
408 assert_equal 5, ActionTracker::Record.last.params["another_column"] 408 assert_equal 5, ActionTracker::Record.last.params["another_column"]
409 end 409 end
410 - 410 +
411 def test_track_actions_store_all_params 411 def test_track_actions_store_all_params
412 ActionTrackerConfig.verbs = { :test => { :description => "Some" } } 412 ActionTrackerConfig.verbs = { :test => { :description => "Some" } }
413 model = create_model do 413 model = create_model do
@@ -452,7 +452,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -452,7 +452,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
452 model = create_model { track_actions :test, :after_create, :keep_params => :all, :if => Proc.new { 2 > 1 } } 452 model = create_model { track_actions :test, :after_create, :keep_params => :all, :if => Proc.new { 2 > 1 } }
453 @controller = create_controller_for_model(model) 453 @controller = create_controller_for_model(model)
454 assert_difference('ActionTracker::Record.count') { get :test } 454 assert_difference('ActionTracker::Record.count') { get :test }
455 - 455 +
456 model = create_model { track_actions :test, :after_create, :keep_params => :all, :if => Proc.new { 2 < 1 } } 456 model = create_model { track_actions :test, :after_create, :keep_params => :all, :if => Proc.new { 2 < 1 } }
457 @controller = create_controller_for_model(model) 457 @controller = create_controller_for_model(model)
458 assert_no_difference('ActionTracker::Record.count') { get :test } 458 assert_no_difference('ActionTracker::Record.count') { get :test }
@@ -460,7 +460,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase @@ -460,7 +460,7 @@ class ActionTrackerTest &lt; ActiveSupport::TestCase
460 model = create_model { track_actions :test, :after_create, :keep_params => :all, :unless => Proc.new { 2 > 1 } } 460 model = create_model { track_actions :test, :after_create, :keep_params => :all, :unless => Proc.new { 2 > 1 } }
461 @controller = create_controller_for_model(model) 461 @controller = create_controller_for_model(model)
462 assert_no_difference('ActionTracker::Record.count') { get :test } 462 assert_no_difference('ActionTracker::Record.count') { get :test }
463 - 463 +
464 model = create_model { track_actions :test, :after_create, :keep_params => :all, :unless => Proc.new { 2 < 1 } } 464 model = create_model { track_actions :test, :after_create, :keep_params => :all, :unless => Proc.new { 2 < 1 } }
465 @controller = create_controller_for_model(model) 465 @controller = create_controller_for_model(model)
466 assert_difference('ActionTracker::Record.count') { get :test } 466 assert_difference('ActionTracker::Record.count') { get :test }
vendor/plugins/validates_as_cnpj/test/cnpj_test.rb
@@ -4,7 +4,7 @@ require &#39;../lib/validates_as_cnpj&#39; @@ -4,7 +4,7 @@ require &#39;../lib/validates_as_cnpj&#39;
4 4
5 # Modelo 5 # Modelo
6 class CNPJData < ActiveRecord::Base 6 class CNPJData < ActiveRecord::Base
7 - set_table_name "cnpjs" 7 + self.table_name = "cnpjs"
8 8
9 validates_as_cnpj :cnpj 9 validates_as_cnpj :cnpj
10 end 10 end
@@ -16,37 +16,37 @@ class CNPJsTest &lt; Test::Unit::TestCase @@ -16,37 +16,37 @@ class CNPJsTest &lt; Test::Unit::TestCase
16 16
17 assert cnpj_valido.save, "Nao salvou CNPJ nulo." 17 assert cnpj_valido.save, "Nao salvou CNPJ nulo."
18 end 18 end
19 - 19 +
20 def test_aceita_cnpj_vazio_por_que_deve_ser_barrado_por_validates_presence_of 20 def test_aceita_cnpj_vazio_por_que_deve_ser_barrado_por_validates_presence_of
21 cnpj_valido = CNPJData.new(:id => 1, :cnpj => "") 21 cnpj_valido = CNPJData.new(:id => 1, :cnpj => "")
22 22
23 assert cnpj_valido.save, "Nao salvou CNPJ vazio." 23 assert cnpj_valido.save, "Nao salvou CNPJ vazio."
24 end 24 end
25 - 25 +
26 def test_cnpj_incompleto 26 def test_cnpj_incompleto
27 cnpj_invalido = CNPJData.new(:id => 1, :cnpj => "123") 27 cnpj_invalido = CNPJData.new(:id => 1, :cnpj => "123")
28 28
29 assert ( not cnpj_invalido.save ), "Salvou CNPJ incompleto." 29 assert ( not cnpj_invalido.save ), "Salvou CNPJ incompleto."
30 end 30 end
31 - 31 +
32 def test_cnpj_invalido_sem_pontuacao 32 def test_cnpj_invalido_sem_pontuacao
33 cnpj_invalido = CNPJData.new(:id => 1, :cnpj => "00000000000000") 33 cnpj_invalido = CNPJData.new(:id => 1, :cnpj => "00000000000000")
34 34
35 assert ( not cnpj_invalido.save ), "Salvou CNPJ invalido." 35 assert ( not cnpj_invalido.save ), "Salvou CNPJ invalido."
36 end 36 end
37 - 37 +
38 def test_cnpj_valido_sem_pontuacao 38 def test_cnpj_valido_sem_pontuacao
39 cnpj_valido = CNPJData.new(:id => 1, :cnpj => "04613251000100") 39 cnpj_valido = CNPJData.new(:id => 1, :cnpj => "04613251000100")
40 40
41 assert cnpj_valido.save, "Nao salvou CNPJ valido." 41 assert cnpj_valido.save, "Nao salvou CNPJ valido."
42 end 42 end
43 - 43 +
44 def test_cnpj_invalido_sem_pontuacao_com_digitos_verificadores_invertidos 44 def test_cnpj_invalido_sem_pontuacao_com_digitos_verificadores_invertidos
45 cnpj_invalido = CNPJData.new(:id => 1, :cnpj => "10002574000125") 45 cnpj_invalido = CNPJData.new(:id => 1, :cnpj => "10002574000125")
46 46
47 assert ( not cnpj_invalido.save ), "Salvou CNPJ invalido." 47 assert ( not cnpj_invalido.save ), "Salvou CNPJ invalido."
48 end 48 end
49 - 49 +
50 def test_cnpj_invalido_com_pontuacao 50 def test_cnpj_invalido_com_pontuacao
51 cnpj_invalido = CNPJData.new(:id => 1, :cnpj => "51.357.999/1110-98") 51 cnpj_invalido = CNPJData.new(:id => 1, :cnpj => "51.357.999/1110-98")
52 52