File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
lib/selenium/webdriver/common/driver_extensions
spec/unit/selenium/webdriver/common/driver_extensions Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ def network_connection_type
13
13
end
14
14
15
15
def network_connection_type = ( connection_type )
16
+ raise ArgumentError , "Invalid connection type" unless valid_type? connection_type
17
+
16
18
connection_value = type_to_values [ connection_type ]
17
19
18
20
@bridge . setNetworkConnection connection_value
@@ -27,6 +29,10 @@ def type_to_values
27
29
def values_to_type
28
30
type_to_values . invert
29
31
end
32
+
33
+ def valid_type? ( type )
34
+ type_to_values . keys . include? type
35
+ end
30
36
end
31
37
end
32
38
end
Original file line number Diff line number Diff line change @@ -30,6 +30,11 @@ class FakeDriver
30
30
31
31
driver . network_connection_type = :airplane_mode
32
32
end
33
+
34
+ it "returns an error when an invalid argument is given" do
35
+ expect { driver . network_connection_type = :something } .
36
+ to raise_error ( ArgumentError , "Invalid connection type" )
37
+ end
33
38
end
34
39
end
35
40
end
You can’t perform that action at this time.
0 commit comments