Forum: Ruby on Rails Unit Tests Take 2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Af93ba6b6b59f22a8f37e8de5702ef98?d=identicon&s=25 Bob Silva (Guest)
on 2006-01-28 08:45
(Received via mailing list)
Different question this time, and maybe only a core developer can
answer.



In 1.0,  use_instantiated_fixtures is turned off by default. What is the
new
best-practice for not tying your tests to your test data?



Before you would use:



In clients.yml



first_client:

  id: 1

  name: Fred



In a test case:



def test_sometest

  assert_equal @first_client.name, @client.name

end



With this setting turned off be default, for obvious reasons, is there a
different method of doing the test so it is not dependent on the actual
data?



Thanks guys.



Bob Silva

http://www.railtie.net/
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-01-28 09:42
(Received via mailing list)
On Jan 27, 2006, at 11:46 PM, Bob Silva wrote:

> Before you would use:
>
>   assert_equal @first_client.name, @client.name
>
> end
>
>
>
> With this setting turned off be default, for obvious reasons, is
> there a different method of doing the test so it is not dependent
> on the actual data?
   assert_equal clients(:first_client).name, @client.name
This topic is locked and can not be replied to.