SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Threaded View

  1. #1
    SitePoint Member jennifert's Avatar
    Join Date
    Oct 2007
    Location
    Canada
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy [SOLVED] Rails Book p231: 1 failure 2 errors in story-controller-test.rb

    Hello,

    I just started this book a day ago and its really great. At the end of chapter 7, when I tried to run the final "rake test" , I received 1 failure and 2 errors. Rake test:unites runs smoothly - no errors.

    I double checked my code in the book to make sure it matched the book and I still have errors. I looked in the code achieve and tried pasting that code in where the error suggested and still no luck.

    Is anyone having the same trouble?

    The controller code is below (story_controller_test.rb).

    Code Ruby:
    def test_should_show_story
        get :show, :permalink => 'my-shiny-weblog'
        assert_response :success
        assert_template 'show'
        assert_equal stories(:another), assigns(:story)
      end
     
      def test_should_show_story_vote_elements
        get :show, :permalink => 'my-shiny-weblog'
        assert_select 'h2 span#vote_score'
        assert_select 'ul#vote_history li', :count => 2
        assert_select 'div#vote_link'
      end
     
      def test_should_accept_vote
        assert stories(:another).votes.empty?
        post :vote, :id => 2
        assert ! assigns(:story).reload.votes.empty?
      end
     
      def test_should_render_rjs_after_vote_with_ajax
        xml_http_request :post, :vote, :id => 2
        assert_response :success
        assert_template 'vote'
      end
     
      def test_should_redirect_after_vote_with_get
        get :vote, :id => 2
        assert_redirected_to :action => 'show',
          :permalink => 'sitepoint-forums'
      end

    When I compared my _vote.rhtml file to the code achieve it was the same. The application works as expected when running webBrick. Any suggestions? Did I miss something? Should I attach other files? I tried searching the form but it seemed like no one had the same errors as me.
    Attached Files Attached Files
    Last edited by jennifert; Nov 1, 2007 at 06:58. Reason: Solved problem.


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
  •