Rails integration test: setting the host
10/02/2009def test_something_else sess = open_session sess.host = "foo.bar.com" end
small snippets of webmonkey wisdom
def test_something_else sess = open_session sess.host = "foo.bar.com" end
If you’ve included fixtures in your unit test:
class UserTest < Test::Unit::TestCase fixtures :users
… the data will be available using:
users(:johnny)
A fixtures object behaves like a hash but is actually a method. It is a “hash with special powers“. To get Johnny’s surname you would do:
users(:johnny).surname
The YAML fixture might look something like this:
johnny: id: 2 first_name: Johnny surname: Smith email_address: jsmith@jsmith.cc