Fixtures in RSpec

If you want to use fixtures with RSpec, specify your fixtures in the describe block, not within a before block:

describe StudentsController do
  fixtures :students

  before do
    # more test setup
  end
end

Your student fixtures will get loaded into the students table and then rolled back at the end of each test using database transactions.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)