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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:36:37+00:00 2026-05-23T00:36:37+00:00

I have a Rails 2.3.5 app which is serving a card game. I’ve been

  • 0

I have a Rails 2.3.5 app which is serving a card game. I’ve been a bit lax in writing tests for it (read: I haven’t written any :embarrassed:), and I’d like to make a start now.

From reading other questions, I think I probably want to be using Shoulda extending Test::Unit for unit testing.

I wondered about using Capybara extending RSpec for functional testing, but the majority of users’ interaction with the app is via POST, which I understand Capybara doesn’t handle.

Since this is a card game, I obviously need the ability to control rand; I also definitely need the framework to handle Javascript.

  1. Is Test::Unit + Shoulda suitable?
  2. Am I correct that Capybara can’t handle POST? Can I work around that?
  3. Is there a better option instead of Capybara?
  4. Can these methods handle the randomness involved in a card-game? Presumably, for Test::Unit at least, I can just call srand at some early stage to fix the generator, but I don’t know if that’s doable for Capybara/RSpec/anything else.
  5. Can anyone point me to resources dealing specifically with setting up Shoulda, Capybara and RSpec for Rails 2.3.5? It’s a little hard to tell what’s Rails 3 specific and what isn’t.
  6. Would I gain anything from adding Watir / Firewatir into the mix?

I realise the above questions are manifold, but they basically boil down to “does this work, or have you any better suggestions?”

  • 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-23T00:36:37+00:00Added an answer on May 23, 2026 at 12:36 am

    If the majority of the users’ interactions are via POST, is it via an API (as opposed to filling out forms or something)?

    Just about any combination of RSpec/Shoulda/Capybara/Test Unit/Rack::Test could work for you depending on your need. They’re all capable. However, these are my recommendations:

    • If you’ve decided you want integration testing via HTML pages, use Cucumber and Capybara
    • If you’ve decided you want integration testing via HTTP API, use RSpec and Rack::Test
    • You probably want to fake out randomness.
    • You probably don’t need Watir/Firewatir.

    It does look like you can make POST requests via some Capybara drivers:

    http://suffix.be/blog/capybara-post-requests

    When Rails moved to 3.0, RSpec went to 2.0 so for at least RSpec, you’d want RSpec and RSpec Rails 1.3.2.

    By “fake out randomess”, I mean redefine srand in your tests so you can predictably run them.

    module Kernel
      def rand
        YourApp.rand
      end
    end
    
    module MyApp
      class << self
        attr_accessor :rand
      end
    end
    

    Then, before you have the user press the button, run a step definition like “When random returns 6”, which will set MyApp.rand = 6.

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

Sidebar

Related Questions

I have rails app which are working perfectly in the local computer. But when
So I have a Rails app (which in this case seems like it would
I have a Rails 3.1.3 app which uses devise for users authentication and soft-deletes
I have a rails app running on passenger standalone, which is working perfectly. I
I have got Sinatra/Rails app and an action which starts some long process. Ordinary
I have a JavaScript widget which communicates with my Rails app by creating tags
In a Ruby on Rails app, we have some details which are stored as
I have rails app which has a list of users. I have different relations
i have a rails app which makes heavy use of activeresource and httparty to
I have a rails app which is already running with some users, users that

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.