Permalink
Browse files

"first" commit

  • Loading branch information...
1 parent 05cb3a5 commit 24273dac1ece83ca1531cc3dec79134c133eb937 Pedro Menezes committed May 28, 2011
View
13 Gemfile
@@ -1,13 +1,12 @@
-source "http://rubygems.org"
-# Add dependencies required to use your gem here.
-# Example:
-# gem "activesupport", ">= 2.3.5"
+source :rubygems
-# Add dependencies to develop your gem here.
-# Include everything needed to run rake, tests, features, etc.
-group :development do
+group :development, :test do
gem "shoulda", ">= 0"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.6.0"
gem "rcov", ">= 0"
+
+ gem "capybara", ">= 0"
+ gem "cucumber", ">= 0"
+ gem "selenium-webdriver", ">= 0"
end
View
@@ -0,0 +1,72 @@
+## Welcome to MegaDriver
+
+With MegaDriver, you can simulate *multiple clients in the same [Cucu](http://en.wikipedia.org/wiki/Cucumber)[mber](https://github.com/cucumber/cucumber) scenario*.
+
+It is a [Capybara](https://github.com/jnicklas/capybara) Driver extended from [Selenium](http://seleniumhq.org/) Capybara Driver with some Cucumber Steps.
+
+## Getting Started
+
+1. *Install* MegaDriver at the command prompt if you haven't yet:
+
+ gem install megadriver
+
+2. *Copy* MegaDriver's step definitions to your step definitions directory
+
+ PS: we have in pt-BR besides English
+
+3. *Set up* MegaDriver as your Capybara driver:
+
+ * Add "Capybara.default_driver = :megadriver" to your features/support/env.rb
+ * *OR* tag your Cucumber scenarios with @megadriver
+
+## Example
+
+ Feature: Chat
+
+ Scenario: Exchange messages
+ Given "Falcon" is in control
+ And I am in the chatroom
+
+ Given "Humbert" is in control
+ And I am in the chatroom
+ When I type "Hi" in the message box
+ And press enter
+
+ Given "Falcon" is in control
+ Then I should see "Hi"
+
+ Scenario: Other exchange message example
+ Given "Falcon" is in control
+ And I am in the chatroom
+
+ Given another client is in control
+ And I am in the chatroom
+ When I type "Hi" in the message box
+ And press enter
+
+ Given "Falcon" is in control
+ Then I should see "Hi"
+
+
+## Observation
+
+* You can use your old steps with MegaDriver awesomeness
+* *Be careful*: browsers opened by MegaDriver will close only when the process exits
+ * You should reuse your client names
+
+
+## TODO
+
+Make possible to select the browser type
+
+
+## Thanks
+
+* [Pedro Teixeira](https://github.com/pedroteixeira);
+* [Sergio Azevedo](https://github.com/sergiojunior);
+* everybody from [Intelie](http://intelie.com.br/).
+
+## Copyright
+
+Copyright (c) 2011 Pedro Menezes. See LICENSE.txt for
+further details.
View
@@ -1,19 +0,0 @@
-= megadriver
-
-Description goes here.
-
-== Contributing to megadriver
-
-* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
-* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
-* Fork the project
-* Start a feature/bugfix branch
-* Commit and push until you are happy with your contribution
-* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
-* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
-
-== Copyright
-
-Copyright (c) 2011 Pedro Menezes. See LICENSE.txt for
-further details.
-
View
@@ -17,11 +17,10 @@ Jeweler::Tasks.new do |gem|
gem.name = "megadriver"
gem.homepage = "http://github.com/pedromenezes/megadriver"
gem.license = "MIT"
- gem.summary = %Q{TODO: one-line summary of your gem}
- gem.description = %Q{TODO: longer description of your gem}
+ gem.summary = %Q{Multiple Selenium clients in Cucumber scenarios with Capybara}
+ gem.description = %Q{Capybara Driver and Cucumber Steps to use multiple clients in the same scenario}
gem.email = "pedrojudo@gmail.com"
gem.authors = ["Pedro Menezes"]
- # dependencies defined in Gemfile
end
Jeweler::RubygemsDotOrgTasks.new
@@ -0,0 +1,22 @@
+require 'selenium-webdriver'
+
+module Capybara
+ module MegaDriver
+ class Driver < Capybara::Selenium::Driver
+
+ def initialize(app, options={})
+ @app = app
+ @options = DEFAULT_OPTIONS.merge(options)
+ @@rack_server = Capybara::Server.new(@app)
+ @@rack_server.boot if Capybara.run_server
+ end
+
+ private
+
+ def url(path)
+ @@rack_server.url(path)
+ end
+
+ end
+ end
+end
View
@@ -0,0 +1,13 @@
+# encoding: utf-8
+
+require 'capybara/megadriver/driver'
+require 'capybara'
+
+Capybara.register_driver :megadriver do |app|
+ Capybara::MegaDriver::Driver.new(app)
+end
+
+Before do
+ Capybara.session_name = :default
+ @other = 0
+end
@@ -0,0 +1,8 @@
+Given /^"([^"]*)" is in control$/ do |client|
+ Capybara.session_name = client
+end
+
+Given /^another client is in control$/
+ @other += 1
+ Capybara.session_name = "client_#{@other}"
+end
@@ -0,0 +1,7 @@
+Dado /^que "([^"]*)" está no controle$/ do |client|
+ Given %{"#{client}" is in control}
+end
+
+Dado /^que outro client está no controle$/ do
+ Given %{another client is in control}
+end
View
@@ -0,0 +1,65 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{megadriver}
+ s.version = "0.0.1"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Pedro Menezes"]
+ s.date = %q{2011-05-27}
+ s.description = %q{Capybara Driver and Cucumber Steps to use multiple clients in the same scenario}
+ s.email = %q{pedrojudo@gmail.com}
+ s.extra_rdoc_files = [
+ "LICENSE.txt",
+ "README.md"
+ ]
+ s.files = [
+ ".document",
+ "Gemfile",
+ "LICENSE.txt",
+ "Rakefile",
+ "VERSION",
+ "lib/megadriver.rb",
+ "test/helper.rb",
+ "test/test_megadriver.rb"
+ ]
+ s.homepage = %q{http://github.com/pedromenezes/megadriver}
+ s.licenses = ["MIT"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.6.2}
+ s.summary = %q{Multiple Selenium clients in Cucumber scenarios with Capybara}
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
+ s.add_development_dependency(%q<rcov>, [">= 0"])
+ s.add_development_dependency(%q<capybara>, [">= 0"])
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
+ s.add_development_dependency(%q<selenium-webdriver>, [">= 0"])
+ else
+ s.add_dependency(%q<shoulda>, [">= 0"])
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
+ s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
+ s.add_dependency(%q<rcov>, [">= 0"])
+ s.add_dependency(%q<capybara>, [">= 0"])
+ s.add_dependency(%q<cucumber>, [">= 0"])
+ s.add_dependency(%q<selenium-webdriver>, [">= 0"])
+ end
+ else
+ s.add_dependency(%q<shoulda>, [">= 0"])
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
+ s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
+ s.add_dependency(%q<rcov>, [">= 0"])
+ s.add_dependency(%q<capybara>, [">= 0"])
+ s.add_dependency(%q<cucumber>, [">= 0"])
+ s.add_dependency(%q<selenium-webdriver>, [">= 0"])
+ end
+end
+

0 comments on commit 24273da

Please sign in to comment.