Cucumber/RSpec ::: Capybara? Webrat What am I using?

Hey everybody

I’m currently reading through the Pragmatic Programmers RSpec book, and
I really enjoy it.

But I’m facing some problems because of the fact that the book is
already some years old, I guess. I have installed rvm and use Ruby
1.9.3, and I didn’t really get some Rails code examples to work
properly, so I tried it with a 1.8.7 installation, but there I had some
other problems which I couldn’t solve.

So I re-did the code example myself (it’s the simulated_browser example)
on Ruby 1.9.3, and it’s working quite nice but I had some other strange
behavior now. In fact, I had an error message that the contain() was not
found. After some searching on Google (and having seen the term capybara
before somewhere in my error messages), somebody pointed out that when
using capybara, contain() would not exist, but have_content(). So I
tried it with have_content(), and it worked!

I’m a bit confused now – what exactly am I using? Capybara or Webrat?? I
thought I use Webrat, and Capybara is never mentioned in the RSpec book.
So why/where did Capybara sneak in?? Was Webrat maybe replaced in the
never Rails version I’m using?

Some information about my Rails app…

$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.4.0]

$ gem list

LOCAL GEMS *

abstract (1.0.0)
actionmailer (3.2.5, 3.2.1, 3.0.0)
actionpack (3.2.5, 3.2.1, 3.0.0)
activemodel (3.2.5, 3.2.1, 3.0.0)
activerecord (3.2.5, 3.2.1, 3.0.0)
activeresource (3.2.5, 3.2.1, 3.0.0)
activesupport (3.2.5, 3.2.1, 3.0.0)
addressable (2.2.8)
ancestry (1.2.5)
archive-tar-minitar (0.5.2)
arel (3.0.2, 1.0.1)
bcrypt-ruby (3.0.1)
bson (1.5.2)
bson_ext (1.5.2)
builder (3.0.0, 2.1.2)
bundler (1.1.4, 1.0.0)
capistrano (2.12.0)
capybara (1.1.2)
carrierwave (0.6.2)
carrierwave-mongoid (0.2.0)
childprocess (0.3.2)
chronic (0.6.7)
chunky_png (1.2.5)
cleditor_rails (0.0.3)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3, 1.2.0)
columnize (0.3.6)
compass (0.12.rc.1)
compass-rails (1.0.0.rc.3)
cucumber (1.2.1)
cucumber-rails (1.3.0, 0.3.2)
daemons (1.1.8)
database_cleaner (0.8.0)
delayed_job (3.0.3)
delayed_job_active_record (0.3.2)
devise (2.0.4)
diff-lcs (1.1.3)
enum_column3 (0.1.4)
erubis (2.7.0, 2.6.6)
execjs (1.4.0, 1.3.0)
ffi (1.0.11)
formtastic (2.1.1)
fssm (0.2.8.1)
gherkin (2.11.0)
god (0.12.1)
haml (3.1.4)
haml-rails (0.3.4)
highline (1.6.12)
hike (1.2.1)
hpricot (0.8.6)
i18n (0.6.0, 0.4.2)
journey (1.0.3)
jquery-rails (2.0.2, 2.0.1)
jquery-ui-rails (0.2.2)
json (1.7.3, 1.6.5)
kaminari (0.13.0)
launchy (2.1.0)
libwebsocket (0.1.3)
mail (2.4.4, 2.4.1, 2.2.19)
mime-types (1.18, 1.17.2)
mongo (1.5.2)
mongoid (2.4.0)
multi_json (1.3.6, 1.3.5)
mysql2 (0.3.11)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.5.2)
net-ssh-gateway (1.1.0)
nokogiri (1.5.4)
orm_adapter (0.0.6)
polyglot (0.3.3)
rack (1.4.1, 1.2.5)
rack-cache (1.2, 1.1)
rack-mount (0.6.14)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.5.7)
rails (3.2.5, 3.2.1, 3.0.0)
rails3-jquery-autocomplete (1.0.7)
railties (3.2.5, 3.2.1, 3.0.0)
rake (0.9.2.2)
rdoc (3.12)
rspec (2.10.0, 2.0.0)
rspec-core (2.10.1, 2.0.0)
rspec-expectations (2.10.0, 2.0.0)
rspec-mocks (2.10.1, 2.0.0)
rspec-rails (2.10.1, 2.0.0)
ruby-debug-base19 (0.11.25)
ruby-debug-base19x (0.11.30.pre10)
ruby-debug19 (0.11.6)
ruby_core_source (0.1.5)
ruby_parser (2.3.1)
rubygems-bundler (1.0.2)
rubyzip (0.9.8, 0.9.7)
rvm (1.11.3.3)
rvm-capistrano (1.2.2)
sass (3.1.19, 3.1.15)
sass-rails (3.2.5, 3.2.4)
selenium-webdriver (2.22.2)
sexp_processor (3.0.10)
sprockets (2.1.3, 2.1.2)
sqlite3 (1.3.6)
sqlite3-ruby (1.3.3)
syntax (1.0.0)
thor (0.15.2, 0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.4, 1.2.3)
vpim (0.695)
warden (1.1.1)
webrat (0.7.3, 0.7.2)
whenever (0.7.3)
xpath (0.1.4)

Thanks a lot for help about this.
Josh

It seems that Capybara is the default now, and Webrat was the default
back in 2010 or so when the RSpec Book was printed. (I’m not 100% sure
about this though.)