On Wednesday, April 2, 2014 5:58:11 PM UTC-7, Ming Er wrote:
>
> I've been using RSpec (also Cucumber) without an understanding of the 
> internals.  I decided to remedy that by diving into the github repos for 
> rspec and rspec-rails.  One basic thing that I haven't been able to figure 
> out in the code is when I run an rspec test, say "rspec spec/blah_spec.rb," 
> how does the rails app get launched to be tested against?  TIA for any 
> pointers.
>

In general, I would say that the rails app doesn't get launched to be 
tested against.  The various pieces (models, controllers, etc) can be used 
(somewhat) independently (using rails' test support in some places) without 
booting a rails server, and the tests for these various components run 
directly against them.

When running end-to-end integration/acceptance tests (depending on your 
nomenclature), you're usually using a tool such as rack-test to mimic an 
HTTP client or capybara to mimic user interactions in a web browser.  Rails 
is built on top of rack[1], which provides a simple means to make requests 
to the rails app w/o actually having to run it as an HTTP server.

Finally, if you do use capybara to do end-to-end tests involving the 
javascript layer as well, it actually boots the rails app [2] as an HTTP 
server in a separate thread using webrick (or a similar application server).

HTH,
Myron

[1] http://rack.rubyforge.org/doc/SPEC.html
[2] https://github.com/jnicklas/capybara/blob/2.2.1/lib/capybara/server.rb

 

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/31724cd9-3e70-4689-b384-f49c422a7162%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to