Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
Added tests for Test::Unit & Capybara
Browse files Browse the repository at this point in the history
Add test::unit test for Capybara not creating its own driver
Add test::unit test for Capybara adding the correct version string
Add test::unit test for Capybara to use the existing driver
  • Loading branch information
DylanLacey committed May 4, 2013
1 parent 05bdb3b commit 56950ff
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 2 deletions.
2 changes: 0 additions & 2 deletions spec/integration/connect_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'spec_helper'
require 'sauce/connect'



describe 'Sauce::Connect integration testing' do
def make_connection
Sauce::Connect.new({})
Expand Down
8 changes: 8 additions & 0 deletions spec/integration/testunit/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://www.rubygems.org"

gem "rake"
gem "mocha", :require => false
gem "capybara", "~> 1.1.2"
gem "rack-test"
gem 'sauce', :path => '../../../'
gem 'sauce-connect'
39 changes: 39 additions & 0 deletions spec/integration/testunit/test/capybara_integration_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require "rubygems"
require "bundler/setup"
require "test/unit"
require "sauce"
require "sauce/capybara"
require "mocha/setup"

Sauce.config do |c|
c[:browsers] = [
["Windows 7", "Firefox", "18"],
["Linux", "Firefox", "17"]
]
end

Capybara.default_driver = :sauce

class CapybaraTestCase < Sauce::TestCase
include Capybara::DSL

def teardown
Capybara.reset_sessions!
Capybara.use_default_driver
end
end

class CapybaraIntegrationTest < CapybaraTestCase

# Called after every test method runs. Can be used to tear
# down fixture information.

def test_driver_is_from_the_driver_pool
assert_equal Capybara.current_session.driver.browser, selenium
end

def test_capybara_does_not_create_a_new_driver
::Sauce::Selenium2.expects(:new).never
visit "http://www.wikipedia.org"
end
end
31 changes: 31 additions & 0 deletions spec/integration/testunit/test/integration_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require "rubygems"
require "bundler/setup"
require "test/unit"
require "sauce"

Sauce.config do |c|
c[:browsers] = [
["Windows 7", "Firefox", "18"]
]
end

class IntegrationTest < Sauce::TestCase

# Called before every test method runs. Can be used
# to set up fixture information.
def setup
# Do nothing
end

# Called after every test method runs. Can be used to tear
# down fixture information.

def teardown

end

def test_testunit_is_set_in_sauce_config
capabilities = Sauce.get_config.to_desired_capabilities
assert_includes capabilities[:client_version], "Test::Unit"
end
end
8 changes: 8 additions & 0 deletions spec/sauce/test_unit_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "spec_helper"

describe "Sauce::Test::Unit" do

it "should add a driver to the pool" do

end
end

0 comments on commit 56950ff

Please sign in to comment.