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 6914435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:20:49+00:00 2026-05-27T09:20:49+00:00

Having a problem with making this work. Seems it has been a problem for

  • 0

Having a problem with making this work. Seems it has been a problem for others and I think I have followed all of the advice.

I’ve set up a stripped down rails 3 .0.14 app to just include cucumber-rails & factory_girl_rails but still no go. I expect I am doing something silly!

Running the cuc test below produces the following:

Scenario: test factory-girl        # features/users.feature:3
  Given the following user exists: # features/users.feature:4
    | name    | email               |
    | Brandon | brandon@example.com |
    Undefined step: "the following user exists:" (Cucumber::Undefined)

The user factory has been created, of which I am sure, with a bit of ‘pp’ output.
Would really appreciate any help to get this sorted.

Ross

Set up

env.rb: snippet

require 'pp'
require 'cucumber/rails'

require 'factory_girl_rails'
require 'factory_girl/step_definitions'

features/support/factories.rb:

FactoryGirl.define do
  factory :user do
    name 'Adam Advertiser'
    email 'a@b.com'still
  end   
end
pp FactoryGirl.create(:user)

Cucumber features/user.feature:

Feature: a
  Scenario: test factory-girl
    Given the following user exists:
    | name    | email               |
    | Brandon | brandon@example.com |
  • 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-05-27T09:20:50+00:00Added an answer on May 27, 2026 at 9:20 am

    The problem here is that you have to get your factory required before requiring ‘factory_girl/step_definitions’, because there is meta-programming in step_definitions which needs to know about your factory. You could explicitly require the factories.rb in the env.rb, but that will end up producing a duplicate definition error, as cucumber will re-require factories.rb.

    You need to remove the requiring of step_definitions from the env.rb – that will make it happen too early – and put it at the bottom of factories.rb, or else create a wrapper which requires first the factories (which will need to reside somewhere that cucumber doesn’t automatically require) and then the step_definitions.

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

Sidebar

Related Questions

So, i have this code that seems to be doing the mechanical work correctly,
I know this has been asked a lot of times, but I have honestly
I'm having some difficulties with the following problem: I'm making a little game where
We're having problem with a huge number of legacy stored procedures at work. Do
We are having problem with the server migration. We have one application that are
I'm having problem when running my Windows Forms program. In the program, I have
I'm having a spot of trouble in making my functions work and my book
I am having a problem making a sub directory act as the public_html for
I'm having a little bit of trouble making OpenID work from within an iframe.
I'm hell bent on making this work with NAudio, so please tell me if

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.