Ruby on rails 4 RSpec测试因子域路径而失败

Ruby on rails 4 RSpec测试因子域路径而失败,ruby-on-rails-4,rspec,subdomain,Ruby On Rails 4,Rspec,Subdomain,我无法为带有子域的RSpec提供路径。 测试路径应该是api.example.com/public/v1/regions/origin?title=indm 但我不知道如何为RSpec提供这样的路径。如何将子域api路径设置为此相对路径 let(:api_path) { 'public/v1/regions/origin?title=indm' } 日志 我不知道解决这个问题的真正好方法,但我使用了带有Anvil的pow服务器。 我已安装Anvil并使用域orca.dev运行服务器。在此之后,

我无法为带有子域的RSpec提供路径。 测试路径应该是api.example.com/public/v1/regions/origin?title=indm

但我不知道如何为RSpec提供这样的路径。如何将子域api路径设置为此相对路径

let(:api_path) { 'public/v1/regions/origin?title=indm' }
日志


我不知道解决这个问题的真正好方法,但我使用了带有Anvil的pow服务器。 我已安装Anvil并使用域orca.dev运行服务器。在此之后,我重新配置了我的RSpec测试路线

spec_helper.rb

区域_spec.rb

现在测试开始了

1) Regions Public API GET /v1/regions/origin?title=? returns 200 status code
     Failure/Error: get api_path
     ActionController::RoutingError:
       No route matches [GET] "/public/v1/regions/origin"
     # ./spec/api/public/v1/regions_spec.rb:14:in `block (3 levels) in <top (required)>'
  namespace :api, path: '', constraints: {subdomain: 'api'} do
    namespace :public, defaults: { format: :json } do
      namespace :v1 do
        resources :regions do
          get :origin, on: :collection
          get :destination, on: :collection
        end
      end
    end
  end
def get_api_path path, *args
  get "http://api.orca.dev#{path}", *args
end
before do
  get_api_path '/public/v1/regions/origin?title=indm'
end