title: RSpec and weird tests results
body: <p>I'm trying to make a simple app. When Im testing it in browser everytyhing works just fine.  Howerver, when I try to run some tests with RSpec (2.5) it fails when it comes to :create test for controller. </p>
  
  <p>Here's my create method:</p>
  
  <pre><code>def create
   @website = Website.new(params[:website])
   if @website.save
  
     flash[:notice] = "Website created."
     redirect_to(:action =&gt; 'list')
   else
     render('new')
   end
  end
  </code></pre>
  
  <p>The controller test:</p>
  
  <pre><code>describe WebsitesController do
    render_views
    .
    .
    .
    describe "POST 'create'" do
      before(:each) do
        @attr = { :adres =&gt; "www.excc.pl", :opis =&gt; "aaa "*22, :tagi =&gt; "aaa aaa aaa",
                  :preview =&gt; File.new(Rails.root + 'spec/fixtures/rails.png'),
                  :preview_mini =&gt; File.new(Rails.root + 'spec/fixtures/rails.png')}
      end
      describe "success" do
        it "should have the right title" do
          response.should have_selector("title", :content=&gt;"Lista witryn w portfolio")
        end
      end
    .
    .
    .
  </code></pre>
  
  <p>The result of this test:</p>
  
  <pre><code>  1) WebsitesController POST 'create' should have the right title
       Failure/Error: response.should have_selector("title", :content=&gt;"Lista witryn    w portfolio")
       expected following output to contain a &lt;title&gt;Lista witryn w portfolio&lt;/title&gt; tag:
       &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"&gt;
       # ./spec/controllers/websites_controller_spec.rb:34:in `block (4 levels) in
  </code></pre>
  
  <p></p>
  
  <p>websites_controller_spec.rb:34 refers to create method</p>
  
  <p>However, this test is passed correctly (for incorrect data it should be redirected back to 'new' site with specified title):</p>
  
  <pre><code>it "should have the right title" do
      post :create, :website =&gt; @attr.merge(:adres =&gt; "")
      response.should have_selector("title", :content=&gt;"Dodaj stronę WWW")
  end
  </code></pre>
  
  <p>The second problem is...
  There was a time when I've got a test result like this: </p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;You are being &lt;a href="http://test.host/websites/list"&gt;redire cted&lt;/a&gt;.&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>... which was causing me to pull my hair out for some time until I've done sth (I don't really know what) and it was gone. Yet, it makes me scared like hell when I think that it can come back in future an ruin my happiness. </p>
  
  <p>Any thoughts on this would be greatly appreciated.</p>