On Thu, Jun 11, 2009 at 9:50 AM, Amit Kulkarni<[email protected]> wrote:
> 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
Why do you have that if there? That's gotta be screwing you up. So
the way Rails tests work, the fixtures don't get loaded until an
example is run. In your code, you're trying to find a user that
probably doesn't exist due to there being no fixtures loaded yet. So
why are you doing that find and subsequent if? Try changing it to:
describe BbPostsController do
context "test" do
fixtures :bb_posts, :users
it "should create post" do
User.find_by_login("amit").should_not be_nil
post = create_post
post.should be_valid
end
end
end
(that's an odd spec but let's try to get your fixtures loading first :)
Pat
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users