title: LocalJumpError: no block given
body: <p>I keep getting an error while running a rspec file:</p>
  
  <pre><code>Failures:                                                                                                                                  
  
    1) Book title should capitalize the first letter                                                                                         
       Failure/Error: @book.title("inferno")                                                                                                 
       LocalJumpError:                                                                                                                       
         no block given (yield)                                                                                                              
       # ./08_book_titles.rb:7:in `title'  
  </code></pre>
  
  <p>here is the book_title.rb</p>
  
  <pre><code>class :: Book
  
    attr_accessor :some_title
  
  def title(some_title)
  little_words = %w(of and for the over under an a but or nor yet so at around by after along from on to with without)
    some_title = yield
    some_title.split.each_with_index.map{|x, index| little_words.include?(x) &amp;&amp; index &gt; 0 ? x : x.capitalize }.join(" ")
  end #def
  
  end
  </code></pre>
  
  <p>and here is the rspec file (or at least the first spec):</p>
  
  <pre><code>require_relative '08_book_titles'
  
  describe Book do
  
    before do
      @book = Book.new
    end
  
    describe 'title' do
      it 'should capitalize the first letter' do
        @book.title("inferno")
        @book.title.should == "Inferno"
      end
  end
  </code></pre>
  
  <p>I have included the yield in the method, and there IS a block in the spec...so I don't understand why its not calling that block. I have tried everything I could think of from calling it directly on the map (instead of using a variable it is assigned to) to calling it separately on its own THEN using it on map, to trying to pass it in as the argument of title in the method...to what you see now. I have also read through a ton of threads. What am I not seeing? </p>
  
  <p>I see that future exercises will also be running specs on custom classes so I would also love some tips (or links) on things I need to know or look out for while testing custom classes with rspec.  Thanks!</p>
  
  <p>UPDATED</p>
  
  <p>So i have changed my book_title.rb to look like this:</p>
  
  <pre><code>  class :: Book
  
    def title
  little_words = %w(of and for the over under an a but or nor yet so at around by after along from on to with without)
      self.split.each_with_index.map{|x, index| little_words.include?(x) &amp;&amp; index &gt; 0 ? x : x.capitalize }.join(" ")
  end #def
  
  end
  </code></pre>
  
  <p>and because I, probably incorrectly, edited the specs- I reverted them back to this:</p>
  
  <pre><code>require '08_book_titles'
  
  describe Book do
  
    before do
      @book = Book.new
    end
  
    describe 'title' do
      it 'should capitalize the first letter' do
        @book.title = "inferno"
        @book.title.should == "Inferno"
      end
  end
  </code></pre>
  
  <p>and the error I now get is this:</p>
  
  <pre><code>Failure/Error: @book.title = "inferno"                                                                                                
       NoMethodError:                                                                                                                        
         undefined method `title=' for #&lt;Book:0x007f292a06c6b0&gt;                                                                              
       # ./08_book_titles_spec.rb:26:in `block (3 levels) in &lt;top (required)&gt;' 
  </code></pre>