title: Rack error with capybara/sinatra test... Doesn't seem to get the Sinatra app passed on
body: <p>Trying to set up capybara/rspec for testing a simple sinatra app but keep getting a rack error.</p>
  
  <p>hello.rb</p>
  
  <pre><code>require 'sinatra'
  
  class App &lt; Sinatra::Base
    get "/" do
      "hello hello!"
    end
  
    run! if app_file == $0
  end
  </code></pre>
  
  <p>spec/hello_spec.rb</p>
  
  <pre><code>require File.join(File.dirname(__FILE__), '..', 'hello.rb')
  
  require 'rspec'
  require 'capybara'
  require 'capybara/dsl'
  require 'capybara/rspec'
  
  set :environment, :test
  
  describe 'The Hello App' do
  
    include Capybara::DSL
    def setup
      Capybara.app = App
    end
  
    it "says hello when browsing /" do
      visit '/'
      page.should have_content('hello')
    end
  end
  </code></pre>
  
  <p>Note, I also tried </p>
  
  <pre><code>  def setup
      Capybara.app = App.new
    end
  </code></pre>
  
  <p>Which produced the same error.</p>
  
  <p>Error:</p>
  
  <pre><code>C:\Sites\misc\qrgen&gt;bundle exec rspec
  F
  
  Failures:
  
    1) The Hello App says hello when browsing /
       Failure/Error: visit '/'
       ArgumentError:
         rack-test requires a rack application, but none was given
       # ./spec/hello_spec.rb:18:in `block (2 levels) in &lt;top (required)&gt;'
  
  Finished in 0.374 seconds
  1 example, 1 failure
  
  Failed examples:
  
  rspec ./spec/hello_spec.rb:17 # The Hello App says hello when browsing /
  </code></pre>
  
  <p>Same error running with and without bundle exec. Any ideas?</p>
  
  <p>Gemfile: </p>
  
  <pre><code>gem "sinatra"
  gem "sinatra-contrib"
  gem "sinatra-flash"
  gem "slim"
  
  gem "rspec"
  gem "capybara"
  gem "rack-test"
  </code></pre>