spec/unit/selector_builder/element_spec.rb in watir-7.2.2 vs spec/unit/selector_builder/element_spec.rb in watir-7.3.0
- old
+ new
@@ -664,12 +664,11 @@
context 'with generic element scope' do
let(:query_scope) { instance_double Watir::HTMLElement }
let(:scope_built) { {xpath: ".//*[local-name()='div'][@id='table-rows-test']"} }
before do
- allow(query_scope).to receive(:selector_builder).and_return(selector_builder)
- allow(query_scope).to receive(:browser).and_return(browser)
+ allow(query_scope).to receive_messages(selector_builder: selector_builder, browser: browser)
allow(selector_builder).to receive(:built).and_return(scope_built)
end
it 'uses scope' do
selector = {tag_name: 'div'}
@@ -740,11 +739,10 @@
it 'does not use scope if query scope is an IFrame' do
query_scope = instance_double Watir::IFrame
selector_builder = described_class.new(attributes, query_scope)
allow(selector_builder).to receive(:built).and_return(scope_built)
- allow(query_scope).to receive(:selector_builder).and_return(selector_builder)
- allow(query_scope).to receive(:browser).and_return(browser)
+ allow(query_scope).to receive_messages(selector_builder: selector_builder, browser: browser)
allow(query_scope).to receive(:is_a?).with(Watir::Browser).and_return(false)
allow(query_scope).to receive(:is_a?).with(Watir::ShadowRoot).and_return(false)
allow(query_scope).to receive(:is_a?).with(Watir::IFrame).and_return(true)
selector = {tag_name: 'div'}