diff --git a/Gemfile b/Gemfile index a9eb52d..910534b 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,5 @@ source "http://rubygems.org" gem "rake" gem "rspec", :require => false gem "capybara" +gem "sinatra", :require => false diff --git a/Gemfile.lock b/Gemfile.lock index 750d356..edc4f57 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,6 +38,10 @@ GEM ffi (~> 0.6.3) json_pure rubyzip + sinatra (1.1.2) + rack (~> 1.1) + tilt (~> 1.2) + tilt (1.2.2) xpath (0.1.3) nokogiri (~> 1.3) @@ -48,3 +52,4 @@ DEPENDENCIES capybara rake rspec + sinatra diff --git a/Rakefile b/Rakefile index f956b43..f086bee 100644 --- a/Rakefile +++ b/Rakefile @@ -56,7 +56,7 @@ task :build => :qmake do end RSpec::Core::RakeTask.new do |t| - t.pattern = "spec/*_spec.rb" + t.pattern = "spec/{*_spec.rb,**/*_spec.rb}" t.rspec_opts = "--format progress" end diff --git a/lib/capybara/driver/webkit/browser.rb b/lib/capybara/driver/webkit/browser.rb index 3f45a56..5bfab16 100644 --- a/lib/capybara/driver/webkit/browser.rb +++ b/lib/capybara/driver/webkit/browser.rb @@ -33,7 +33,7 @@ class Capybara::Driver::Webkit @socket.puts name @socket.puts args.size args.each do |arg| - @socket.puts arg.bytesize + @socket.puts arg.to_s.bytesize @socket.print arg end check diff --git a/spec/integration/driver_spec.rb b/spec/integration/driver_spec.rb new file mode 100644 index 0000000..1dbd21e --- /dev/null +++ b/spec/integration/driver_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' +require 'capybara/driver/webkit' + +describe Capybara::Driver::Webkit do + before do + @driver = Capybara::Driver::Webkit.new(TestApp) + end + + # TODO: select options + # it_should_behave_like "driver" + + # TODO: bug with drag and drop + # it_should_behave_like "driver with javascript support" + + # TODO: needs to reset cookies after each test + # it_should_behave_like "driver with cookies support" + + # Can't support: + # it_should_behave_like "driver with header support" + # it_should_behave_like "driver with status code support" + # it_should_behave_like "driver with frame support" +end diff --git a/spec/integration/session_spec.rb b/spec/integration/session_spec.rb new file mode 100644 index 0000000..cd560d9 --- /dev/null +++ b/spec/integration/session_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' +require 'capybara-webkit' + +describe Capybara::Session do + before do + @session = Capybara::Session.new(:webkit, TestApp) + end + + # TODO: needs to only use one Browser throughout tests + # it_should_behave_like "session" + # it_should_behave_like "session with javascript support" +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2d1628a..7349425 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,3 +8,12 @@ ENV["PATH"] = ENV["PATH"] + ":" + File.join(PROJECT_ROOT, "bin") Dir[File.join(PROJECT_ROOT, 'spec', 'support', '**', '*.rb')].each { |file| require(file) } +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")