1
votes

We are working on a rails 3.2 app with RSpec 3.7 and want to use puma as web server for our rails request specs.

We know we can switch the server for Capybara feature specs using

Capybara.register_server :puma

But how can we switch the server for request specs?

Background:

We want to spec concurrency issues and need our test server to actually process requests parallelly.

1

1 Answers

1
votes

AFAIU (https://relishapp.com/rspec/rspec-rails/docs/request-specs/request-spec) request specs are not using any server. The request will be directed straight through rails app (middleware -> router -> controller).

So...

Capybara tests would make a request using headless browser, and the framework will start the actual web server (e.g. puma) for you.

Request specs would bypass the actual server, so the spec would test the whole app stack.

Controller specs would even avoid routing, and the controller would be invokes with prepared request object.

And so on, all the way to actual unit tests...