ああ、これはとても恥ずかしい質問かもしれませんが、工場の女の子は初めてです。
spec/spec_helper.rb
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
require 'factory_girl_rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
end
スペック/factories.rb
FactoryGirl.define do
factory :user do
email "example@hotmail.com"
password "password"
end
end
spec/password_resets_spec.rb
require 'spec_helper'
describe "PasswordResets" do
it "emails user when requesting a password rest" do
user = FactoryGirl.create :user
end
end
それでも、これは私に与えます:
uninitialized constant User
最初に User モデルを定義する必要がありますか?