title: Rails RSpec: Controller Testing, checking if errors Array of model is filled with entries if new record cannot be created due to validation error
body: <p>I have a still pretty simple Rails application that I want to develop using BDD with Cucumber and TDD with RSpec. Currently, I am hanging at a test where I want to check that if a new instance of an Organizer (that's the model I have) cannot be created due to a validation error. I would like to check that the errors Array of the object to be created is not empty so that I can be sure that error messages are available for showing them in the view. </p>
  
  <p>require 'spec_helper'</p>
  
  <p>describe OrganizersController do
      render_views  </p>
  
  <pre><code>describe "POST 'create'" do
  
    describe "with invalid arguments" do
      before(:each) do
        request.env["HTTP_REFERER"] = organizers_new_path
        @organizer_args = { :name =&gt; "" }
      end      
  
      it "should return a non-empty list of errors" do
        post 'create', :organizer =&gt; @organizer_args
        @organizer.errors.empty?.should_not be_true
      end
    end
  end      
  </code></pre>
  
  <p>end</p>
  
  <p>I am developing based on Rails 3.2.9 with RSpec 2 and cucumber-rails. </p>
  
  <p>Any suggestions are appreciated. Thanks!</p>