Displaying 3 results from an estimated 3 matches for "persontest".
2006 Jun 11
7
testcase_setup_and_teardown_with_blocks (aka "The plugin with the very long name")
...n).
Anyway, I just wrapped up my solution in a plugin. The answer: use
blocks!
class Test::Unit::TestCase
# This is overridden by the subclass and will not be called
def setup
end
# This is overridden by the subclass and will not be called
def teardown
end
end
class PersonTest < Test::Unit::TestCase
# This overrides the method in the superclass
def setup
end
# This overrides the method in the superclass
def teardown
end
# Only the setup and teardown methods in this class will be called
def test_name
end
end
Becomes ...
class...
2006 Mar 18
0
unit tests for sub-classes
I posted about this a couple of weeks ago but didn''t get much response so I
thought I''d try again.
when you create a subclass of Test::Unit::TestCase, e.g. PersonTest (for
model Person), the tests in that class get run automatically whenever the
file is loaded. so far so good.
Let''s say I then create a Manager class which subclasses Person. I want
ManagerTest to extend PersonTest. However, because of the automatic running
I mentioned previously, if...
2006 Jan 25
2
Testing a model method - private method?
...;
end
The method works ok. But when I try to test it:
assert_equal ("<a href=''mailto:" + people(:staff1_person).email +
"''>" + people(:staff1_person).email + "</a>"), @person.html_email
I get a failure:
1) Error:
test_html_email(PersonTest):
NoMethodError: private method `html_email'' called for #<Person:0x256b460>
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1501:in
`method_missing''
test/unit/person...