Skip to content
Browse files

Moved test object instantiation to a setup method.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
  • Loading branch information...
1 parent ab2b157 commit 0cb382cb6f51fbde8b22f6597b92d9bebb3445e7 @dasch dasch committed with NZKoz Sep 21, 2008
Showing with 9 additions and 9 deletions.
  1. +9 −9 activesupport/test/core_ext/module_test.rb
View
18 activesupport/test/core_ext/module_test.rb
@@ -62,6 +62,10 @@ class Name
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 @@ def test_included_in_classes
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 @@ def test_missing_delegation_target
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"

0 comments on commit 0cb382c

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