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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:37:26+00:00 2026-06-02T18:37:26+00:00

I start unit test implementation in my REST Api application. I use versionist gem

  • 0

I start unit test implementation in my REST Api application.
I use versionist gem.

So, I have a class named like this : Api::V0_1_0::TestController

class Api::V0_1_0::TestController < Api::V0_1_0::BaseController

  def test
    respond_with({
      :message => "done"
    })
  end

end

routes.rb (without all routes, but just the necessary):

MyApp::Application.routes.draw do

  # -----------------------------------------------------------------------------------------------------------------------------------------
  # ApiVersions
  #
  scope :module => "api",
        :defaults => {:format => "json"} do

    # ---------------------------------------------------------------------------------------------------
    # V0.1.0
    # Default version
    #
    api_version :module => "V0__1__0",
                :header => "X-Version", :value => "0.1.0" do

      # Test controller
      get "/test" => "test#test"
    end
    # ---------------------------------------------------------------------------------------------------

    # ---------------------------------------------------------------------------------------------------
    # V0.1.1
    # Default version
    #
    api_version :module => "V0__1__1",
                :header => "X-Version", :value => "0.1.1" do

      # Test Controller
      get "/test" => "test#test"

  end
  # -----------------------------------------------------------------------------------------------------------------------------------------



  # -----------------------------------------------------------------------------------------------------------------------------------------
  # ActiveAdmin routes
  #
  ActiveAdmin.routes(self)
  devise_for :admin_users, ActiveAdmin::Devise.config
  # -----------------------------------------------------------------------------------------------------------------------------------------


end

Functional test file :

class Api::V0_1_0::TestControllerTest < ActionController::TestCase

  test "should get test" do
    get :test
    assert_response :success
  end
end

When I launch rake test:functionals.
I have this error :

No route matches {:controller=>”api/v0_1_0/test”, :action=>”test”}

And when I launch rake routes, I have :

test GET  /test(.:format)   {:format=>"json", :controller=>"api/V0__1__0/test", :action=>"test"}

With double underscore for V0__1__0 and not V0_1_0.

I don’t know how resolve this problem.

EDIT: I have add routes.rb.

NOTE: I’ve also post an issue here : https://github.com/bploetz/versionist/issues/9

  • 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-02T18:37:27+00:00Added an answer on June 2, 2026 at 6:37 pm

    Rails functional tests (ActionController::TestCase) are for testing controller action methods in isolation. They do not go through the full Rails stack, specifically the Rails dispatcher code path, which is where versionist hooks in to do it’s thing.

    If you want to test your versioned API routes which rely on the HTTP header strategy, use integration tests (ActionDispatch::IntegrationTest) or request specs if you’re using rspec.

    require 'test_helper'
    
    class Api::V0_1_0::TestControllerTest < ActionDispatch::IntegrationTest
    
      test "should get test" do
        get '/test', nil, {"X-Version" => "0.1.0"}
        assert_response :success
        assert_equal @response.body, "0.1.0"
      end
    end
    

    Versionist 0.2.0 added integration tests/request specs to the components created by it’s generators (https://github.com/bploetz/versionist/issues/11).

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

Sidebar

Related Questions

We start use C# build-in unit test functionality. I have VisualStudio 2008 created unit
I'm trying to start unit testing on my application (should have done so from
Let's say I want to make a Unit-Test where I have this Tetris game
I have the following NancyFX unit test. I use the Shouldly assertion library to
Let me start from definition: Unit Test is a software verification and validation method
I've written a class and many unit test, but I did not make it
I have unit test sample code that basically runs 2 threads: the main test
Visual studio unit testing starts all tests when I use Start Debugging from Debug
I'll start by saying I am pretty new to unit testing and I'd like
Are there too many asserts in this one unit test? [Fact] public void Send_sends_an_email_message()

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.