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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:07:44+00:00 2026-05-28T22:07:44+00:00

I’m sure this is basic as I’m a new Rails user and want to

  • 0

I’m sure this is basic as I’m a new Rails user and want to do Cucumber right. I spent the weekend reading the Pragmatic book and have a small project I want to create and use it. I intentionally set up my first feature as broadly as possible so that it wouldn’t be brittle depending too much on how it works on the rails side. I created a new rails app using DanielKehoe’s starter on github. I think I got the user figured out. But when I attempt to use Cucumber to creating my first table of Reference Units which would be a table of constants, I expected that cucumber would drive me to create a Reference Units model but I spent all morning trying to get it to do so using the book, Railscasts and stackoverflow to push me to where I’m at now. I went ahead and generated a model for Reference Units, controller with a new action and an empty view. But it now cannot figure out that I have Reference Unit model with a (LoadError). Odd because it’s there in the app.

Here’s my current feature:

Feature: I want to have Reference Units that I can refer to so they can be used elsewhere. That way 
they can be updated in one place. I want to create and edit these Units.

Background:
Given I am logged in as the following user:
| name | "Testy McUserton" |
| password | "please" |
| email | "testy@userton.com" |

Scenario: Adding Reference Units
When I go to the new Reference Units page
And I fill in the following:
| commodity | "corn" |
| language | "en" |
| wholesale unit | "xton" |
| retail unit | "xliter" |
| receipt unit | "dollar" |
Then it should create a new Reference Unit

here is my step definition:

Given /^I am logged in as the following user:$/ do |table|
  sign_up valid_user
end

When /^I go to the new Reference Units page$/ do 
  visit new_reference_unit_path
end

When /^I fill in the following:$/ do |table|
    @reference_unit = Reference_unit.create!(table.rows_hash)
end

Then /^it should create a new Reference Unit$/ do
  pending # express the regexp above with the code you wish you had
end

new_reference_unit_path is in my feature/support/paths.rb as:

when /the new Reference Units page/
  '/reference_units/new'

Running this in 3.1.3 the following is in red:

Scenario: Adding Reference Units              # features/user_can_create_units.feature:10
When I go to the new Reference Units page   # features/step_definitions/user_create_unit_reference.rb:6
  Expected /Users/sam/apps/keriakoo/app/models/reference_unit.rb to define Reference_unit (LoadError)
  ./app/controllers/reference_units_controller.rb:4:in `new'
  ./features/step_definitions/user_create_unit_reference.rb:7:in `/^I go to the new Reference Units page$/'
  features/user_can_create_units.feature:11:in `When I go to the new Reference Units page'

As I mentioned above. the reference_unit.rb file is in the correct place. Of course, I haven’t added any methods or attributes to it expecting cucumber to guide me at the right time. I’m sure it’s something simple, but I tried all kinds of combinations of words and capitalization to shake something loose, sam

  • 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-28T22:07:45+00:00Added an answer on May 28, 2026 at 10:07 pm

    OK, I think I hit on the clue. Digging around, I used the –backtrace option on cucumber and it pointed me to a dependency with a key word of “const”. OK, it doesn’t like something in the text. Looking around for info on two-word models, I can tell that my model was correct: ReferenceUnit. But looking at my error output, it was looking for Reference_unit. So for laughs I altered the regex for that step to be “When /^I go to the new Reference units page$” the error went away. So the syntax of the first line is important, and not ‘freestylin’ as I suspected.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build

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.