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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:15:05+00:00 2026-05-24T07:15:05+00:00

I use db/seeds.rb to populate my database with 2 user roles (Admin, User) that

  • 0

I use db/seeds.rb to populate my database with 2 user roles (“Admin”, “User”) that will never change. When i run tests though, the seed data does not get carried over and the results are error tests.

When i try to run cucumber i get the following error:

Using the default profile… Feature: Sign in In order to get access
to protected sections of the site A valid user Should be able to
sign in

Scenario: User is not signed up #
features/users/sign_in.feature:6 Not registered: role
(ArgumentError)
/Users/x/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc4/lib/factory_girl/registry.rb:15:in
find'
/Users/x/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc4/lib/factory_girl.rb:39:in
factory_by_name’
/Users/x/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc4/lib/factory_girl/syntax/vintage.rb:53:in
default_strategy'
/Users/x/.rvm/gems/ruby-1.9.2-p180/gems/factory_girl-2.0.0.rc4/lib/factory_girl/syntax/vintage.rb:146:in
Factory’
/Users/x/rails/ply_rails/features/support/db_setup.rb:6:in
`Before’
Given I am not logged in #
features/step_definitions/user_steps.rb:36

Here is what my setup looks like:

# features/support/db_setup.rb
Before do
  # Truncates the DB before each Scenario,
  # make sure you've added database_cleaner to your Gemfile.
  DatabaseCleaner.clean

  Factory(:role, :name => 'Admin')
  Factory(:role, :name => 'User')
end



# features/users/sign_in.feature
Feature: Sign in
  In order to get access to protected sections of the site
  A valid user
  Should be able to sign in

    Scenario: User is not signed up  # THIS IS LINE 6
      Given I am not logged in
      And no user exists with an email of "user@user.com"
      When I go to the sign in page
      And I sign in as "user@user.com/password"
      Then I should see "Invalid email or password."
      And I go to the home page
      And I should be signed out



# features/step_definitions/user_steps.rb
Given /^I am a "([^"]*)" named "([^"]*)" with an email "([^"]*)" and password "([^"]*)"$/ do |role, name, email, password|
  User.new(:name => name,
            :email => email,
            :role => Role.find_by_name(role.to_s.camelize),
            :password => password,
            :password_confirmation => password).save!
end

Not sure where to start on getting this working, thank you for your help/time!

  • 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-24T07:15:06+00:00Added an answer on May 24, 2026 at 7:15 am

    Well the point of tests is to start with a clean database, i.e a consistent state, so it’s kind of good that everything gets wiped.

    Secondly, in terms of cucumber, you should be defining a Background block to do the set up. This will run for each scenario, and has the benefit of every action being explicitly known. This is especially useful if you use the cucumber scenario plain text to show to clients. So you should do something like:

    Background:
        Given that the role "Admin" exists
        And that the role "User" exists
    
    Scenario:
        etc
    

    And make custom steps for the that the role [blank] exists that will create the role for you.

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

Sidebar

Related Questions

It seems that MSMQ doesn't use any Database management system to manage messages. How
Previously I used a database initializer to seed or pre-populate my tables when creating
Super short version: I'm trying to use a user-defined function to populate a new
I want to use a hierarchical TreeView which I will populate programmatically. My XAML
I noticed that this recipe seems to use __rlshift__ , __ror__ like operators. But,
I notice that modern C and C++ code seems to use size_t instead of
every introduction and sample that I can find seems to use GLUT or some
Is there a way to tell SQL server to use specific default seed value
It seems that when I use a tool (such as winmerge) to update my
It seems that the choice to use string parsing vs. regular expressions comes up

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.