Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Open Source > BOOK: Professional Ruby On Rails ISBN: 978-0-470-22388-8
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Ruby On Rails ISBN: 978-0-470-22388-8
This is the forum to discuss the Wrox book Professional Ruby on Rails by Noel Rappin; ISBN: 9780470223888
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ruby On Rails ISBN: 978-0-470-22388-8 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old May 19th, 2009, 11:40 AM
Registered User
Join Date: Apr 2009
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Default How do you keep fixture/menu.yml from loading as a fixture?

On page 131 the book says to copy menu.yml to test/fixtures. When I do this I get a bunch of errors because (I think) the test framework is trying to load the data into a menu table, and there is no menu table. The italicized text on that page says not to load that file using the standard test fixtures helper, but it does not say how to do this. It seems that as soon as you put the file in the fixtures directory the framework tries to load it into the db. I solved this by moving menu.yml to test/unit and changing the path to it in the menu_sidebar_test.

Is there a better way to solve this issue?

Is there a rails convention for where a non-fixture test data yaml file should live?

I get this error for every test when the file is in the /fixtures directory.
    test_authorize                                                       ERROR
    ActiveRecord::StatementInvalid: Mysql::Error: Table 'soupsonline_test.menu' doesn't exist: DELETE FROM `menu`
Reply With Quote
  #2 (permalink)  
Old May 27th, 2009, 10:15 PM
Wrox Author
Join Date: Mar 2008
Location: , , .
Posts: 41
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via AIM to noelrap

I think this might be a Rails version issue, at least in part. At some point, the test/test_helper.rb file added

fixtures :all
which automatically loads all the fixtures. In the version that I have of this app locally, that line is not in the test_helper.rb file, instead each individual test file loads the fixtures it needs -- given later Rails conventions, I probably would have tried to figure out a different way to run this.

If your code has the fixtures :all line, then take it out and try again. If it's not there, then I'm not sure what the problem is.
Reply With Quote
The Following User Says Thank You to noelrap For This Useful Post:
DanS (May 28th, 2009)
  #3 (permalink)  
Old May 28th, 2009, 12:06 PM
Registered User
Join Date: Apr 2009
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts

Yup, test_helper.rb did have the line:
fixtures :all
Commenting that line out caused a bunch of other errors. When I replaced that line with this:
fixtures :ingredients, :recipes, :users
and undid my other changes
all the tests passed.

Thanks very much for your help on this. I find it hard as a reader to keep up with the continuous revisions to rails, I'll bet it is much worse for an author.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 15 Context Menu - Element Menu Items Razzy The Pug BOOK: Ivor Horton's Beginning Visual C++ 2005 2 November 9th, 2008 02:53 PM
how create menubar, menu, menu item in xsl vijayanmsc XSLT 1 June 5th, 2006 06:43 AM
Menu Help in statusbar at mousemove over Menu item Kaustav VB Components 1 September 14th, 2005 09:28 AM
right click menu hidden by drop-drown menu Andraw HTML Code Clinic 0 March 18th, 2005 02:28 PM
Changing Menu made with VB 4 Menu Editor Zooker VB How-To 1 July 26th, 2003 11:44 PM

All times are GMT -4. The time now is 11:52 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.