This repository has been archived by the owner on Feb 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for Test::Unit & Capybara
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
1 parent
05bdb3b
commit 56950ff
Showing
5 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
39
spec/integration/testunit/test/capybara_integration_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |