[rspec-users] Fixtures are not loaded while running controller spec

Amit Kulkarni lists at ruby-forum.com
Thu Jun 11 12:50:53 EDT 2009


Hi,

   I am running controller spec and it gives me result as 0 examples, 0
failures.

   I checked into the database and i saw that fixtures are not loaded.

   Following are the details of my controller file.


   require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
def valid_bb_post_attributes
  {
    :body => "test description",
    :title => "test"
  }
end
describe BbPostsController do
  context "test" do
    fixtures :bb_posts, :users
    @user = User.find_by_login("amit")
    if @user
      it "should create post" do
        post = create_post
        post.should be_valid
      end
    end
  end

My bb_posts.ml file contains

bb_post1:
  id: 1
  body: body_description
  title: test

bb_post2:
  id: 2
  body: aasasaskajs
  title: wwwww

Similarly my users.yml contains

amit:
  id: 6
  login: amit
  email: amit at test.com

kiran:
  id : 7
  login: kiran
  email: kiran at test.com


I dont know what is wrong.
Please suggest :-)
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list