title: Issues with testing in rails
body: <p>I am writing tests for my application. I have written quite a few tests and they were working fine. However, two of my tests keep failing and I am not sure why that is. The first test is a unsuccessful editing of a form. 
  The test is given below</p>
  
  <pre><code>test "unsuccessfull editing of the scoreboard" do
      log_in_as(@user)
      get edit_scoreboard_path(@scoreboard)
      assert_template 'scoreboards/edit' (doesn't work)
      patch scoreboard_path(@scoreboard), scoreboard: { name_of_scoreboard: "a"* 51,
                                                        name_of_organization: "b"*60,
                                                        name_of_activity: "c"*60 }
      assert_template 'scoreboard/edit' (doesn't work)
  
    end
  </code></pre>
  
  <p>The error associated with this test is given below.</p>
  
  <pre><code>ScoreboardEditTest#test_unsuccessfull_editing_of_the_scoreboard [/home/ubuntu/workspace/test/integration/scoreboard_edit_test.rb:13]:
  expecting &lt;"scoreboards/edit"&gt; but rendering with &lt;[]&gt;
  </code></pre>
  
  <p>The controller for the following test is also given below.</p>
  
  <pre><code>def update
    @scoreboard = Scoreboard.find(params[:id])
    if @scoreboard.update_attributes(scoreboard_params)
      redirect_to @scoreboard
      flash[:success] = "Updated Successfully"
    else
     render 'edit'
    end
   end
  </code></pre>
  
  <p>After you get the edit_scoreboard_path, the edit scoreboard template should show up. I am not exactly sure why it gives me the error. I have the exact same thing with the user model and its working just fine. I think I am missing something in my understanding of it works.</p>
  
  <p>The second test is a valid creation of a scoreboard. The test is given below.</p>
  
  <pre><code>test "valid creation of the scoreboard with passing validations" do
      log_in_as(@user)
      get new_scoreboard_path
      assert_difference 'Scoreboard.count', 1 do
        post scoreboards_path, scoreboard: {name_of_scoreboard: "abc",
                                            name_of_organization: "def",
                                            name_of_activity: "ghi" }
        end
        assert_redirected_to scoreboard_path(@scoreboard) (doesn't work)
        assert_equal 'Scoreboard created successfully', flash[:success]
    end
  </code></pre>
  
  <p>It redirecting to the wrong scoreboard id. In the fixtures I have the id set as 1. The error message is given below.</p>
  
  <pre><code>Expected response to be a redirect to &lt;http://www.example.com/scoreboards/1&gt; but was a redirect to &lt;http://www.example.com/scoreboards/941832920&gt;.
  </code></pre>
  
  <p>I am not sure exactly what this means. As I mentioned, I have the ID set in the fixtures. I even manually set the id to '941832920'. It still gave me an error. Not sure why its doing that. </p>