Skip to content

Commit f49be5a

Browse files
author
Philippe Hanrigou
committed
Removing warnings when running unit tests
1 parent 409a0bb commit f49be5a

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

test/unit/selenium/client/extensions_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
test "wait_for_text waits for the page content regexp when no locator is provided" do
1818
client = Class.new { include Selenium::Client::Extensions }.new
1919
client.expects(:wait_for_condition).with(regexp_matches(%r{document.body.innerHTML.match\(/some text/\)}m), anything)
20-
client.wait_for_text /some text/
20+
client.wait_for_text(/some text/)
2121
end
2222

2323
test "wait_for_text uses default timeout when none is provided" do
@@ -41,7 +41,7 @@
4141
test "wait_for_no_text waits for the page content for regexp when no locator is provided" do
4242
client = Class.new { include Selenium::Client::Extensions }.new
4343
client.expects(:wait_for_condition).with(regexp_matches(%r{document.body.innerHTML.match\(/some text/\)}m), anything)
44-
client.wait_for_no_text /some text/
44+
client.wait_for_no_text(/some text/)
4545
end
4646

4747
test "wait_for_no_text waits for the page content when no locator is provided" do
@@ -154,4 +154,4 @@
154154
client.wait_for_no_field_value "a_locator", "a value", :timeout_in_seconds => :the_timeout
155155
end
156156

157-
end
157+
end

test/unit/selenium/client/javascript_expression_builder_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757

5858
test "find_element adds a script to find an element" do
5959
builder = Selenium::Client::JavascriptExpressionBuilder.new
60-
assert_match /element\s+=\s+selenium.browserbot.findElement\('a_locator'\);/m,
61-
builder.find_element('a_locator').script
60+
assert_match(/element\s+=\s+selenium.browserbot.findElement\('a_locator'\);/m,
61+
builder.find_element('a_locator').script)
6262
end
6363

6464
test "javascript_framework_for :prototype returns JavascriptFrameworks::Prototype" do
@@ -78,4 +78,4 @@
7878
assert_raises(RuntimeError) { builder.javascript_framework_for(:unsupported_framework) }
7979
end
8080

81-
end
81+
end

test/unit/selenium/client/protocol_test.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@
44

55
test "remote_control_command return the content of the HTTP response when the command succeeds" do
66
client = Class.new { include Selenium::Client::Protocol }.new
7+
client.instance_variable_set :@default_timeout_in_seconds, 1
78
client.stubs(:http_request_for).with(:a_verb, :some_args).returns(:the_request)
89
client.expects(:http_post).with(:the_request).returns(["OK", "the response"])
910
assert_equal "the response", client.remote_control_command(:a_verb, :some_args)
1011
end
1112

1213
test "remote_control_command raises a SeleniumCommandError when the command fails" do
1314
client = Class.new { include Selenium::Client::Protocol }.new
15+
client.instance_variable_set :@default_timeout_in_seconds, 1
1416
client.stubs(:http_request_for).with(:a_verb, :some_args).returns(:the_request)
1517
client.expects(:http_post).with(:the_request).returns(["ERROR", "the error message"])
1618
assert_raises(SeleniumCommandError) { client.remote_control_command(:a_verb, :some_args) }
1719
end
1820

1921
test "the args are optional for remote_control_command" do
2022
client = Class.new { include Selenium::Client::Protocol }.new
23+
client.instance_variable_set :@default_timeout_in_seconds, 1
2124
client.expects(:http_request_for).with(:a_verb, []).returns(:the_request)
2225
client.stubs(:http_post).with(:the_request).returns(["OK", "the response"])
2326
client.remote_control_command(:a_verb)
@@ -124,4 +127,4 @@
124127
assert_equal "cmd=aCommand&1=This+%26+That", client.send(:http_request_for, "aCommand", [ "This & That" ])
125128
end
126129

127-
end
130+
end

0 commit comments

Comments
 (0)