Skip to content
Browse files

Fix deprecation warning for set_table_name

ActiveRecord 3.2.x uses `self.table_name = …` instead
  • Loading branch information...
1 parent da6dd8a commit a8aff4e8fff298b65ce3b87ee0e836af665b8685 @boosty boosty committed Dec 27, 2011
Showing with 14 additions and 14 deletions.
  1. +14 −14 test/flag_shih_tzu_test.rb
View
28 test/flag_shih_tzu_test.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
class Spaceship < ActiveRecord::Base
- set_table_name 'spaceships'
+ self.table_name = 'spaceships'
include FlagShihTzu
has_flags 1 => :warpdrive,
@@ -10,43 +10,43 @@ class Spaceship < ActiveRecord::Base
end
class SpaceshipWithoutNamedScopes < ActiveRecord::Base
- set_table_name 'spaceships'
+ self.table_name = 'spaceships'
include FlagShihTzu
has_flags(1 => :warpdrive, :named_scopes => false)
end
class SpaceshipWithoutNamedScopesOldStyle < ActiveRecord::Base
- set_table_name 'spaceships'
+ self.table_name = 'spaceships'
include FlagShihTzu
has_flags({1 => :warpdrive}, :named_scopes => false)
end
class SpaceshipWithCustomFlagsColumn < ActiveRecord::Base
- set_table_name 'spaceships_with_custom_flags_column'
+ self.table_name = 'spaceships_with_custom_flags_column'
include FlagShihTzu
has_flags(1 => :warpdrive, 2 => :hyperspace, :column => 'bits')
end
class SpaceshipWithColumnNameAsSymol < ActiveRecord::Base
- set_table_name 'spaceships_with_custom_flags_column'
+ self.table_name = 'spaceships_with_custom_flags_column'
include FlagShihTzu
has_flags(1 => :warpdrive, 2 => :hyperspace, :column => :bits)
end
class SpaceshipWith2CustomFlagsColumn < ActiveRecord::Base
- set_table_name 'spaceships_with_2_custom_flags_column'
+ self.table_name = 'spaceships_with_2_custom_flags_column'
include FlagShihTzu
has_flags({ 1 => :warpdrive, 2 => :hyperspace }, :column => 'bits')
has_flags({ 1 => :jeanlucpicard, 2 => :dajanatroj }, :column => 'commanders')
end
class SpaceshipWithBitOperatorQueryMode < ActiveRecord::Base
- set_table_name 'spaceships'
+ self.table_name = 'spaceships'
include FlagShihTzu
has_flags(1 => :warpdrive, 2 => :shields, :flag_query_mode => :bit_operator)
@@ -69,7 +69,7 @@ def test_has_flags_should_raise_an_exception_when_flag_key_is_negative
assert_raises ArgumentError do
eval(<<-EOF
class SpaceshipWithInvalidFlagKey < ActiveRecord::Base
- set_table_name 'spaceships'
+ self.table_name = 'spaceships'
include FlagShihTzu
has_flags({ -1 => :error })
@@ -83,7 +83,7 @@ def test_has_flags_should_raise_an_exception_when_flag_name_already_used
assert_raises ArgumentError do
eval(<<-EOF
class SpaceshipWithAlreadyUsedFlag < ActiveRecord::Base
- set_table_name 'spaceships_with_2_custom_flags_column'
+ self.table_name = 'spaceships_with_2_custom_flags_column'
include FlagShihTzu
has_flags({ 1 => :jeanluckpicard }, :column => 'bits')
@@ -98,7 +98,7 @@ def test_has_flags_should_raise_an_exception_when_desired_flag_name_method_alrea
assert_raises ArgumentError do
eval(<<-EOF
class SpaceshipWithAlreadyUsedMethod < ActiveRecord::Base
- set_table_name 'spaceships_with_2_custom_flags_column'
+ self.table_name = 'spaceships_with_2_custom_flags_column'
include FlagShihTzu
def jeanluckpicard; end
@@ -114,7 +114,7 @@ def test_has_flags_should_not_raise_an_exception_when_flag_name_method_defined_b
assert_nothing_raised ArgumentError do
eval(<<-EOF
class SpaceshipWithAlreadyUsedMethodByFlagshitzu < ActiveRecord::Base
- set_table_name 'spaceships_with_2_custom_flags_column'
+ self.table_name = 'spaceships_with_2_custom_flags_column'
include FlagShihTzu
has_flags({ 1 => :jeanluckpicard }, :column => 'bits')
@@ -129,7 +129,7 @@ def test_has_flags_should_raise_an_exception_when_flag_name_is_not_a_symbol
assert_raises ArgumentError do
eval(<<-EOF
class SpaceshipWithInvalidFlagName < ActiveRecord::Base
- set_table_name 'spaceships'
+ self.table_name = 'spaceships'
include FlagShihTzu
has_flags({ 1 => 'error' })
@@ -422,7 +422,7 @@ def test_should_ignore_has_flags_call_if_column_does_not_exist_yet
assert_nothing_raised do
eval(<<-EOF
class SpaceshipWithoutFlagsColumn < ActiveRecord::Base
- set_table_name 'spaceships_without_flags_column'
+ self.table_name = 'spaceships_without_flags_column'
include FlagShihTzu
has_flags 1 => :warpdrive,
@@ -440,7 +440,7 @@ def test_should_ignore_has_flags_call_if_column_not_integer
assert_raises FlagShihTzu::IncorrectFlagColumnException do
eval(<<-EOF
class SpaceshipWithNonIntegerColumn < ActiveRecord::Base
- set_table_name 'spaceships_with_non_integer_column'
+ self.table_name ='spaceships_with_non_integer_column'
include FlagShihTzu
has_flags 1 => :warpdrive,

0 comments on commit a8aff4e

Please sign in to comment.
Something went wrong with that request. Please try again.