当前位置: 动力学知识库 > 问答 > 编程问答 >

Rails: best way to log GET requests in specs

问题描述:

I am a complete Ruby and Rails newbie, so please excuse the question. Given a spec making a GET request: get :filter_by_foo, params: {Foo: Bar}

What is the best way to output the generated GET requests?

网友答案:

there should be two variables available to you in the test case called request and response. if i understand your question correctly, you'd want to p request inside your test case

describe SomeController do
  before(:each) { get :filter_by_foo, params: {Foo: Bar} }

  it 'should have some variables available' do
    p request
    # p response
    expect(true).to be(true)
  end
end
分享给朋友:
您可能感兴趣的文章:
随机阅读: