Note that there are some explanatory texts on larger screens.

plurals
  1. POrspec fails with 'undefined method `be_include' for Class'
    text
    copied!<pre><code># /spec/presenters/pdf_download_spec.rb describe "instance methods" do let(:survey) { Survey.create :title =&gt; "test survey" } let(:pdf_download) { PdfDownload.new survey } before do # only write to tmp folders PdfDownload.any_instance.stub(:location_prefix) { '../tmp' } end it "should stub location prefix properly" do pdf_download.system_path.should_not be_empty pdf_download.system_path.should be_include File.join(Rails.root, 'tmp') pdf_download.system_path.should be_start_with File.join(Rails.root, 'tmp') end end # app/models/pdf_download.rb def system_path File.expand_path File.join Rails.root, "public", location_path end </code></pre> <p>The failure message:</p> <pre><code> 1) PdfDownload instance methods should stub location prefix properly Failure/Error: expect(pdf_download.system_path).to be_empty NameError: undefined local variable or method `be_empty' for #&lt;#&lt;Class:0x007f8af0924870&gt;:0x007f8af1b82a08&gt; # ./spec/presenters/pdf_download_spec.rb:36:in `block (3 levels) in &lt;top (required)&gt;' </code></pre> <p>Why doesn't rspec recognize <code>be_include</code> or <code>be_start_with</code> as valid methods as described <a href="https://www.relishapp.com/rspec/rspec-expectations/v/2-0/docs/matchers/predicate-matchers" rel="nofollow">here</a>? It might be something obvious, in which case I apologize. I have rspec 2.12.2. Thanks!</p> <p>Update: I realized in rspec-expectations 2.12, start_with and include are built-in matchers, so I don't need to (indeed I can't) prefix them with <code>be_</code> anymore. That solves 2 of the 3 failures above. But I still get a failure with <code>should_not be_empty</code>, which according to the docs <a href="https://www.relishapp.com/rspec/rspec-expectations/v/2-12/docs/built-in-matchers/predicate-matchers!" rel="nofollow">should still work</a>.</p>
 

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