SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

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

    Testing Errors Chapter 7

    Well, I've overcome some initial problems and made it fairly smoothly to testing in Chapter 7. My unit tests run fine but I am getting 2 errors and a failure when it comes to my controller tests. I have checked for typos and everything appears to be clean. I have also tried to go to each test and cross reference it with each function that it is testing. With that said, my understanding of the terms is still a bit rusty. Any thoughts or direction? I have copied my test results below.

    Thanks in advance!


    7 tests, 7 assertions, 0 failures, 0 errors
    C:/InstantRails/InstantRails/ruby/bin/ruby -Ilib;test "C:/InstantRails/InstantRa
    ils/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb" "test/functional/story_controller_test.rb"
    Loaded suite C:/InstantRails/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3
    /lib/rake/rake_test_loader
    Started
    .......EFE
    Finished in 0.45 seconds.

    1) Error:
    test_should_show_new_form(StoryControllerTest):
    NoMethodError: undefined method `assert_select' for #<StoryControllerTest:0x4afb
    f38>
    C:/InstantRails/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/l
    ib/action_controller/test_process.rb:432:in `method_missing'
    ./test/functional/story_controller_test.rb:32:in `test_should_show_new_form'


    2) Failure:
    test_should_show_story(StoryControllerTest) [./test/functional/story_controller_
    test.rb:54]:
    <#<Story:0x49b9f18
    @attributes=
    {"permalink"=>"sitepoint-forums",
    "name"=>"SitePoint Forums",
    "id"=>"2",
    "link"=>"http://www.sitepoint.com/forums/"}>> expected but was
    <#<Story:0x49dbd88
    @attributes=
    {"permalink"=>"my-shiny-weblog",
    "name"=>"My shiny weblog",
    "id"=>"1",
    "link"=>"http://poocs.net/"},
    @votes=
    [#<Vote:0x49458d8 @attributes={"story_id"=>"1", "id"=>"1", "created_at"=>"2007
    -07-10 20:20:18"}>, #<Vote:0x4945818 @attributes={"story_id"=>"1", "id"=>"2", "c
    reated_at"=>"2007-07-10 20:20:18"}>]>>.

    3) Error:
    test_should_show_story_vote_elements(StoryControllerTest):
    NoMethodError: undefined method `assert_select' for #<StoryControllerTest:0x4afb
    ed8>
    C:/InstantRails/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/l
    ib/action_controller/test_process.rb:432:in `method_missing'
    ./test/functional/story_controller_test.rb:59:in `test_should_show_story_vot
    e_elements'

    10 tests, 20 assertions, 1 failures, 2 errors
    C:/InstantRails/InstantRails/ruby/bin/ruby -Ilib;test "C:/InstantRails/InstantRa
    ils/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb"
    rake aborted!
    Test failures

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

  2. #2
    SitePoint Member
    Join Date
    Feb 2007
    Location
    Wiesbaden, Germany
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi!

    Not having access to assert_select usually means you're on a Rails version prior to Rails 1.2. How did you install it and what platform are you on?

    The easiest check for the Rails version you have installed would probably be:

    Code:
    $ rails -v
    Rails 1.2.3
    Regarding the failure, please post your fixtures file at test/fixtures/stories.yml

    Best,
    Patrick

  3. #3
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Patrick,

    Thanks for the response. I am running vers. 1.2.3 and installed using the directions in your book for Instant Rails. I had some issues as MySQL was already installed so I have never been able to get it to work appropriately in conjunction with Instant Rails. With that said, I have never seemed to have any major problems.

    If I need to reinstall everything, I'd be glad to do so. I've been hesitant to do so though as I am not sure if any of my issues are operator-error or not. As I've mentioned previously, I am a complete novice at all of this.

    Here is my fixtures file... After running into the failure, I went to the code_archive and copied and pasted. The error remained.

    first:
    id: 1
    name: My shiny weblog
    link: http://poocs.net/
    permalink: my-shiny-weblog
    another:
    id: 2
    name: SitePoint Forums
    link: http://www.sitepoint.com/forums/
    permalink: sitepoint-forums

    Thanks for your help. Let me know your thoughts.
    Darrin

  4. #4
    SitePoint Member
    Join Date
    Feb 2007
    Location
    Wiesbaden, Germany
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Darrin,

    apparently it doesn't pick up version 1.2.3 properly. Your stack traces mention ActionPack 1.12.1 while Rails 1.2.3 ships with ActionPack 1.13.3 so there's definitely some confusion there.

    I don't have a windows box at hand to reproduce this sadly, but try and go ahead running:

    Code:
    gem update
    and

    Code:
    gem update --system
    This should update both your installed RubyGems and the installed RubyGems system (something changed with that along the way, too).

    Let me know if that solves your problem.

    Best,
    Patrick


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
  •