aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorDaniel Schierbeck <daniel.schierbeck@gmail.com>2008-09-21 14:59:31 +0200
committerMichael Koziarski <michael@koziarski.com>2008-10-19 13:42:52 +0200
commit0cb382cb6f51fbde8b22f6597b92d9bebb3445e7 (patch)
tree2df6fa427035f1d83fb45dddc3b357601d9a9eb3 /activesupport
parentab2b1570fdfcb6fa148f30ccd6edcff6428b4d7a (diff)
downloadrails-0cb382cb6f51fbde8b22f6597b92d9bebb3445e7.tar.gz
rails-0cb382cb6f51fbde8b22f6597b92d9bebb3445e7.tar.bz2
rails-0cb382cb6f51fbde8b22f6597b92d9bebb3445e7.zip
Moved test object instantiation to a setup method.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/core_ext/module_test.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb
index 46d63748bc..7fe5d0faee 100644
--- a/activesupport/test/core_ext/module_test.rb
+++ b/activesupport/test/core_ext/module_test.rb
@@ -62,6 +62,10 @@ end
EOF
class ModuleTest < Test::Unit::TestCase
+ def setup
+ @david = Someone.new("David", Somewhere.new("Paulina", "Chicago"))
+ end
+
def test_included_in_classes
assert One.included_in_classes.include?(Ab)
assert One.included_in_classes.include?(Xy::Bc)
@@ -70,14 +74,12 @@ class ModuleTest < Test::Unit::TestCase
end
def test_delegation_to_methods
- david = Someone.new("David", Somewhere.new("Paulina", "Chicago"))
- assert_equal "Paulina", david.street
- assert_equal "Chicago", david.city
+ assert_equal "Paulina", @david.street
+ assert_equal "Chicago", @david.city
end
def test_delegation_down_hierarchy
- david = Someone.new("David", Somewhere.new("Paulina", "Chicago"))
- assert_equal "CHICAGO", david.upcase
+ assert_equal "CHICAGO", @david.upcase
end
def test_delegation_to_instance_variable
@@ -91,16 +93,14 @@ class ModuleTest < Test::Unit::TestCase
end
def test_delegation_prefix
- david = Someone.new("David", Somewhere.new("Paulina", "Chicago"))
- invoice = Invoice.new(david)
+ invoice = Invoice.new(@david)
assert_equal invoice.client_name, "David"
assert_equal invoice.client_street, "Paulina"
assert_equal invoice.client_city, "Chicago"
end
def test_delegation_custom_prefix
- david = Someone.new("David", Somewhere.new("Paulina", "Chicago"))
- invoice = Invoice.new(david)
+ invoice = Invoice.new(@david)
assert_equal invoice.customer_name, "David"
assert_equal invoice.customer_street, "Paulina"
assert_equal invoice.customer_city, "Chicago"