[rspec-users] Fixtures are not loaded while running controller spec
David Chelimsky
dchelimsky at gmail.com
Thu Jun 11 12:58:51 EDT 2009
On Thu, Jun 11, 2009 at 11:50 AM, Amit Kulkarni<lists at ruby-forum.com> wrote:
> 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 :-)
Make sure that the fixtures are in the same place that is declared in
spec/spec_helper.rb.
More information about the rspec-users
mailing list