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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:25:31+00:00 2026-06-13T16:25:31+00:00

I have a Rails gem that I am testing with RSpec. My gem’s code

  • 0

I have a Rails gem that I am testing with RSpec.
My gem’s code is in lib/my_gem, and there is a test application that Rails generated for me when I created the gem, in the folder test/dummy. I have my specs in test/dummy/spec/models/task_spec.rb. I can run these specs fine with the rspec command.

Now I wanted to use Spork and Guard for my testing. I followed RailsCasts http://railscasts.com/episodes/285-spork to install spork in my test/dummy app. It does work but I have 2 issues:

  • How to make spork reload my lib/my_gem/* files? I tried putting paths like ../../lib/my_gem/… in my Guardfile, but it does not watch/reload the files.
  • For some reason, rspec is ignoring my options from spec_helper, for example the “config.filter_run :focus => true” line. I did properly put these into Spork.prefork. This setting is working when I run rspec manually with rspec spec/models/task_spec.rb, but it is being ignored when I use guard/spork.
  • 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-13T16:25:32+00:00Added an answer on June 13, 2026 at 4:25 pm

    I finally was able to solve the problem. The key is running the tests from the root directory and not from test/dummy.
    You can see my setup if you clone my gem https://github.com/mrbrdo/has_moderated
    I think the key was in the Guardfile (note the paths to test/dummy), Rakefile (the spec task) and in both spec_helper.rb files (one in spec/ and one in test/dummy/spec). Feel free to comment if you find something else was required.

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

Sidebar

Related Questions

I'm unable to have rails recognize the mysql2 gem that I've installed. I'm using
I have a rails gem that uses a snippet like: components = [] components
I have a Rails application with the backbone-rails gem. Which works out fine but
I have a Rails application using Rails 3. I added rspec-rails to my Gemfile
I have a Rails 3 gem which has some rake tasks that should only
I have an application that I'm testing with rspec2 (2.6.4), capybara and selenium. When
I have a Rails engine (someone else's gem) that I am trying to modify
The context : I have a rails engine (gem) that uses omniauth inside it
I have an existing table that I'd like to use for a Rails application.
I have a quite small Rails 3.1.1 application that rack up memory at lightning

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.