spec/arachni/page/dom/transition_spec.rb in arachni-1.3.2 vs spec/arachni/page/dom/transition_spec.rb in arachni-1.4

- old
+ new

@@ -34,21 +34,21 @@ expect(restored.send( attribute )).to eq(subject.send( attribute )) end end context 'when the element is a' do - context Symbol do + context 'Symbol' do it 'restores it' do original = described_class.new( :page, :load ) data = Arachni::RPC::Serializer.rpc_data( original ) restored = described_class.from_rpc_data( data ) expect(restored.element).to eq(original.element) end end - context Arachni::Browser::ElementLocator do + context 'Arachni::Browser::ElementLocator' do it 'restores it' do element = Arachni::Browser::ElementLocator.from_html( '<div id="my-div" onclick="addForm();">' ) @@ -95,11 +95,11 @@ it 'marks the transition as finished' do called = false t = described_class.new :page, :load do called = true - sleep 1 + sleep 1.1 end expect(called).to be_truthy expect(t.time).to be > 1 expect(t).to be_completed @@ -147,11 +147,11 @@ it 'marks the transition as finished' do called = false t = empty_transition.start :page, :load do called = true - sleep 1 + sleep 1.1 end expect(called).to be_truthy expect(t.time).to be > 1 expect(t).to be_completed @@ -162,18 +162,18 @@ expect(empty_transition.start( :page, :load ){}).to be empty_transition end end context 'when the element is' do - context String do + context 'String' do it 'assigns it to #element' do empty_transition.start 'http://test.com/stuff', :request expect(empty_transition.element).to eq('http://test.com/stuff') end end - context Symbol do + context 'Symbol' do it 'assigns it to #element' do empty_transition.start :page, :load expect(empty_transition.element).to eq(:page) end end @@ -204,11 +204,11 @@ end describe '#complete' do it 'sets the #time' do running = Factory[:running_transition] - sleep 1 + sleep 1.1 expect(running.complete.time).to be > 1 end it 'marks it as completed' do expect(running_transition.complete).to be_completed @@ -235,11 +235,11 @@ end end describe '#depth' do context 'when the event is' do - context :request do + context ':request' do it 'returns 0' do expect(empty_transition.start( 'http://test/', :request ).depth).to eq(0) end end @@ -301,11 +301,18 @@ end end context 'when the transition has completed' do it 'returns the time it took for the transition' do - expect(completed_transition).not_to be_running - expect(completed_transition.time).to be > 0 + expect(empty_transition).not_to be_running + + t = empty_transition.start :page, :load do + sleep 1.1 + end + + expect(t.time).to be > 1 + expect(t).to be_completed + expect(t).not_to be_running end end end describe '#time=' do