我在特定子域

时间:2018-05-17 10:27:14

标签: ruby-on-rails

我正在

  

错误的参数(预期的URI对象或URI字符串)

在行

运行以下代码时出现

错误

  

get:show,id:owner.id,format :: json,subdomain:' api'

describe Api::V1::OwnersController, :type => :controller do
  render_views
  #before { host! "api.localhost:3000" }
  let(:owner) {FactoryGirl.create(:owner)}

  before(:each) do
    request.host = "api.localhost:3000"
  end

  describe "GET #show" do
    it "returns the information about an Owner on a hash" do
      # TODO get this working
      get :show, id: owner.id, format: :json, subdomain: 'api'
      expect(response.status).to eq(200)
      #owner_response = JSON.parse(response.body, symbolize_names: true)
      #expect(owner_response[:email]).to eql @owner.email
    end
  end
end

我正在添加子域以在此处呈现API结果。

1 个答案:

答案 0 :(得分:1)

试试这个:

get :show, params: { id: owner.id, format: :json, subdomain: 'api' }
相关问题