title: devise rspec tests
body: <p>why this test does not pass? i use devise for authentication.</p>
  
  <p>user.rb</p>
  
  <pre><code>  validates :username, presence: true, :length =&gt; { :minimum =&gt; 2 }
  </code></pre>
  
  <p>user_spec.rb</p>
  
  <pre><code>require 'spec_helper'
  
  describe User do
  
    before do
      @user = User.new(username: "Example User", email: "user@example.com",
                       password: "foobar", password_confirmation: "foobar")
    end
  
    describe "name" do
      before { @user.username="test" }
      it { should be_valid }
    end
  
  end
  </code></pre>