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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:06:29+00:00 2026-05-19T12:06:29+00:00

I apologize if this question is slightly subjective… I am trying to figure out

  • 0

I apologize if this question is slightly subjective… I am trying to figure out the best way to test Rails 3 Engines with Cucumber & Rspec. In order to test the engine a rails 3 app is necessary. Here is what I am currently doing:

  1. Add a rails test app to the root of the gem (myengine) by running: rails new /myengine/rails_app

  2. Add Cucumber to /myengine/rails_app/features as you would in a normal Rails app

  3. Require the Rails Engine Gem (using :path=>"/myengine") in /myengine/rails_app/Gemfile

  4. Add spec to the root directory of the gem: /myengine/spec

  5. Include the fixtures in /myengine/spec/fixtures and I add the following to my cuc env.rb:

env.rb:

Fixtures.reset_cache
fixtures_folder = File.join(Rails.root, 'spec', 'fixtures')  
fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') }  
Fixtures.create_fixtures(fixtures_folder, fixtures)

Do you see any problems with setting it up like this? The tests run fine, but I am a bit hesitant to put the features inside the test rails app. I originally tried putting the features in the root of the gem and I created the test rails app inside features/support, but for some reason my engine would not initialize when I ran the tests, even though I could see the app loading everything else when cuc ran.

If anyone is working with Rails Engines and is using cuc and rspec for testing, I would be interested to hear your setup.

**UPDATE
I changed my setup a bit since I wrote this question. I decided to get rid of the spec directory under the root of the engine. Now I just create a rails app named “test_app” and setup cuc and rspec inside that app like I would normally do in a rails app. Then I include the gem like I did in step #3 above. Since the engine is a sub-app, I guess its just best to test it like it was a normal rails app. I am still interested in hearing if anyone has a different setup.

  • 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-19T12:06:30+00:00Added an answer on May 19, 2026 at 12:06 pm

    Rails 3.1 (will) generate a pretty good scaffold for engines. I’d recommend using RVM to create a new gemset called edge and switch to it:

    rvm gemset create edge
    rvm use @edge
    

    Then install edge rails:

    git clone git://github.com/rails/rails.git
    cd rails
    rake install
    

    From there, you can follow Piotr Sarnacki’s mountable app tutorial, replacing calls such as:

    bundle exec ./bin/rails plugin new ../blog --edge --mountable
    

    With simply:

    rails plugin new blog --mountable --full
    

    The mountable option makes the application mountable, whilst the full option makes it an engine with tests already built-in. To test the engine, this generator generates a folder in test called dummy which contains a small Rails application. You can see how this is loaded in test/test_helper.rb.

    Then it’s up to you to massage the data to do what it needs to in order to work. I would recommend copying over the cucumber files from a standard rails g cucumber:install into the project and then messing about with it until it works. I’ve done this once before so I know it’s possible, but I cannot find the code right now.

    Let me know how you go.

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

Sidebar

Related Questions

I apologize if this question is too basic, but I just can't figure out
I apologize if this isn't the best place to ask this question, but hopefully
This is a slightly abstract question, for which I apologize. I am not necessarily
I apologize if this seems slightly off-topic, it's more a technical/installation question than it
Apologies if this is a slightly noob question, but looking to clarify my thoughts
Context I apologize for this question being soft / philosophical; it's a set of
I'm a total beginner so I apologize if this question is elementary. I have
I'm new to web development, so I apologize if this question is noobish. I
I apologize in advance if this question seems confused. The behaviour I am seeing
I apologize for the subjectiveness of this question, but I am a little stuck

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.