title: Rails integration test with the devise gem
body: <p>I want to write an rails integration test (with <code>ActionDispatch::IntegrationTest</code>). I am using devise for authentication and machinist for test models. I cannot successfully sign in.</p>
  
  <p>Here is a simple example:</p>
  
  <pre><code>class UserFlowsTest &lt; ActionDispatch::IntegrationTest
    setup do
      User.make
    end
    test "sign in to the site" 
      # sign in
      post_via_redirect 'users/sign_in', :email =&gt; 'foo@bar.com', :password =&gt; 'qwerty'    
      p flash
      p User.all
  end
  </code></pre>
  
  <p>Here is the debug output:</p>
  
  <pre><code>Loaded suite test/integration/user_flows_test
  Started
  {:alert=&gt;"Invalid email or password."}
  [#&lt;User id: 980190962, email: "", encrypted_password: "", password_salt: "", reset_password_token: nil, remember_token: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: "2010-11-27 16:44:10", updated_at: "2010-11-27 16:44:10"&gt;, #&lt;User id: 980190963, email: "foo@bar.com", encrypted_password: "$2a$10$vYSpjIfAd.Irl6eFvhJL0uAwp4qniv5gVl4O.Hnw/BUR...", password_salt: "$2a$10$vYSpjIfAd.Irl6eFvhJL0u", reset_password_token: nil, remember_token: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: "2010-11-27 17:09:13", updated_at: "2010-11-27 17:09:13"&gt;]
  "/unauthenticated"
  F
  </code></pre>
  
  <p>Here is my blueprints.rb:</p>
  
  <pre><code>require 'machinist/active_record'
  require 'sham'
  
  User.blueprint do
    email {"foo@bar.com"}
    password {"qwerty"}
  end
  </code></pre>