Skip to content

Commit 2293f0c

Browse files
committed
[rb] test doubles need to accept selected? calls
1 parent cc3afbb commit 2293f0c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

rb/spec/unit/selenium/webdriver/support/select_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ module Support
110110
end
111111

112112
it 'allows options to be selected by visible text' do
113-
option = instance_double(Element, selected?: false)
113+
option = instance_double(Element, selected?: false, enabled?: true)
114114

115115
expect(multi_select).to receive(:find_elements)
116116
.with(xpath: './/option[normalize-space(.) = "fish"]')
@@ -123,8 +123,8 @@ module Support
123123
end
124124

125125
it 'allows options to be selected by index' do
126-
first_option = instance_double(Element, selected?: true)
127-
second_option = instance_double(Element, selected?: false)
126+
first_option = instance_double(Element, selected?: true, enabled?: true)
127+
second_option = instance_double(Element, selected?: false, enabled?: true)
128128

129129
allow(first_option).to receive(:property).with(:index).and_return 0
130130
expect(first_option).not_to receive(:click)
@@ -143,7 +143,7 @@ module Support
143143
end
144144

145145
it 'allows options to be selected by returned value' do
146-
first_option = instance_double(Element, selected?: false)
146+
first_option = instance_double(Element, selected?: false, enabled?: true)
147147
allow(multi_select).to receive(:find_elements)
148148
.with(xpath: './/option[@value = "b"]')
149149
.and_return([first_option])
@@ -224,7 +224,7 @@ module Support
224224
end
225225

226226
it 'should fall back to slow lookups when "get by visible text fails" and there is a space' do
227-
first_option = instance_double(Element, selected?: false, text: 'foo bar')
227+
first_option = instance_double(Element, selected?: false, enabled?: true, text: 'foo bar')
228228

229229
xpath1 = './/option[normalize-space(.) = "foo bar"]'
230230
xpath2 = './/option[contains(., "foo")]'

0 commit comments

Comments
 (0)