Skip to content

Instantly share code, notes, and snippets.

@gongo
Created July 11, 2012 21:27
Show Gist options
  • Save gongo/3093675 to your computer and use it in GitHub Desktop.
Save gongo/3093675 to your computer and use it in GitHub Desktop.
RSpec 2.11 からの新しいシンタックスがそのまま Capybara でも使えるかテスト
require 'rubygems'
require 'capybara/rspec'
Capybara.current_driver = :selenium
Capybara.app_host = 'http://www.google.com'
Capybara.run_server = false
include Capybara::DSL
describe "Capybara/RSpec matchers" do
it "can use with rspec 2.11" do
visit '/'
page.should have_css('#gs_htif0')
expect(page).to have_css('#gs_htif0') # rspec 2.11 new syntax
end
end
# gongo$ cat Gemfile
# source 'https://rubygems.org'
#
# gem 'rspec'
# gem 'capybara'
#
# gongo$ bundle install --path vendor/bundle
# gongo$ bundle exec rspec capybara_rspec_matcher_test.rb
# .
#
# Finished in 5.34 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment