Sha256: b96cd6c96cce891857ba06cdcafda040a7d5e00a655fbebe2649f36668dbd2b7

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

# tests for ability to set defaults for Watir
# revision: $Revision: 1319 $
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
require 'test/unit'
require 'watir'

class TC_instance_options < Test::Unit::TestCase
  
  def test_using_default
    @ie1 = Watir::IE.new
    @ie1.speed = :fast
    assert_equal(:fast, @ie1.speed)
    @ie1.speed = :slow
    assert_equal(:slow, @ie1.speed)
    assert_raise(ArgumentError){@ie1.speed = :fubar}
  end

  def teardown
    @ie1.close if @ie1
  end
end

class TC_class_options < Test::Unit::TestCase
	include Watir
	@@hide_ie = $HIDE_IE
	def setup
		@previous = IE.defaults
	end
	def test_class_defaults
		assert_equal({:speed => :slow, :visible => ! @@hide_ie}, IE.defaults)
	end
	def test_change_defaults
		IE.defaults = {:speed => :fast}
		assert_equal(:fast, IE.speed)
		IE.defaults = {:visible => false}
		assert_equal(false, IE.visible)
		IE.defaults = {:speed => :slow}
		assert_equal(:slow, IE.speed)
		IE.defaults = {:visible => true}
		assert_equal(true, IE.visible)
	end
	def test_defaults_affect_on_instance
		IE.defaults = {:speed => :fast}
		@ie1 = IE.new
		assert_equal(:fast, @ie1.speed)
		IE.defaults = {:speed => :slow}
		@ie2 = IE.new
		assert_equal(:slow, @ie2.speed)
	end
	def teardown
		IE.defaults = @previous
		@ie1.close if @ie1
		@ie2.close if @ie2
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-1.5.5 unittests/speed_settings_test.rb
watir-1.5.6 unittests/speed_settings_test.rb