spec/support/shared/element/capabilities/with_dom.rb in arachni-1.0.6 vs spec/support/shared/element/capabilities/with_dom.rb in arachni-1.1

- old
+ new

@@ -1,15 +1,62 @@ shared_examples_for 'with_dom' do |html = nil| let(:with_dom) do dupped = subject.dup - dupped.html = html + dupped.source = html if dupped.respond_to?( :source= ) # It is lazy-loaded. dupped.dom dupped end + describe '#skip_dom' do + context 'when' do + context true do + before do + with_dom.skip_dom = true + end + + it 'forces #dom to return nil' do + with_dom.dom.should be_nil + end + end + + context false do + before do + with_dom.skip_dom = false + end + + it 'forces #dom to return nil' do + with_dom.dom.should be_true + end + end + end + end + + describe '#skip_dom?' do + context 'when #skip_dom is' do + context true do + before do + with_dom.skip_dom = true + end + + it 'returns true' do + with_dom.skip_dom?.should be_true + end + end + + context false do + before do + with_dom.skip_dom = false + end + + it 'forces #dom to return nil' do + with_dom.skip_dom?.should be_false + end + end + end + end describe '#to_rpc_data' do let(:data) { with_dom.to_rpc_data } it "includes 'dom'" do data['dom'].should == with_dom.dom.to_rpc_data @@ -23,11 +70,13 @@ it "restores 'dom'" do restored.dom.should == with_dom.dom end end - it "returns #{described_class::DOM}" do - with_dom.dom.should be_kind_of described_class::DOM + describe '#dom' do + it "returns #{described_class::DOM}" do + with_dom.dom.should be_kind_of described_class::DOM + end end describe '#dup' do let(:dupped) { with_dom.dup }