spec/support/shared/element/capabilities/with_dom.rb in arachni-1.3.2 vs spec/support/shared/element/capabilities/with_dom.rb in arachni-1.4

- old
+ new

@@ -8,21 +8,21 @@ dupped end describe '#skip_dom' do context 'when' do - context true do + context 'true' do before do with_dom.skip_dom = true end it 'forces #dom to return nil' do expect(with_dom.dom).to be_nil end end - context false do + context 'false' do before do with_dom.skip_dom = false end it 'forces #dom to return nil' do @@ -32,21 +32,21 @@ end end describe '#skip_dom?' do context 'when #skip_dom is' do - context true do + context 'true' do before do with_dom.skip_dom = true end it 'returns true' do expect(with_dom.skip_dom?).to be_truthy end end - context false do + context 'false' do before do with_dom.skip_dom = false end it 'forces #dom to return nil' do @@ -73,9 +73,18 @@ end describe '#dom' do it "returns #{described_class::DOM}" do expect(with_dom.dom).to be_kind_of described_class::DOM + end + + context "when #{described_class::DOM}.new raises Inputtable::Error" do + it 'returns nil' do + subject.auditor = nil + + allow(described_class::DOM).to receive(:new) { raise Arachni::Element::Capabilities::Inputtable::Error } + expect(subject.dom).to be_nil + end end end describe '#dup' do let(:dupped) { with_dom.dup }