title: Sintara rspec test got 404 when testing subclassing subclasses
body: <p>I am testing sinatra very base <code>GET</code>, but i got 404 error in rspec, with brower it works fine.</p>
  
  <p><strong>config.ru</strong></p>
  
  <pre><code>map('/books'){run BooksController} #another application just for books
  map('/'){run Api}
  </code></pre>
  
  <p><strong>Api.rb</strong></p>
  
  <pre><code>class Api &lt; Sinatra::Base end;
  </code></pre>
  
  <p><strong>BooksController.rb</strong></p>
  
  <pre><code>class BooksController &lt; Api
     namespace '/api/v1' do
       get '/books' do
         "books"
       end
     end
  end
  </code></pre>
  
  <p><strong>books_controller_spec.rb</strong></p>
  
  <pre><code>RSpec.describe BooksController do
  describe "Get Index" do
      it "/books" do
        get "/books/api/v1/books", {access_token:user1.access_token}
        expect(last_response.status).to eq 200
        expect(last_response.body).to eq "books"
      end
    end
  end
  </code></pre>
  
  <p><strong>error</strong>:</p>
  
  <pre><code>1) BooksController Get Index /books
       Failure/Error: expect(last_response.status).to eq 200
  
         expected: 200
              got: 404
  
         (compared using ==)
  </code></pre>
  
  <p>But <a href="http://127.0.0.1:9393/books/api/v1/books" rel="nofollow noreferrer">http://127.0.0.1:9393/books/api/v1/books</a> works fine in my browser.</p>
  
  <p>The <code>shotgun</code>(like rackup) output when access by browser:</p>
  
  <pre><code>127.0.0.1 - - [11/Jan/2016:14:48:05 +0800] "GET /books/api/v1/ HTTP/1.1" 200 6 0.0089
  </code></pre>
  
  <p><strong>EDIT:</strong> works fine from browser in <code>test</code> environment too. As below:
  <a href="https://i.stack.imgur.com/NWYtA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NWYtA.png" alt="enter image description here"></a></p>
  
  <p><strong>EIDT</strong>:when i out put <code>last_request.url</code> i got:</p>
  
  <pre><code> "http://example.org/books/api/v1/books"
  </code></pre>
  
  <p>i have thought it's the domain name but when i test <code>Api</code>'s GET, i got the same host url like <code>http://example.org/api/v1.2/events</code>, but the test can pass. </p>
  
  <p>Any help, thanks a lot!</p>