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

  • Home
  • SEARCH
  • 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 8643351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:00:52+00:00 2026-06-12T12:00:52+00:00

In my controller spec, when I execute the line: post :register_pass, :device_id => ‘DEV1C3’,

  • 0

In my controller spec, when I execute the line:

  post :register_pass, :device_id => 'DEV1C3', :pass_type_id => 'pass.com.example.GSPassType', :serial_no => '5ER14L'

I get an ActionController::RoutingError:

  Failure/Error: post :register_pass, :device_id => 'DEV1C3', :pass_type_id => 'pass.com.example.GSPassType', :serial_no => '5ER14L'
  ActionController::RoutingError:
   No route matches {:action=>"register_pass", :controller=>"purchases/passbook/registrations", :pass_type_id=>"pass.com.example.GSPassType", :serial_no=>"5ER14L", :device_id=>"DEV1C3"}

Even though rake routes | grep register_pass returns

register_pass POST   /v1/devices/:device_id/registrations/:pass_type_id/:serial_no(.:format)        {:action=>"register_pass", :controller=>"purchases/passbook/registrations"}

However, when I remove the periods in the :pass_type_id value, the post line listed above executes and the route is recognized (I verified this using rspec, and even curled it directly, putting a breakpoint in the expected controller action, the route works).

I tried using Rack::Utils.escape on the value with periods, but that failed too. I also tried manually changing the periods to their URL-encoded values, but rails didn’t seem to decode them in the params hash.

Why don’t periods work in this case?

And how can I get a value with periods passed in (without manually decoding it using String#gsub in the controller?

  • 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-12T12:00:53+00:00Added an answer on June 12, 2026 at 12:00 pm

    There are two problems you’re encountering: 1) a period is a valid character in a URL sequence, so it’s won’t be replaced by Rack::Utils.escape or URI.escape, 2) Rails treats a period as a path separator to enable format parsing at the end of urls, e.g. .json, .xml, etc. (as defined in ActionController::Routing::SEPARATORS).

    For this use case, I’d recommend adding constraints to this route that allow you to be permissive of any character for :post_id. I don’t see what your route file looks like, but it could be something like this with the change:

    post "/v1/devices/:device_id/registrations/:pass_type_id/:serial_no(.:format)" => 
      "purchases/passbook/registrations#register_pass", 
      :constraints => { :pass_type_id => /.*/ }
    

    Lots of great info on other ways to add this constraint in the Rails guide on routing

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

Sidebar

Related Questions

I'm trying to get an RSpec controller spec to pass. It's almost identical to
I'm writing the spec for controller: it 'should call the method that performs the
I have following spec to test controller method: context #create do it should redirect
My Controller (User Controller) def reset_password @user = User.find_by_reset_code(params[:reset_code]) unless params[:reset_code].nil? if request.post? if
My Controller (User Controller) def reset_password @user = User.find_by_reset_code(params[:reset_code]) unless params[:reset_code].nil? if request.post? if
My controller spec fails because Factory Girl seems to be creating non-unique Users even
Does anyone know how to make rspec follow a redirect (in a controller spec)?
I have built out a controller spec for my user model, and it passes,
I;m trying to write a spec that tests a controller that is namespaced, let's
I am having difficulty getting a rspec test for a controller to pass. I

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.