Permalink
Browse files

First commit.

  • Loading branch information...
0 parents commit 4a6932c09793d4f618f4ca79f98b8a8ad0e3c9f7 @josevalim josevalim committed Dec 31, 2010
4 .gitignore
@@ -0,0 +1,4 @@
+/pkg
+/.bundle
+/.rvmrc
+/capybara-envjs-*.gem
3 CHANGELOG.rdoc
@@ -0,0 +1,3 @@
+=== 0.0.1
+
+* First release
3 Gemfile
@@ -0,0 +1,3 @@
+source :rubygems
+
+gemspec
57 README.rdoc
@@ -0,0 +1,57 @@
+= capybara-zombie
+
+* http://github.com/plataformatec/capybara-zombie
+
+== Description:
+
+capybara-zombie is a {Capybara}[http://github.com/jnicklas/capybara] driver for zombie in node.js.
+It is similar to Capybara's rack-test driver in that it runs tests against your rack application directly but fully supports javascript in your application.
+
+== Install:
+
+Install as a gem:
+
+ gem install capybara-zombie
+
+== Development:
+
+* Source hosted at {GitHub}[http://github.com/plataformatec/capybara-zombie].
+* Report issues on {GitHub Issues}[http://github.com/plataformatec/capybara-zombie/issues]
+
+== Using with Capybara
+
+See the Capybara docs. Use the symbol :zombie for the driver/default_driver as appropriate.
+
+If you are using cucumber, you might add the following lines to your features/support/env.rb
+
+ require 'capybara/zombie'
+ Capybara.javascript_driver = :zombie
+
+== Acknowledgements
+
+Capybara and the :envjs driver for supporting the basic structure used in this gem.
+
+== License
+
+(The MIT License)
+
+Copyright (c) 2010 Plataforma Tecnologia
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 Rakefile
@@ -0,0 +1,10 @@
+# -*- ruby -*-
+
+require 'rubygems'
+require 'bundler/setup'
+require 'rspec/core/rake_task'
+
+desc "Run all examples"
+RSpec::Core::RakeTask.new('spec')
+
+task :default => :spec
31 capybara-zombie.gemspec
@@ -0,0 +1,31 @@
+# -*- mode: ruby; encoding: utf-8 -*-
+lib = File.expand_path('../lib/', __FILE__)
+$:.unshift lib unless $:.include?(lib)
+
+require 'capybara/zombie/version'
+
+Gem::Specification.new do |s|
+ s.name = "capybara-zombie"
+ s.rubyforge_project = "capybara-zombie"
+ s.version = Capybara::Zombie::VERSION
+
+ s.authors = ["José Valim"]
+ s.email = ["developers@plataformatec.com.br"]
+ s.description = "capybara-zombie is a Capybara driver for the zombie in node.js. It is similar to Capybara's rack-test driver in that it runs tests against your rack application directly but fully supports javascript in your application."
+
+ s.files = Dir.glob("{lib,spec}/**/*") + %w(README.rdoc CHANGELOG.rdoc)
+ s.extra_rdoc_files = ["README.rdoc"]
+
+ s.homepage = "http://github.com/plataformatec/capybara-zombie"
+ s.rdoc_options = ["--main", "README.rdoc"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = "1.3.6"
+ s.summary = "Capybara driver for zombie in node.js"
+
+ s.add_runtime_dependency("capybara", "~> 0.4.0")
+
+ s.add_development_dependency("bundler", "~> 1.0")
+ s.add_development_dependency("rspec", "~> 2.0")
+ s.add_development_dependency("rack-test", ">= 0.5.4")
+ s.add_development_dependency("sinatra", "~> 1.0")
+end
8 lib/capybara/driver/zombie_driver.rb
@@ -0,0 +1,8 @@
+class Capybara::Driver::Zombie < Capybara::Driver::Base
+ class Node < Capybara::Driver::Node
+ end
+end
+
+Capybara.register_driver :zombie do |app|
+ Capybara::Driver::Zombie.new(app)
+end
3 lib/capybara/zombie.rb
@@ -0,0 +1,3 @@
+require 'capybara'
+require 'capybara/zombie/version'
+require 'capybara/driver/zombie_driver'
5 lib/capybara/zombie/version.rb
@@ -0,0 +1,5 @@
+module Capybara
+ module Zombie
+ VERSION = "0.0.1"
+ end
+end
15 spec/driver/zombie_driver_spec.rb
@@ -0,0 +1,15 @@
+require File.expand_path('../spec_helper', File.dirname(__FILE__))
+
+describe Capybara::Driver::Envjs do
+ driver = nil
+ before do
+ @driver = (driver ||= Capybara::Driver::Zombie.new(TestApp))
+ end
+
+ it_should_behave_like "driver"
+ it_should_behave_like "driver with header support"
+ it_should_behave_like "driver with status code support"
+ it_should_behave_like "driver with cookies support"
+ it_should_behave_like "driver with infinite redirect detection"
+ it_should_behave_like "driver with javascript support"
+end
26 spec/session/zombie_session_spec.rb
@@ -0,0 +1,26 @@
+require File.expand_path('../spec_helper', File.dirname(__FILE__))
+
+describe Capybara::Driver::Envjs do
+ session = nil
+
+ before do
+ @session = (session ||= Capybara::Session.new(:zombie, TestApp))
+ end
+
+ describe '#driver' do
+ it "should be an zombie driver" do
+ @session.driver.should be_an_instance_of(Capybara::Driver::Zombie)
+ end
+ end
+
+ describe '#mode' do
+ it "should remember the mode" do
+ @session.mode.should == :zombie
+ end
+ end
+
+ it_should_behave_like "session"
+ it_should_behave_like "session with javascript support"
+ it_should_behave_like "session with headers support"
+ it_should_behave_like "session with status code support"
+end
18 spec/spec_helper.rb
@@ -0,0 +1,18 @@
+require 'rubygems'
+require 'bundler/setup'
+require 'capybara/zombie'
+
+spec_dir = nil
+
+$:.detect do |dir|
+ if File.exists? File.join(dir, "capybara.rb")
+ spec_dir = File.expand_path(File.join(dir, "..", "spec"))
+ $:.unshift(spec_dir)
+ end
+end
+
+require File.join(spec_dir, "spec_helper")
+
+RSpec.configure do |c|
+ # c.filter_run :focus => true
+end

0 comments on commit 4a6932c

Please sign in to comment.