hi all, my first attempt at tests and i''m having trouble accessing the fixture values, if anyone can make it suggestions. i have news_release_test.rb, using new_releases.yml as the fixture file according to the agile book, i should be able to access the fixture properties within my test as such: assert_equal @first_test.id , @news_release.id unfortunately, i try that and get: "test_create(NewsReleaseTest): RuntimeError: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id" after looking on api.rubyonrails.com, i saw and tried this: @news_releases["first_test"]["id"] and now i get the following error: "NoMethodError: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.[]" thanks in advance, -- All the best, Matthew Collins Senior Developer MindComet Corporation Orlando ? Atlanta ? New York VISIT OUR BLOGS! Corporate Blog - http://blogs.mindcomet.com Culture Blog - http://www.cakeplow.com The Relationship Agency? 2701 Maitland Center Parkway, Suite 125 Maitland, FL 32751 v 800.668.1761 x316 f 407.838.1011 AIM mattatmindcomet http://www.mindcomet.com IMPORTANT NOTICE: The information contained in this e-mail message may be privileged and confidential. If you are not the intended recipient, any further disclosure or use, distribution, or copying of this message or any attachment is strictly prohibited. If you have received this e-mail message in error, please delete the e-mail, and either e-mail the sender at the above address or notify us at our telephone number 407.838.1010. Internet e-mail may be subject to delays, non-delivery and unauthorized alterations, therefore opinions, conclusions and other information expressed are not binding upon MindComet Corporation unless otherwise notified independently of this message. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060608/7e05f241/attachment.html
Hello. In your test_helper.rb file have you got.... self.use_instantiated_fixtures = true set? On 6/8/06, Matthew Collins <matthew.b2d31@mindcomet.com> wrote:> > hi all, > > my first attempt at tests and i''m having trouble accessing the fixture > values, if anyone can make it suggestions. > > > i have news_release_test.rb, using new_releases.yml as the fixture file > > according to the agile book, i should be able to access the fixture > properties within my test as such: > > assert_equal @first_test.id , @news_release.id > > unfortunately, i try that and get: > > "test_create(NewsReleaseTest): > RuntimeError: Called id for nil, which would mistakenly be 4 -- if > you really wanted the id of nil, use object_id" > > > after looking on api.rubyonrails.com, i saw and tried this: > > @news_releases["first_test"]["id"] > > and now i get the following error: > > "NoMethodError: You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > The error occured while evaluating nil.[]" > > > > thanks in advance, > > > > > > -- > > All the best, > > Matthew Collins > Senior Developer > MindComet Corporation > > Orlando ? Atlanta ? New York > > VISIT OUR BLOGS! > Corporate Blog - http://blogs.mindcomet.com > Culture Blog - http://www.cakeplow.com > > The Relationship Agency? > 2701 Maitland Center Parkway, Suite 125 > Maitland, FL 32751 > > v 800.668.1761 x316 > f 407.838.1011 > > AIM mattatmindcomet > > http://www.mindcomet.com > > IMPORTANT NOTICE: > The information contained in this e-mail message may be privileged and > confidential. If you are not the intended recipient, any further > disclosure or use, distribution, or copying of this message or any > attachment is strictly prohibited. If you have received this e-mail > message in error, please delete the e-mail, and either e-mail the sender > at the above address or notify us at our telephone number 407.838.1010. > Internet e-mail may be subject to delays, non-delivery and unauthorized > alterations, therefore opinions, conclusions and other information > expressed are not binding upon MindComet Corporation unless otherwise > notified independently of this message. > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Ross Riley riley.ross@gmail.com
yeah, that fixed it. thanks. On Jun 8, 2006, at 1:50 PM, Ross Riley wrote:> Hello. > > In your test_helper.rb file have you got.... > self.use_instantiated_fixtures = true > set? > > On 6/8/06, Matthew Collins <matthew.b2d31@mindcomet.com> wrote: > > > > hi all, > > > > my first attempt at tests and i''m having trouble accessing the > fixture > > values, if anyone can make it suggestions. > > > > > > i have news_release_test.rb, using new_releases.yml as the > fixture file > > > > according to the agile book, i should be able to access the fixture > > properties within my test as such: > > > > assert_equal @first_test.id , @news_release.id > > > > unfortunately, i try that and get: > > > > "test_create(NewsReleaseTest): > > RuntimeError: Called id for nil, which would mistakenly be 4 -- if > > you really wanted the id of nil, use object_id" > > > > > > after looking on api.rubyonrails.com, i saw and tried this: > > > > @news_releases["first_test"]["id"] > > > > and now i get the following error: > > > > "NoMethodError: You have a nil object when you didn''t expect it! > > You might have expected an instance of Array. > > The error occured while evaluating nil.[]" > > > > > > > > thanks in advance, > > > > > > > > > > > > -- > > > > All the best, > > > > Matthew Collins > > Senior Developer > > MindComet Corporation > > > > Orlando ? Atlanta ? New York > > > > VISIT OUR BLOGS! > > Corporate Blog - http://blogs.mindcomet.com > > Culture Blog - http://www.cakeplow.com > > > > The Relationship Agency? > > 2701 Maitland Center Parkway, Suite 125 > > Maitland, FL 32751 > > > > v 800.668.1761 x316 > > f 407.838.1011 > > > > AIM mattatmindcomet > > > > http://www.mindcomet.com > > > > IMPORTANT NOTICE: > > The information contained in this e-mail message may be > privileged and > > confidential. If you are not the intended recipient, any further > > disclosure or use, distribution, or copying of this message or any > > attachment is strictly prohibited. If you have received this e-mail > > message in error, please delete the e-mail, and either e-mail the > sender > > at the above address or notify us at our telephone number > 407.838.1010. > > Internet e-mail may be subject to delays, non-delivery and > unauthorized > > alterations, therefore opinions, conclusions and other information > > expressed are not binding upon MindComet Corporation unless > otherwise > > notified independently of this message. > > > > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > -- > Ross Riley > riley.ross@gmail.com > _______________________________________________ > Rails mailing list > rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > Reflexion Control Panel > To: matthew.b2d31@mindcomet.com Block messages from this sender > From: rails-bounces@lists.rubyonrails.org > > You received this message because the sender is using the correct > unique address assigned by Reflexion. >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060608/38c11b89/attachment.html