Note that there are some explanatory texts on larger screens.

plurals
  1. POWhere are the factory_girl records?
    primarykey
    data
    text
    <p>I'm trying to perform an integration test via <strong>Watir</strong> and <strong>RSpec</strong>. So, I created a test file within /integration and wrote a test, which adds a test user into a base via <strong>factory_girl</strong>.</p> <p>The problem is — I can't actually perform a login with my test user. The test I wrote looks as following:</p> <pre><code>... before(:each) @user = Factory(:user) @browser = FireWatir::Firefox.new end it "should login" @browser.text_field(:id, "username").set(@user.username) @browser.text_field(:id, "password").set(@user.password) @browser.button(:id, "get_in").click end ... </code></pre> <p>As I'm starting the test and see a "performance" in browser, it always fires up a <code>Username is not valid</code> error. </p> <p>I've started an investigation, and did a small trick. First of all I've started to have doubts if the factory actually creates the user in DB. So after the immediate call to factory I've put some <code>puts User.find</code> stuff only to discover that the user <strong>is</strong> actually in DB. Ok, but as user still couldn't have logged in I've decided to see if he's present in DB with my own eyes.</p> <p>I've added a <code>sleep</code> right after a factory call, and went to see what's in the DB at the moment. I was crushed to see that the user is actually missing there! How come? Still, when I'm trying to output a user within the code, he is actually being fetched from somewhere. <strong>So where does the records, made by factory_girl within a runtime lie?</strong> Is it <code>test</code> or <code>dev</code> DB? I don't get it.</p> <p>I've 10 times checked if I'm running my Mongrel in <code>test</code> mode (does it matter? I think it does, as I'm trying to tun an integration test) and if my <code>database.yml</code> holds the correct connection specific data.</p> <p>I'm using an <strong>authlogic</strong>, if that can give any clue (no, putting <code>activate_authlogic</code> doesn't work here).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload