Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9221105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:30:14+00:00 2026-06-18T03:30:14+00:00

rspec spec/models/contact_spec.rb ==> While running this code in my terminal, I receive the following

  • 0

rspec spec/models/contact_spec.rb ==> While running this code in my terminal, I receive the following error message: uninitialized constant Factory.

# spec/factories/contacts.rb
=============================================
require 'faker'

FactoryGirl.define do
  factory :contact do |f|
    f.firstname { Faker::Name.first_name }
    f.lastname { Faker::Name.last_name }
  end
end
=============================================

# spec/models/contact_spec.rb
=============================================
require 'spec_helper'
require 'factory_girl_rails'
describe Contact do
  it "has a valid factory" do
    Factory.create(:contact).should be_valid
  end
  it "is invalid without a firstname"
  it "is invalid without a lastname"
  it "returns a contact's full name as a string"
end
=============================================

Any suggestions how to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:30:16+00:00Added an answer on June 18, 2026 at 3:30 am

    Try FactoryGirl.create(:contact) instead of Factory.create(:contact); the Factory shortcut may not be configured on your app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get following error when running rspec: bundle exec rspec spec/models/user_spec.rb Failures: 1) User
I run: $ bundle exec rspec spec/ And receive this message: C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core.rb:78:in `require': no
Running rails 3.2.3 with guard/spork/rspec/factory_girl and have the following in my spec helper: Spork.prefork
When running: rake spec:models everything works well, but when I do rspec spec/models/spot_spec.rb that
I am running the rspec command bundle exec rspec spec/requests resulting in the error:
rspec-rails (2.7.0) rails (3.0.10) post: Rails 3.1 Error Catching is irrelevant for me. Code:
I get this RSpec error when I try to embed one document in another.
It's weird issue, zeus start running smoothly. rspec spec/ does it's job flawless. My
I can run a single rspec example with spec -e 'should be awesome' spec/models/stuff_spec.rb
I'm using: Rails 3.0.7 and Rspec 2.5.0 via rvm When I run this spec

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.