title: Trying to get selenium working in rails 3 - "WebMock::NetConnectNotAllowedError"
body: <p>I'm trying to use selenium for the first time in a rails 3 app. (I've used it before with rails 2).  I'm in an rvm which of course has its own gemset.  </p>
  
  <p>I first ran a task with capybara, without selenium:</p>
  
  <pre><code>#./spec/requests/homepage_spec.rb
  require 'spec_helper'
  
  describe 'home page', :type =&gt; :request do
    it 'should welcome the user' do
      visit '/'
      page.should have_content('Buddy')
    end
  end
  </code></pre>
  
  <p>This ran fine.  I then added a ":js => true" option to the options for describe, which is supposed to make it run using selenium (as far as i know).  And got this error:</p>
  
  <pre><code> Failure/Error: @page.start_new_browser_session
   WebMock::NetConnectNotAllowedError:
     Real HTTP connections are disabled. Unregistered request: POST http://localhost:4444/selenium-server/driver/ with body 'cmd=getNewBrowserSession&amp;1=%2Afirefox&amp;2=http%3A%2F%2Flocalhost%3A3000&amp;3=&amp;4=' with headers {'Accept'=&gt;'*/*', 'Content-Type'=&gt;'application/x-www-form-urlencoded; charset=utf-8', 'User-Agent'=&gt;'Ruby'}
  
     You can stub this request with the following snippet:
  
     stub_request(:post, "http://localhost:4444/selenium-server/driver/").
       with(:body =&gt; "cmd=getNewBrowserSession&amp;1=%2Afirefox&amp;2=http%3A%2F%2Flocalhost%3A3000&amp;3=&amp;4=", 
            :headers =&gt; {'Accept'=&gt;'*/*', 'Content-Type'=&gt;'application/x-www-form-urlencoded; charset=utf-8', 'User-Agent'=&gt;'Ruby'}).
       to_return(:status =&gt; 200, :body =&gt; "", :headers =&gt; {})
  
     ============================================================
  </code></pre>
  
  <p>It's my first time using capybara and i think my config is just wrong somehow.  Maybe missing some essential gems? I was following this blog post: <a href="http://opinionatedprogrammer.com/2011/02/capybara-and-selenium-with-rspec-and-rails-3/">Capybara (and Selenium) with RSpec &amp; Rails 3: quick tutorial</a></p>
  
  <p>Any ideas? </p>
  
  <p>PS, here's my Gemfile contents:  </p>
  
  <pre><code>source 'http://rubygems.org'
  gem 'rails', '3.0.7'
  gem 'haml'
  gem 'heroku'
  gem "heroku_backup_task"
  gem 'authlogic', '3.0.2'
  gem 'rails3-generators'
  gem 'txtlocal', :git =&gt; 'git://github.com/epigenesys/txtlocal.git'
  gem 'chronic'
  gem 'sqlite3-ruby', :require =&gt; 'sqlite3'
  gem 'bcrypt-ruby'
  
  group :development, :test do
    gem 'rspec'
    gem 'mocha'
    gem "rspec-rails", "~&gt; 2.4"
    gem "webmock"
    gem 'database_cleaner', '0.5.2'  
    gem 'capybara', :git =&gt; 'git://github.com/jnicklas/capybara.git'
    gem 'selenium-client'
  end
  </code></pre>
  
  <p>and my Gemfile.lock:</p>
  
  <pre><code>GIT
    remote: git://github.com/epigenesys/txtlocal.git
    revision: 66aab6628d4385eda959e4a8bd083cc2c259fea0
    specs:
      txtlocal (0.0.1)
        json
  
  GIT
    remote: git://github.com/jnicklas/capybara.git
    revision: 9cdf015e28637b7b0d94f5a69f9bc3605455ce22
    specs:
      capybara (1.0.0.beta1)
        mime-types (&gt;= 1.16)
        nokogiri (&gt;= 1.3.3)
        rack (&gt;= 1.0.0)
        rack-test (&gt;= 0.5.4)
        selenium-webdriver (~&gt; 0.2.0)
        xpath (~&gt; 0.1.4)
  
  GEM
    remote: http://rubygems.org/
    specs:
      abstract (1.0.0)
      actionmailer (3.0.7)
        actionpack (= 3.0.7)
        mail (~&gt; 2.2.15)
      actionpack (3.0.7)
        activemodel (= 3.0.7)
        activesupport (= 3.0.7)
        builder (~&gt; 2.1.2)
        erubis (~&gt; 2.6.6)
        i18n (~&gt; 0.5.0)
        rack (~&gt; 1.2.1)
        rack-mount (~&gt; 0.6.14)
        rack-test (~&gt; 0.5.7)
        tzinfo (~&gt; 0.3.23)
      activemodel (3.0.7)
        activesupport (= 3.0.7)
        builder (~&gt; 2.1.2)
        i18n (~&gt; 0.5.0)
      activerecord (3.0.7)
        activemodel (= 3.0.7)
        activesupport (= 3.0.7)
        arel (~&gt; 2.0.2)
        tzinfo (~&gt; 0.3.23)
      activeresource (3.0.7)
        activemodel (= 3.0.7)
        activesupport (= 3.0.7)
      activesupport (3.0.7)
      addressable (2.2.5)
      arel (2.0.9)
      authlogic (3.0.2)
        activerecord (~&gt; 3.0.7)
        activerecord (~&gt; 3.0.7)
      bcrypt-ruby (2.1.4)
      builder (2.1.2)
      childprocess (0.1.8)
        ffi (~&gt; 1.0.6)
      chronic (0.3.0)
      configuration (1.2.0)
      crack (0.1.8)
      database_cleaner (0.5.2)
      diff-lcs (1.1.2)
      erubis (2.6.6)
        abstract (&gt;= 1.0.0)
      ffi (1.0.7)
        rake (&gt;= 0.8.7)
      haml (3.1.1)
      heroku (2.1.2)
        launchy (&gt;= 0.3.2)
        rest-client (~&gt; 1.6.1)
        term-ansicolor (~&gt; 1.0.5)
      heroku_backup_task (0.0.5)
        heroku (&gt;= 1.13.7)
        rake
      i18n (0.5.0)
      json (1.5.1)
      json_pure (1.5.1)
      launchy (0.4.0)
        configuration (&gt;= 0.0.5)
        rake (&gt;= 0.8.1)
      mail (2.2.19)
        activesupport (&gt;= 2.3.6)
        i18n (&gt;= 0.4.0)
        mime-types (~&gt; 1.16)
        treetop (~&gt; 1.4.8)
      mime-types (1.16)
      mocha (0.9.12)
      nokogiri (1.4.4)
      polyglot (0.3.1)
      rack (1.2.2)
      rack-mount (0.6.14)
        rack (&gt;= 1.0.0)
      rack-test (0.5.7)
        rack (&gt;= 1.0)
      rails (3.0.7)
        actionmailer (= 3.0.7)
        actionpack (= 3.0.7)
        activerecord (= 3.0.7)
        activeresource (= 3.0.7)
        activesupport (= 3.0.7)
        bundler (~&gt; 1.0)
        railties (= 3.0.7)
      rails3-generators (0.17.4)
        railties (&gt;= 3.0.0)
      railties (3.0.7)
        actionpack (= 3.0.7)
        activesupport (= 3.0.7)
        rake (&gt;= 0.8.7)
        thor (~&gt; 0.14.4)
      rake (0.8.7)
      rest-client (1.6.1)
        mime-types (&gt;= 1.16)
      rspec (2.6.0)
        rspec-core (~&gt; 2.6.0)
        rspec-expectations (~&gt; 2.6.0)
        rspec-mocks (~&gt; 2.6.0)
      rspec-core (2.6.0)
      rspec-expectations (2.6.0)
        diff-lcs (~&gt; 1.1.2)
      rspec-mocks (2.6.0)
      rspec-rails (2.6.0)
        actionpack (~&gt; 3.0)
        activesupport (~&gt; 3.0)
        railties (~&gt; 3.0)
        rspec (~&gt; 2.6.0)
      rubyzip (0.9.4)
      selenium-client (1.2.18)
      selenium-webdriver (0.2.0)
        childprocess (&gt;= 0.1.7)
        ffi (&gt;= 1.0.7)
        json_pure
        rubyzip
      sqlite3 (1.3.3)
      sqlite3-ruby (1.3.3)
        sqlite3 (&gt;= 1.3.3)
      term-ansicolor (1.0.5)
      thor (0.14.6)
      treetop (1.4.9)
        polyglot (&gt;= 0.3.1)
      tzinfo (0.3.27)
      webmock (1.6.2)
        addressable (&gt;= 2.2.2)
        crack (&gt;= 0.1.7)
      xpath (0.1.4)
        nokogiri (~&gt; 1.3)
  
  PLATFORMS
    ruby
  
  DEPENDENCIES
    authlogic (= 3.0.2)
    bcrypt-ruby
    capybara!
    chronic
    database_cleaner (= 0.5.2)
    haml
    heroku
    heroku_backup_task
    mocha
    rails (= 3.0.7)
    rails3-generators
    rspec
    rspec-rails (~&gt; 2.4)
    selenium-client
    sqlite3-ruby
    txtlocal!
    webmock
  </code></pre>