Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

renamed to capybara

  • Loading branch information...
commit 6b099a4a3382b52cbb8476cafe28b710d82800b9 1 parent 6f15562
Theo Hultberg and Jonas Nicklas authored jnicklas committed
Showing with 186 additions and 186 deletions.
  1. +13 −13 Manifest.txt
  2. +15 −15 README.rdoc
  3. +2 −2 Rakefile
  4. +1 −1  examples/webcat.rb
  5. +29 −0 lib/capybara.rb
  6. 0  lib/{webcat → capybara}/core_ext/tcp_socket.rb
  7. +6 −6 lib/{webcat → capybara}/cucumber.rb
  8. +2 −2 lib/{webcat → capybara}/driver/culerity_driver.rb
  9. +2 −2 lib/{webcat → capybara}/driver/firewatir_driver.rb
  10. +1 −1  lib/{webcat → capybara}/driver/rack_test_driver.rb
  11. +2 −2 lib/{webcat → capybara}/driver/safariwatir_driver.rb
  12. +2 −2 lib/{webcat → capybara}/driver/selenium_driver.rb
  13. +3 −3 lib/{webcat → capybara}/dsl.rb
  14. +11 −0 lib/capybara/rails.rb
  15. +4 −4 lib/{webcat → capybara}/save_and_open_page.rb
  16. +7 −7 lib/{webcat → capybara}/server.rb
  17. +11 −11 lib/{webcat → capybara}/session.rb
  18. +0 −29 lib/webcat.rb
  19. +0 −11 lib/webcat/rails.rb
  20. +2 −2 script/console
  21. +2 −2 spec/driver/culerity_driver_spec.rb
  22. +2 −2 spec/driver/firewatir_driver_spec.rb
  23. +2 −2 spec/driver/rack_test_driver_spec.rb
  24. +2 −2 spec/driver/safariwarit_driver_spec.rb
  25. +2 −2 spec/driver/selenium_driver_spec.rb
  26. +46 −46 spec/dsl_spec.rb
  27. +3 −3 spec/session/culerity_session_spec.rb
  28. +3 −3 spec/session/rack_test_session_spec.rb
  29. +3 −3 spec/session/selenium_session_spec.rb
  30. +7 −7 spec/session_spec.rb
  31. +1 −1  spec/spec_helper.rb
View
26 Manifest.txt
@@ -3,19 +3,19 @@ Manifest.txt
README.rdoc
Rakefile
examples/webcat.rb
-lib/webcat.rb
-lib/webcat/core_ext/tcp_socket.rb
-lib/webcat/cucumber.rb
-lib/webcat/driver/culerity_driver.rb
-lib/webcat/driver/firewatir_driver.rb
-lib/webcat/driver/rack_test_driver.rb
-lib/webcat/driver/safariwatir_driver.rb
-lib/webcat/driver/selenium_driver.rb
-lib/webcat/dsl.rb
-lib/webcat/rails.rb
-lib/webcat/save_and_open_page.rb
-lib/webcat/server.rb
-lib/webcat/session.rb
+lib/capybara.rb
+lib/capybara/core_ext/tcp_socket.rb
+lib/capybara/cucumber.rb
+lib/capybara/driver/culerity_driver.rb
+lib/capybara/driver/firewatir_driver.rb
+lib/capybara/driver/rack_test_driver.rb
+lib/capybara/driver/safariwatir_driver.rb
+lib/capybara/driver/selenium_driver.rb
+lib/capybara/dsl.rb
+lib/capybara/rails.rb
+lib/capybara/save_and_open_page.rb
+lib/capybara/server.rb
+lib/capybara/session.rb
script/console
script/destroy
script/generate
View
30 README.rdoc
@@ -1,10 +1,10 @@
-= webcat
+= capybara
-* http://github.com/jnicklas/webcat
+* http://github.com/jnicklas/capybara
== Description:
-Webcat is a unified API for writing web application integration tests for Rack
+Capybara is a unified API for writing web application integration tests for Rack
applications. It works with any rack application and currently has support for
Culerity, Selenium and rack-test.
@@ -16,22 +16,22 @@ Clone and install from github for now
You can initialize a session and start issuing commands:
- require 'webcat'
+ require 'capybara'
- session = Webcat::Session.new(:culerity, my_rack_app)
+ session = Capybara::Session.new(:culerity, my_rack_app)
session.within("//form[@id='session']") do
session.fill_in 'Login', :with => 'user@example.com'
session.fill_in 'Password', :with => 'password'
end
session.click_link 'Sign in'
-Webcat provides a terser DSL:
+Capybara provides a terser DSL:
- require 'webcat'
- require 'webcat/dsl'
+ require 'capybara'
+ require 'capybara/dsl'
- include Webcat
- Webcat.default_driver = :culerity
+ include Capybara
+ Capybara.default_driver = :culerity
within("//form[@id='session']") do
fill_in 'Login', :with => 'user@example.com'
@@ -41,8 +41,8 @@ Webcat provides a terser DSL:
If you want to use it with Cucumber, just require:
- require 'webcat/cucumber'
- Webcat.app = my_rack_app
+ require 'capybara/cucumber'
+ Capybara.app = my_rack_app
Then write your steps like this:
@@ -56,12 +56,12 @@ Then write your steps like this:
If you're using Rails, webcan can set up the rack app for you. Just do:
- require 'webcat/cucumber'
- require 'webcat/rails'
+ require 'capybara/cucumber'
+ require 'capybara/rails'
== Gotchas:
-* Everything is *case sensitive*. Webcat heavily relies on XPath, which doesn't
+* Everything is *case sensitive*. Capybara heavily relies on XPath, which doesn't
support case insensitive searches.
* Unchecking checkboxes and filling in password fields is currently broken
under Culerity.
View
4 Rakefile
@@ -2,7 +2,7 @@ require 'rubygems'
gem 'hoe', '>= 2.1.0'
require 'hoe'
require 'fileutils'
-require './lib/webcat'
+require './lib/capybara'
Hoe.plugin :newgem
# Hoe.plugin :website
@@ -10,7 +10,7 @@ Hoe.plugin :newgem
# Generate all the Rake tasks
# Run 'rake -T' to see list of generated tasks (from gem root directory)
-$hoe = Hoe.spec 'webcat' do
+$hoe = Hoe.spec 'capybara' do
self.developer 'Jonas Nicklas', 'jonas.nicklas@gmail.com'
self.rubyforge_name = self.name # TODO this is default value
View
2  examples/webcat.rb
@@ -1,4 +1,4 @@
-session = Webcat::Session.new('http://localhost:3000')
+session = Capybara::Session.new('http://localhost:3000')
session.visit '/'
View
29 lib/capybara.rb
@@ -0,0 +1,29 @@
+require 'nokogiri'
+
+module Capybara
+ VERSION = '0.1'
+
+ class CapybaraError < StandardError; end
+ class DriverNotFoundError < CapybaraError; end
+ class ElementNotFound < CapybaraError; end
+
+ class << self
+ attr_accessor :debug, :asset_root
+
+ def log(message)
+ puts "[capybara] #{message}" if debug
+ true
+ end
+ end
+
+ autoload :Server, 'capybara/server'
+ autoload :Session, 'capybara/session'
+
+ module Driver
+ autoload :RackTest, 'capybara/driver/rack_test_driver'
+ autoload :Culerity, 'capybara/driver/culerity_driver'
+ autoload :SafariWatir, 'capybara/driver/safariwatir_driver'
+ autoload :FireWatir, 'capybara/driver/firewatir_driver'
+ autoload :Selenium, 'capybara/driver/selenium_driver'
+ end
+end
View
0  lib/webcat/core_ext/tcp_socket.rb → lib/capybara/core_ext/tcp_socket.rb
File renamed without changes
View
12 lib/webcat/cucumber.rb → lib/capybara/cucumber.rb
@@ -1,10 +1,10 @@
-require 'webcat'
-require 'webcat/dsl'
+require 'capybara'
+require 'capybara/dsl'
-World(Webcat)
+World(Capybara)
After do
- Webcat.reset_sessions!
+ Capybara.reset_sessions!
end
require 'database_cleaner'
@@ -12,9 +12,9 @@
DatabaseCleaner.strategy = :truncation
Before('@javascript') do
- Webcat.current_driver = Webcat.javascript_driver
+ Capybara.current_driver = Capybara.javascript_driver
end
After('@javascript') do
- Webcat.use_default_driver
+ Capybara.use_default_driver
end
View
4 lib/webcat/driver/culerity_driver.rb → lib/capybara/driver/culerity_driver.rb
@@ -1,6 +1,6 @@
require 'culerity'
-class Webcat::Driver::Culerity
+class Capybara::Driver::Culerity
class Node < Struct.new(:node)
def text
node.text
@@ -48,7 +48,7 @@ def self.server
def initialize(app)
@app = app
- @rack_server = Webcat::Server.new(@app)
+ @rack_server = Capybara::Server.new(@app)
@rack_server.boot
end
View
4 lib/webcat/driver/firewatir_driver.rb → lib/capybara/driver/firewatir_driver.rb
@@ -1,7 +1,7 @@
require 'watir'
Watir::Browser.default = "firefox"
-class Webcat::Driver::FireWatir
+class Capybara::Driver::FireWatir
class Node < Struct.new(:node)
def text
node.text
@@ -31,7 +31,7 @@ def tag_name
def initialize(app)
@app = app
- @rack_server = Webcat::Server.new(@app)
+ @rack_server = Capybara::Server.new(@app)
@rack_server.boot
end
View
2  lib/webcat/driver/rack_test_driver.rb → lib/capybara/driver/rack_test_driver.rb
@@ -1,7 +1,7 @@
require 'rack/test'
require 'nokogiri'
-class Webcat::Driver::RackTest
+class Capybara::Driver::RackTest
class Node < Struct.new(:session, :node)
def text
node.text
View
4 lib/webcat/driver/safariwatir_driver.rb → lib/capybara/driver/safariwatir_driver.rb
@@ -1,6 +1,6 @@
require 'safariwatir'
-class Webcat::Driver::SafariWatir
+class Capybara::Driver::SafariWatir
class Node < Struct.new(:node)
def text
node.text
@@ -30,7 +30,7 @@ def tag_name
def initialize(app)
@app = app
- @rack_server = Webcat::Server.new(@app)
+ @rack_server = Capybara::Server.new(@app)
@rack_server.boot
end
View
4 lib/webcat/driver/selenium_driver.rb → lib/capybara/driver/selenium_driver.rb
@@ -1,6 +1,6 @@
require 'selenium-webdriver'
-class Webcat::Driver::Selenium
+class Capybara::Driver::Selenium
class Node < Struct.new(:node)
def text
node.text
@@ -64,7 +64,7 @@ def self.driver
def initialize(app)
@app = app
- @rack_server = Webcat::Server.new(@app)
+ @rack_server = Capybara::Server.new(@app)
@rack_server.boot
end
View
6 lib/webcat/dsl.rb → lib/capybara/dsl.rb
@@ -1,4 +1,4 @@
-module Webcat
+module Capybara
class << self
attr_writer :default_driver, :current_driver, :javascript_driver
@@ -22,7 +22,7 @@ def use_default_driver
end
def current_session
- session_pool["#{current_driver}#{app.object_id}"] ||= Webcat::Session.new(current_driver, app)
+ session_pool["#{current_driver}#{app.object_id}"] ||= Capybara::Session.new(current_driver, app)
end
def reset_sessions!
@@ -39,7 +39,7 @@ def session_pool
extend(self)
def page
- Webcat.current_session
+ Capybara.current_session
end
SESSION_METHODS = [
View
11 lib/capybara/rails.rb
@@ -0,0 +1,11 @@
+require 'capybara'
+require 'capybara/dsl'
+
+Capybara.app = Rack::Builder.new do
+ map "/" do
+ use Rails::Rack::Static
+ run ActionController::Dispatcher.new
+ end
+end.to_app
+
+Capybara.asset_root = Rails.root.join('public')
View
8 lib/webcat/save_and_open_page.rb → lib/capybara/save_and_open_page.rb
@@ -1,10 +1,10 @@
-module Webcat
+module Capybara
module SaveAndOpenPage
extend(self)
def save_and_open_page(html)
require 'tempfile'
- tempfile = Tempfile.new("webcat#{rand(1000000)}")
+ tempfile = Tempfile.new("capybara#{rand(1000000)}")
tempfile.write(rewrite_css_and_image_references(html))
tempfile.close
open_in_browser(tempfile.path)
@@ -18,8 +18,8 @@ def open_in_browser(path) # :nodoc
end
def rewrite_css_and_image_references(response_html) # :nodoc:
- return response_html unless Webcat.asset_root
- response_html.gsub(/("|')\/(stylesheets|images)/, '\1' + Webcat.asset_root + '/\2')
+ return response_html unless Capybara.asset_root
+ response_html.gsub(/("|')\/(stylesheets|images)/, '\1' + Capybara.asset_root + '/\2')
end
end
end
View
14 lib/webcat/server.rb → lib/capybara/server.rb
@@ -1,7 +1,7 @@
require 'net/http'
require 'rack'
-class Webcat::Server
+class Capybara::Server
attr_reader :app
def initialize(app)
@@ -21,21 +21,21 @@ def url(path)
end
def boot
- Webcat.log "application has already booted" and return if responsive?
- Webcat.log "booting Rack applicartion on port #{port}"
+ Capybara.log "application has already booted" and return if responsive?
+ Capybara.log "booting Rack applicartion on port #{port}"
start_time = Time.now
Thread.new do
Rack::Handler::Mongrel.run @app, :Port => port
end
- Webcat.log "checking if application has booted"
+ Capybara.log "checking if application has booted"
loop do
- Webcat.log("application has booted") and break if responsive?
+ Capybara.log("application has booted") and break if responsive?
if Time.now - start_time > 10
- Webcat.log "Rack application timed out during boot"
+ Capybara.log "Rack application timed out during boot"
exit
end
- Webcat.log '.'
+ Capybara.log '.'
sleep 1
end
end
View
22 lib/webcat/session.rb → lib/capybara/session.rb
@@ -1,4 +1,4 @@
-class Webcat::Session
+class Capybara::Session
attr_reader :mode, :app
def initialize(mode, app)
@@ -9,13 +9,13 @@ def initialize(mode, app)
def driver
@driver ||= case mode
when :rack_test
- Webcat::Driver::RackTest.new(app)
+ Capybara::Driver::RackTest.new(app)
when :culerity
- Webcat::Driver::Culerity.new(app)
+ Capybara::Driver::Culerity.new(app)
when :selenium
- Webcat::Driver::Selenium.new(app)
+ Capybara::Driver::Selenium.new(app)
else
- raise Webcat::DriverNotFoundError, "no driver called #{mode} was found"
+ raise Capybara::DriverNotFoundError, "no driver called #{mode} was found"
end
end
@@ -82,15 +82,15 @@ def has_css?(path, options={})
def within(kind, scope=nil)
kind, scope = :xpath, kind unless scope
scope = css_to_xpath(scope) if kind == :css
- raise Webcat::ElementNotFound, "scope '#{scope}' not found on page" if find(scope).empty?
+ raise Capybara::ElementNotFound, "scope '#{scope}' not found on page" if find(scope).empty?
scopes.push(scope)
yield
scopes.pop
end
def save_and_open_page
- require 'webcat/save_and_open_page'
- Webcat::SaveAndOpenPage.save_and_open_page(body)
+ require 'capybara/save_and_open_page'
+ Capybara::SaveAndOpenPage.save_and_open_page(body)
end
private
@@ -120,7 +120,7 @@ def scopes
def find_link(locator)
link = find_element("//a[@id='#{locator}']", "//a[contains(.,'#{locator}')]", "//a[@title='#{locator}']")
- raise Webcat::ElementNotFound, "no link with title, id or text '#{locator}' found" unless link
+ raise Capybara::ElementNotFound, "no link with title, id or text '#{locator}' found" unless link
link
end
@@ -131,13 +131,13 @@ def find_button(locator)
"//input[@type='image'][@id='#{locator}']",
"//input[@type='image'][@value='#{locator}']"
)
- raise Webcat::ElementNotFound, "no button with value or id '#{locator}' found" unless button
+ raise Capybara::ElementNotFound, "no button with value or id '#{locator}' found" unless button
button
end
def find_field(locator, *kinds)
field = find_field_by_id(locator, *kinds) || find_field_by_label(locator, *kinds)
- raise Webcat::ElementNotFound, "no field of kind #{kinds.inspect} with id or'#{locator}' found" unless field
+ raise Capybara::ElementNotFound, "no field of kind #{kinds.inspect} with id or'#{locator}' found" unless field
field
end
View
29 lib/webcat.rb
@@ -1,29 +0,0 @@
-require 'nokogiri'
-
-module Webcat
- VERSION = '0.1'
-
- class WebcatError < StandardError; end
- class DriverNotFoundError < WebcatError; end
- class ElementNotFound < WebcatError; end
-
- class << self
- attr_accessor :debug, :asset_root
-
- def log(message)
- puts "[webcat] #{message}" if debug
- true
- end
- end
-
- autoload :Server, 'webcat/server'
- autoload :Session, 'webcat/session'
-
- module Driver
- autoload :RackTest, 'webcat/driver/rack_test_driver'
- autoload :Culerity, 'webcat/driver/culerity_driver'
- autoload :SafariWatir, 'webcat/driver/safariwatir_driver'
- autoload :FireWatir, 'webcat/driver/firewatir_driver'
- autoload :Selenium, 'webcat/driver/selenium_driver'
- end
-end
View
11 lib/webcat/rails.rb
@@ -1,11 +0,0 @@
-require 'webcat'
-require 'webcat/dsl'
-
-Webcat.app = Rack::Builder.new do
- map "/" do
- use Rails::Rack::Static
- run ActionController::Dispatcher.new
- end
-end.to_app
-
-Webcat.asset_root = Rails.root.join('public')
View
4 script/console
@@ -5,6 +5,6 @@ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
libs = " -r irb/completion"
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
-libs << " -r #{File.dirname(__FILE__) + '/../lib/webcat.rb'}"
-puts "Loading webcat gem"
+libs << " -r #{File.dirname(__FILE__) + '/../lib/capybara.rb'}"
+puts "Loading capybara gem"
exec "#{irb} #{libs} --simple-prompt"
View
4 spec/driver/culerity_driver_spec.rb
@@ -1,8 +1,8 @@
require File.expand_path('../spec_helper', File.dirname(__FILE__))
-describe Webcat::Driver::Culerity do
+describe Capybara::Driver::Culerity do
before do
- @driver = Webcat::Driver::Culerity.new(TestApp)
+ @driver = Capybara::Driver::Culerity.new(TestApp)
end
it_should_behave_like "driver"
View
4 spec/driver/firewatir_driver_spec.rb
@@ -1,8 +1,8 @@
require File.expand_path('../spec_helper', File.dirname(__FILE__))
-describe Webcat::Driver::FireWatir do
+describe Capybara::Driver::FireWatir do
before do
- @driver = Webcat::Driver::FireWatir.new(TestApp)
+ @driver = Capybara::Driver::FireWatir.new(TestApp)
end
# it_should_behave_like "driver"
View
4 spec/driver/rack_test_driver_spec.rb
@@ -1,8 +1,8 @@
require File.expand_path('../spec_helper', File.dirname(__FILE__))
-describe Webcat::Driver::RackTest do
+describe Capybara::Driver::RackTest do
before do
- @driver = Webcat::Driver::RackTest.new(TestApp)
+ @driver = Capybara::Driver::RackTest.new(TestApp)
end
it_should_behave_like "driver"
View
4 spec/driver/safariwarit_driver_spec.rb
@@ -1,8 +1,8 @@
require File.expand_path('../spec_helper', File.dirname(__FILE__))
-describe Webcat::Driver::SafariWatir do
+describe Capybara::Driver::SafariWatir do
before do
- @driver = Webcat::Driver::SafariWatir.new(TestApp)
+ @driver = Capybara::Driver::SafariWatir.new(TestApp)
end
# it_should_behave_like "driver"
View
4 spec/driver/selenium_driver_spec.rb
@@ -1,8 +1,8 @@
require File.expand_path('../spec_helper', File.dirname(__FILE__))
-describe Webcat::Driver::Selenium do
+describe Capybara::Driver::Selenium do
before do
- @driver = Webcat::Driver::Selenium.new(TestApp)
+ @driver = Capybara::Driver::Selenium.new(TestApp)
end
it_should_behave_like "driver"
View
92 spec/dsl_spec.rb
@@ -1,123 +1,123 @@
require File.expand_path('spec_helper', File.dirname(__FILE__))
-require 'webcat/dsl'
+require 'capybara/dsl'
-describe Webcat do
+describe Capybara do
before do
- Webcat.app = TestApp
+ Capybara.app = TestApp
end
after do
- Webcat.default_driver = nil
- Webcat.use_default_driver
+ Capybara.default_driver = nil
+ Capybara.use_default_driver
end
describe '#default_driver' do
it "should default to rack_test" do
- Webcat.default_driver.should == :rack_test
+ Capybara.default_driver.should == :rack_test
end
it "should be changeable" do
- Webcat.default_driver = :culerity
- Webcat.default_driver.should == :culerity
+ Capybara.default_driver = :culerity
+ Capybara.default_driver.should == :culerity
end
end
describe '#current_driver' do
it "should default to the default driver" do
- Webcat.current_driver.should == :rack_test
- Webcat.default_driver = :culerity
- Webcat.current_driver.should == :culerity
+ Capybara.current_driver.should == :rack_test
+ Capybara.default_driver = :culerity
+ Capybara.current_driver.should == :culerity
end
it "should be changeable" do
- Webcat.current_driver = :culerity
- Webcat.current_driver.should == :culerity
+ Capybara.current_driver = :culerity
+ Capybara.current_driver.should == :culerity
end
end
describe '#javascript_driver' do
it "should default to selenium" do
- Webcat.javascript_driver.should == :selenium
+ Capybara.javascript_driver.should == :selenium
end
it "should be changeable" do
- Webcat.javascript_driver = :culerity
- Webcat.javascript_driver.should == :culerity
+ Capybara.javascript_driver = :culerity
+ Capybara.javascript_driver.should == :culerity
end
end
describe '#use_default_driver' do
it "should restore the default driver" do
- Webcat.current_driver = :culerity
- Webcat.use_default_driver
- Webcat.current_driver.should == :rack_test
+ Capybara.current_driver = :culerity
+ Capybara.use_default_driver
+ Capybara.current_driver.should == :rack_test
end
end
describe '#app' do
it "should be changeable" do
- Webcat.app = "foobar"
- Webcat.app.should == 'foobar'
+ Capybara.app = "foobar"
+ Capybara.app.should == 'foobar'
end
end
describe '#current_session' do
it "should choose a session object of the current driver type" do
- Webcat.current_session.should be_a(Webcat::Session)
+ Capybara.current_session.should be_a(Capybara::Session)
end
it "should use #app as the application" do
- Webcat.app = proc {}
- Webcat.current_session.app.should == Webcat.app
+ Capybara.app = proc {}
+ Capybara.current_session.app.should == Capybara.app
end
it "should change with the current driver" do
- Webcat.current_session.mode.should == :rack_test
- Webcat.current_driver = :culerity
- Webcat.current_session.mode.should == :culerity
+ Capybara.current_session.mode.should == :rack_test
+ Capybara.current_driver = :culerity
+ Capybara.current_session.mode.should == :culerity
end
it "should be persistent even across driver changes" do
- object_id = Webcat.current_session.object_id
- Webcat.current_session.object_id.should == object_id
- Webcat.current_driver = :culerity
- Webcat.current_session.mode.should == :culerity
- Webcat.current_session.object_id.should_not == object_id
+ object_id = Capybara.current_session.object_id
+ Capybara.current_session.object_id.should == object_id
+ Capybara.current_driver = :culerity
+ Capybara.current_session.mode.should == :culerity
+ Capybara.current_session.object_id.should_not == object_id
- Webcat.current_driver = :rack_test
- Webcat.current_session.object_id.should == object_id
+ Capybara.current_driver = :rack_test
+ Capybara.current_session.object_id.should == object_id
end
it "should change when changing application" do
- object_id = Webcat.current_session.object_id
- Webcat.current_session.object_id.should == object_id
- Webcat.app = proc {}
- Webcat.current_session.object_id.should_not == object_id
- Webcat.current_session.app.should == Webcat.app
+ object_id = Capybara.current_session.object_id
+ Capybara.current_session.object_id.should == object_id
+ Capybara.app = proc {}
+ Capybara.current_session.object_id.should_not == object_id
+ Capybara.current_session.app.should == Capybara.app
end
end
describe '.reset_sessions!' do
it "should clear any persisted sessions" do
- object_id = Webcat.current_session.object_id
- Webcat.current_session.object_id.should == object_id
- Webcat.reset_sessions!
- Webcat.current_session.object_id.should_not == object_id
+ object_id = Capybara.current_session.object_id
+ Capybara.current_session.object_id.should == object_id
+ Capybara.reset_sessions!
+ Capybara.current_session.object_id.should_not == object_id
end
end
describe 'the DSL' do
before do
- @session = Webcat
+ @session = Capybara
end
it_should_behave_like "session"
it "should be possible to include it in another class" do
klass = Class.new do
- include Webcat
+ include Capybara
end
foo = klass.new
foo.visit('/with_html')
@@ -127,7 +127,7 @@
it "should provide a 'page' shortcut for more expressive tests" do
klass = Class.new do
- include Webcat
+ include Capybara
end
foo = klass.new
foo.page.visit('/with_html')
View
6 spec/session/culerity_session_spec.rb
@@ -1,14 +1,14 @@
require File.expand_path('../spec_helper', File.dirname(__FILE__))
-describe Webcat::Session do
+describe Capybara::Session do
context 'with culerity driver' do
before do
- @session = Webcat::Session.new(:culerity, TestApp)
+ @session = Capybara::Session.new(:culerity, TestApp)
end
describe '#driver' do
it "should be a rack test driver" do
- @session.driver.should be_an_instance_of(Webcat::Driver::Culerity)
+ @session.driver.should be_an_instance_of(Capybara::Driver::Culerity)
end
end
View
6 spec/session/rack_test_session_spec.rb
@@ -1,14 +1,14 @@
require File.expand_path('../spec_helper', File.dirname(__FILE__))
-describe Webcat::Session do
+describe Capybara::Session do
context 'with rack test driver' do
before do
- @session = Webcat::Session.new(:rack_test, TestApp)
+ @session = Capybara::Session.new(:rack_test, TestApp)
end
describe '#driver' do
it "should be a rack test driver" do
- @session.driver.should be_an_instance_of(Webcat::Driver::RackTest)
+ @session.driver.should be_an_instance_of(Capybara::Driver::RackTest)
end
end
View
6 spec/session/selenium_session_spec.rb
@@ -1,14 +1,14 @@
require File.expand_path('../spec_helper', File.dirname(__FILE__))
-describe Webcat::Session do
+describe Capybara::Session do
context 'with selenium driver' do
before do
- @session = Webcat::Session.new(:selenium, TestApp)
+ @session = Capybara::Session.new(:selenium, TestApp)
end
describe '#driver' do
it "should be a rack test driver" do
- @session.driver.should be_an_instance_of(Webcat::Driver::Selenium)
+ @session.driver.should be_an_instance_of(Capybara::Driver::Selenium)
end
end
View
14 spec/session_spec.rb
@@ -52,7 +52,7 @@ def extract_results(session)
it "should raise an error" do
running do
@session.click_link('does not exist')
- end.should raise_error(Webcat::ElementNotFound)
+ end.should raise_error(Capybara::ElementNotFound)
end
end
@@ -149,7 +149,7 @@ def extract_results(session)
it "should raise an error" do
running do
@session.click_button('does not exist')
- end.should raise_error(Webcat::ElementNotFound)
+ end.should raise_error(Capybara::ElementNotFound)
end
end
@@ -206,7 +206,7 @@ def extract_results(session)
it "should raise an error" do
running do
@session.fill_in('does not exist', :with => 'Blah blah')
- end.should raise_error(Webcat::ElementNotFound)
+ end.should raise_error(Capybara::ElementNotFound)
end
end
end
@@ -505,7 +505,7 @@ def extract_results(session)
running {
@session.within("//div[@id='doesnotexist']") do
end
- }.should raise_error(Webcat::ElementNotFound)
+ }.should raise_error(Capybara::ElementNotFound)
end
end
@@ -526,12 +526,12 @@ def extract_results(session)
end
end
-describe Webcat::Session do
+describe Capybara::Session do
context 'with non-existant driver' do
it "should raise an error" do
running {
- Webcat::Session.new(:quox, TestApp).driver
- }.should raise_error(Webcat::DriverNotFoundError)
+ Capybara::Session.new(:quox, TestApp).driver
+ }.should raise_error(Capybara::DriverNotFoundError)
end
end
end
View
2  spec/spec_helper.rb
@@ -2,7 +2,7 @@
$:.unshift(File.dirname(__FILE__))
require 'rubygems'
-require 'webcat'
+require 'capybara'
require 'test_app'
require 'drivers_spec'
require 'session_spec'
Please sign in to comment.
Something went wrong with that request. Please try again.