SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Chapter 6: Can't run unit test

    Hi--

    I can't run the unit test on page 171. The result I get from the command line is:

    Code:
    C:\INSTAN~1\INSTAN~1>CD C:\InstantRails\InstantRails
    
    C:\InstantRails\InstantRails>PATH C:\InstantRails\InstantRails\ruby\bin;C:\Insta
    ntRails\InstantRails\mysql\bin;c:\ruby\bin;C:\Python25;C:\Program Files\QuickTim
    e\QTSystem\;;C:\INSTAN~1\INSTAN~1\ruby\bin;C:\INSTAN~1\INSTAN~1\Apache;C:\INSTAN
    ~1\INSTAN~1\PHP
    
    C:\InstantRails\InstantRails>cd rails_apps
    
    C:\InstantRails\InstantRails\rails_apps>dir
     Volume in drive C has no label.
     Volume Serial Number is 6869-992D
    
     Directory of C:\InstantRails\InstantRails\rails_apps
    
    03/02/2007  07:41 PM    <DIR>          .
    03/02/2007  07:41 PM    <DIR>          ..
    02/16/2007  08:45 PM    <DIR>          cookbook
    03/02/2007  07:41 PM    <DIR>          shovell
    02/16/2007  08:46 PM    <DIR>          typo-2.6.0
                   0 File(s)              0 bytes
                   5 Dir(s)     323,076,096 bytes free
    
    C:\InstantRails\InstantRails\rails_apps>cd shovell
    
    C:\InstantRails\InstantRails\rails_apps\shovell>rake test:units
    C:0:Warning: require_gem is obsolete.  Use gem instead.
    (in C:/InstantRails/InstantRails/rails_apps/shovell)
    C:/InstantRails/InstantRails/ruby/bin/ruby -Ilib;test "C:/InstantRails/InstantRa
    ils/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb" "test/u
    nit/story_test.rb"
    C:/InstantRails/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rak
    e_test_loader.rb:5:in `load': ./test/unit/story_test.rb:31: parse error, unexpec
    ted $, expecting kEND (SyntaxError)
            from C:/InstantRails/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1
    /lib/rake/rake_test_loader.rb:5
            from C:/InstantRails/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1
    /lib/rake/rake_test_loader.rb:5
    rake aborted!
    Command failed with status (1): [C:/InstantRails/InstantRails/ruby/bin/ruby...]
    
    (See full trace by running task with --trace)
    
    C:\InstantRails\InstantRails\rails_apps\shovell>
    Can you tell me what is wrong, and what I can do to correct the issue?

    Thank you.

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm no expert, but it looks like you may have forgotten to close one of your test 'def's with an 'end' (around line 31?). You may want to post your story_test.rb code if unable to find the cause of your problem.

  3. #3
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thank you

    Thank you, yes that was what it was.

    I'm not very good about Ruby syntax, and I have been reading through the Pickaxe book to fill in my gaps of knowledge.

    I find reading that complements the Patrick Lenz book very well.

    Thanks again,
    Paul

  4. #4
    SitePoint Member
    Join Date
    May 2007
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Quote Originally Posted by jmoriconi View Post
    I'm no expert, but it looks like you may have forgotten to close one of your test 'def's with an 'end' (around line 31?). You may want to post your story_test.rb code if unable to find the cause of your problem.
    Your answer solved Paul's problem. I have a problem of my own: when I attempt to run the test, in Chapter 6, it aborts even earlier than Paul's.

    Here is the response I get when I run the test:


    D:\INSTAN~1>CD D:\InstantRails

    D:\InstantRails>PATH D:\InstantRails\ruby\bin;D:\InstantRails\mysql\bin;C:\Progr
    am Files\Real\RealProducer Basic 10;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sy
    stem32\Wbem;D:\INSTAN~1\ruby\bin;D:\INSTAN~1\Apache;D:\INSTAN~1\PHP

    D:\InstantRails>cd rails_apps

    D:\InstantRails\rails_apps>dir
    Volume in drive D is Local Disk
    Volume Serial Number is 2808-43DB

    Directory of D:\InstantRails\rails_apps

    06/04/2007 02:16 PM <DIR> .
    06/04/2007 02:16 PM <DIR> ..
    02/13/2007 10:06 AM <DIR> .metadata
    02/13/2007 10:06 AM <DIR> cookbook
    05/09/2007 02:47 PM <DIR> shovell
    02/13/2007 10:06 AM <DIR> typo-2.6.0
    0 File(s) 0 bytes
    6 Dir(s) 33,635,917,824 bytes free

    D:\InstantRails\rails_apps>cd shovell

    D:\InstantRails\rails_apps\shovell>rake test::units
    D:0:Warning: require_gem is obsolete. Use gem instead.
    (in D:/InstantRails/rails_apps/shovell)
    rake aborted!
    Don't know how to build task 'test::units'

    (See full trace by running task with --trace)

    D:\InstantRails\rails_apps\shovell>

    You can see that I am stopped before I even get started. Any suggestions for my problem?

    Thanks,
    Jim

  5. #5
    SitePoint Member
    Join Date
    May 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Jim,

    Can you run these three commands at the command prompt and give us the output? It could help:

    gem -v
    rails --version
    ruby --version

  6. #6
    SitePoint Member
    Join Date
    May 2007
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face

    Quote Originally Posted by naevity View Post
    Hi Jim,

    Can you run these three commands at the command prompt and give us the output? It could help:

    gem -v
    rails --version
    ruby --version
    Here are the results:

    gem -v = 0.9.3
    rails --version = "require_gem is obsolete. Use gem instead." 1.2.3
    ruby --version 1.8.5 (2006-08-25) [i386-mswin32]

    My apologies for not having included the information with my initial post.

    Thanks,
    Jim

  7. #7
    SitePoint Member
    Join Date
    May 2007
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    Quote Originally Posted by blansett View Post
    Here are the results:

    gem -v = 0.9.3
    rails --version = "require_gem is obsolete. Use gem instead." 1.2.3
    ruby --version 1.8.5 (2006-08-25) [i386-mswin32]

    My apologies for not having included the information with my initial post.

    Thanks,
    Jim
    Do I take the collective silence of the world to indicate that no one can provide an answer to my difficulties?

    Can I proceed through the book without being able to run unit tests?

    Thanks,

    Jim

  8. #8
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,030
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Hello Jim,
    You've probably figured out the problem by now but...

    It should be:
    rake test:units

    Not:
    rake test::units
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  9. #9
    SitePoint Member
    Join Date
    May 2007
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Quote Originally Posted by awasson View Post
    Hello Jim,
    You've probably figured out the problem by now but...

    It should be:
    rake test:units

    Not:
    rake test::units
    Damn! I must get my glasses checked.

    I am constantly amazed at how well Ruby runs, if I just input the proper instructions. Your suggestion, Andrew, solved my problem (as you knew it would).

    Thanks for your help.

    Jim

  10. #10
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,030
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Good... It's always nice to figure out the easy answer!

    I can see how you could have done that with all of the colons, double colons, single quotes and double quotes... Beyond that, I'm finding it to be a really great platform and a bit of a paradigm shift from other solutions.

    Cheers,
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •