Sha256: 8fe2ff6e94fecd4f51920df591b6befbd617149f734f388de8a90de2d8ab649d
Contents?: true
Size: 1.44 KB
Versions: 3
Compression:
Stored size: 1.44 KB
Contents
require 'spec_helper' describe Mohawk::Adapters::UiaAdapter::Control do let(:adapter) { double(window: window) } let(:window) { double(element: parent) } let(:parent) { double(find: element) } let(:element) { double('uia element') } def new_control(locator) Mohawk::Adapters::UiaAdapter::Control.new adapter, locator end Given(:control) { new_control(id: 'whatever') } context 'working with the element directly' do context 'passes through if it can' do When { expect(element).to receive(:bounding_rectangle).and_return [1, 2, 3, 4] } Then { expect(control.bounding_rectangle).to eq [1, 2, 3, 4] } end context 'fails otherwise' do When(:bad_method) { control.does_not_have } Then { expect(bad_method).to have_failed NoMethodError } end end class HasPattern < Mohawk::Adapters::UiaAdapter::Control valid_patterns :this, :that end context '#patterns' do Given { allow(parent).to receive(:find) {|l| @locator = l } } Given(:no_filter) { new_control(id: 'hi') } Given(:some_filter) { HasPattern.new adapter, id: 'hi' } Given(:overridden) { HasPattern.new adapter, id: 'hi', pattern: :overridden } def pattern(control) control.exist? @locator.delete(:pattern) end Then { pattern(no_filter) == nil } Then { pattern(some_filter) == [:this, :that] } Then { pattern(overridden) == :overridden } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mohawk-1.0 | spec/lib/mohawk/adapters/uia/control_spec.rb |
mohawk-0.4.4 | spec/lib/mohawk/adapters/uia/control_spec.rb |
mohawk-0.4.3 | spec/lib/mohawk/adapters/uia/control_spec.rb |