Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had the same problem, but I can't understand what you mean by moving the 'existing environment' into the Spork.prefork block. As far as I can tell, Listing 3.37 is supposed to be a complete spec/spec_helper.rb file. However, that file did not work for me: I got the 'connection not established error'. </p> <p><strong>Edit:</strong> Ah, I finally see what you mean. In the version of the spec/spec_helper.rb file that wouldn't work for me, there is a huge block of comments at the end of the file that runs off the bottom of my text editor, and after those comments there is another prefork block hiding. So what you should do is copy Listing 3.37, then open spec/spec_helper.rb and 'select all', then paste. </p> <p>On the other hand, the spec/spec_helper.rb file on github did work for me. I ran a diff on the two files, and the git hub version differs at the end of the prefork block:</p> <p>Listing 3.37:</p> <pre><code> config.order = "random" config.include Capybara::DSL end end </code></pre> <p>github:</p> <pre><code> config.order = "random" # Include the Capybara DSL so that specs in spec/requests still work. config.include Capybara::DSL # Disable the old-style object.should syntax. config.expect_with :rspec do |c| c.syntax = :expect end end end </code></pre> <p>I don't understand how the added code has anything to do with connections, but after trying Listing 3.37 many times and getting the connection error, I changed the file to the github version, and I got this output:</p> <pre><code>$ time bundle exec rspec spec/requests/static_pages_spec.rb --drb ........ Finished in 0.19795 seconds 8 examples, 0 failures Randomized with seed 27433 real 0m5.568s user 0m3.617s sys 0m0.832s </code></pre> <p>Then I changed spec/spec_helper.rb back to the version in Listing 3.37, and I got the connection error again. So Listing 3.37 just doesn't work (<strong>Edit:</strong> Yes it does, see initial edit).</p> <p><strong>Edit:</strong> Note: if you use Listing 3.37, you won't get the following errors:</p> <p>Next, after doing a few more steps in the tutorial, I noticed that Guard was outputting test failures:</p> <pre><code>Failures: 1) StaticPagesController GET 'home' returns http success Failure/Error: response.should be_success NoMethodError: undefined method `should' for #&lt;ActionController::TestResponse:0x000001046dba00&gt; # ./spec/controllers/static_pages_controller_spec.rb:8:in `block (3 levels) in &lt;top (required)&gt;' 2) StaticPagesController GET 'help' returns http success Failure/Error: response.should be_success NoMethodError: undefined method `should' for #&lt;ActionController::TestResponse:0x00000104700058&gt; # ./spec/controllers/static_pages_controller_spec.rb:15:in `block (3 levels) in &lt;top (required)&gt;' Finished in 0.24867 seconds 13 examples, 2 failures, 3 pending </code></pre> <p>Those failures are from auto generated test files that use a method called should(), which the github version of the spec/spec_helper.rb file disabled:</p> <pre><code># Disable the old-style object.should syntax. config.expect_with :rspec do |c| c.syntax = :expect end </code></pre> <p>Earlier in the tutorial, we were running only the tests in one file:</p> <pre><code>spec/requests/static_pages_spec.rb </code></pre> <p>But now Guard and Spork are setup to run all the tests in all the test files. </p> <p>To get rid of the test failures, I just commented out the code in:</p> <pre><code>/spec/controllers/static_pages_controller_spec </code></pre> <p>There is also some different colored output from Guard that says:</p> <pre><code>Pending: ... </code></pre> <p>The tutorial hasn't talked about it yet, but in a test you can just write 'pending', like this:</p> <pre><code>describe StaticPagesHelper do pending "add some examples to (or delete) #{__FILE__}" end </code></pre> <p>and then when you run the tests, the output will remind you that you still have to write the test by displaying the 'Pending' output. If you look in:</p> <pre><code>spec/helpers/static_pages_helper_spec.rb </code></pre> <p>that's where that pending test comes from.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload