Skip to content

Commit

Permalink
[rb] test doubles need to accept selected? calls
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Oct 28, 2022
1 parent cc3afbb commit 2293f0c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rb/spec/unit/selenium/webdriver/support/select_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module Support
end

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

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

it 'allows options to be selected by index' do
first_option = instance_double(Element, selected?: true)
second_option = instance_double(Element, selected?: false)
first_option = instance_double(Element, selected?: true, enabled?: true)
second_option = instance_double(Element, selected?: false, enabled?: true)

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

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

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

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

0 comments on commit 2293f0c

Please sign in to comment.