I have looked at other topics and did a Google search, none of the solutions works unfortunately. I have just started writing my first tests for password reset. I should be receiving a Capybara elementnotfound error for no link with title or text "password". Instead factory girl is saying its not a registered user.
1) PasswordResets emails user when requesting password reset
Failure/Error: user = FactoryGirl.create(:user)
ArgumentError:
Factory not registered: user
# ./spec/requests/password_resets_spec.rb:5:in `block (2 levels) in <top (required)>'
Here's my password_reset_spec.rb:
require 'spec_helper'
describe "PasswordResets" do
it "emails user when requesting password reset"
user = FactoryGirl.create(:user)
visit login_path
click_link "password"
fill_in "Email", :with => user.email
click_button "Reset Password"
end
factories.rb:
FactoryGirl.define do
factory :user do
f.sequence :email do |n| "foo#{n}@example.com"
end
f.password "secret"
end
end
gemfile:
gem 'rspec-rails', :group => [:test, :development]
group :test do
gem 'factory_girl'
gem 'capybara'
gem 'guard-rspec'
gem 'rb-fsevent'
end