See https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md

It's FactoryGirl, not Factory (which used to be the correct constant,
but is no longer).

On Thu, Feb 28, 2013 at 8:44 AM, ruby rails <li...@ruby-forum.com> wrote:
> I have installed factory_girl_rails gem in Gemfile for both test as well
> as development. And in the password_rest_spec file I have given
>
> require 'spec_helper'
> describe "PasswordResets" do
> it "emails when user requesting password reset" do
>     user = Factory(:user)
>     #forget_pwd.userid.should == "ruby"
>     #forget_pwd.token.should == "123456"
>     #forget_pwd.userkey = "14dd"
>       visit auth_index_path
>       click_link "Forgot Password"
>       fill_in "Email", :with=> user.email
>       click_button "Submit"
>       current_path.should eq(login_path)
>       page.should have_content("Hello Rails")
>       last_email.to.should include(user.email)
>    end
> end
>
> I have created another file called factories.rb where I have created the
> data as below.
>
> Factory.define :user do |f|
>   f.sequence(:email) {|n| "foo#{n}@example.com"}
>   f.password "Secret"
>   end
> But when I am running this spec, it is failing and showing the error as
> uninitialized constant Factory (NameError).
> I have followed exactly as in the railscasts.
> http://railscasts.com/episodes/275-how-i-test
>
> Please help
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to