设我们有
# app/controllers/posts_controller.rb
class PostsController
def create
end
def index
end
end
# spec/controllers/posts_controller_spec.rb
describe PostsController do
describe :index do
before do
post :create content: 'Lorem lipsm'
get :index
end
expect(respond).to be_success
end
end
若观察 log/test.rb, 会发现 GET posts#index的参数里有POST posts#create时的content, 原因是什么呢?