capybara-webkit 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,11 +6,11 @@ A [capybara](https://github.com/jnicklas/capybara) driver that uses [WebKit](htt
6
6
  Dependencies
7
7
  ------------
8
8
 
9
- capybara-webkit depends on a WebKit implementation from Qt, a cross-platform development toolkit. You'll need to download the Qt SDK to build and install the gem.
9
+ capybara-webkit depends on a WebKit implementation from Qt, a cross-platform development toolkit. You'll need to download the Qt Framework to build and install the gem.
10
10
 
11
11
  * [Download Qt](http://qt.nokia.com/downloads/downloads)
12
12
 
13
- If you're on OS X, the installer at the above link will set up everything you need.
13
+ If you're on OS X, the installer at the above link will set up everything you need. You can download just the framework, as the full SDK isn't required to build the gem.
14
14
 
15
15
  If you're on Ubuntu, you can install the libqt4-dev package.
16
16
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "capybara-webkit"
3
- s.version = "0.1.5"
3
+ s.version = "0.1.6"
4
4
  s.authors = ["thoughtbot", "Joe Ferris", "Jason Morrison", "Tristan Dunn"]
5
5
  s.email = "support@thoughtbot.com"
6
6
  s.files = `git ls-files`.split("\n")
@@ -61,7 +61,7 @@ class Capybara::Driver::Webkit
61
61
  end
62
62
 
63
63
  def wait?
64
- false
64
+ true
65
65
  end
66
66
 
67
67
  def wait_until(*args)
@@ -56,7 +56,7 @@ class Capybara::Driver::Webkit
56
56
  end
57
57
 
58
58
  def path
59
- raise NotSupportedByDriverError
59
+ raise Capybara::NotSupportedByDriverError
60
60
  end
61
61
 
62
62
  def trigger(event)
@@ -2,11 +2,74 @@ require 'spec_helper'
2
2
  require 'capybara-webkit'
3
3
 
4
4
  describe Capybara::Session do
5
+ subject { Capybara::Session.new(:reusable_webkit, @app) }
6
+ after { subject.reset! }
7
+
8
+ context "slow javascript app" do
9
+ before(:all) do
10
+ @app = lambda do |env|
11
+ body = <<-HTML
12
+ <html><body>
13
+ <form action="/next" id="submit_me"><input type="submit" value="Submit" /></form>
14
+ <p id="change_me">Hello</p>
15
+
16
+ <script type="text/javascript">
17
+ var form = document.getElementById('submit_me');
18
+ form.addEventListener("submit", function (event) {
19
+ event.preventDefault();
20
+ setTimeout(function () {
21
+ document.getElementById("change_me").innerHTML = 'Good' + 'bye';
22
+ }, 500);
23
+ });
24
+ </script>
25
+ </body></html>
26
+ HTML
27
+ [200,
28
+ { 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s },
29
+ [body]]
30
+ end
31
+ end
32
+
33
+ before do
34
+ @default_wait_time = Capybara.default_wait_time
35
+ Capybara.default_wait_time = 1
36
+ end
37
+
38
+ after { Capybara.default_wait_time = @default_wait_time }
39
+
40
+ it "waits for a request to load" do
41
+ subject.visit("/")
42
+ subject.find_button("Submit").click
43
+ subject.should have_content("Goodbye");
44
+ end
45
+ end
46
+
47
+ context "simple app" do
48
+ before(:all) do
49
+ @app = lambda do |env|
50
+ body = <<-HTML
51
+ <html><body>
52
+ <strong>Hello</strong>
53
+ </body></html>
54
+ HTML
55
+ [200,
56
+ { 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s },
57
+ [body]]
58
+ end
59
+ end
60
+
61
+ it "inspects nodes" do
62
+ subject.visit("/")
63
+ subject.all(:xpath, "//strong").first.inspect.should include("strong")
64
+ end
65
+ end
66
+ end
67
+
68
+ describe Capybara::Session, "with TestApp" do
5
69
  before do
6
- @session = Capybara::Session.new(:webkit, TestApp)
70
+ @session = Capybara::Session.new(:reusable_webkit, TestApp)
7
71
  end
8
72
 
9
- # TODO: needs to only use one Browser throughout tests
10
73
  # it_should_behave_like "session"
11
74
  # it_should_behave_like "session with javascript support"
12
75
  end
@@ -20,3 +20,6 @@ require File.join(spec_dir,"spec_helper")
20
20
  require 'capybara/driver/webkit/browser'
21
21
  $webkit_browser = Capybara::Driver::Webkit::Browser.new(:socket_class => TCPSocket)
22
22
 
23
+ Capybara.register_driver :reusable_webkit do |app|
24
+ Capybara::Driver::Webkit.new(app, :browser => $webkit_browser)
25
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-webkit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-04-13 00:00:00 -04:00
21
+ date: 2011-04-14 00:00:00 -04:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -62,7 +62,6 @@ extra_rdoc_files: []
62
62
  files:
63
63
  - .gitignore
64
64
  - .rspec
65
- - .rvmrc
66
65
  - Gemfile
67
66
  - Gemfile.lock
68
67
  - LICENSE
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use ruby-1.8.7-p334