Codebase list ruby-cms-scanner / d2d4499
New upstream version 0.5.4 Sophie Brun 4 years ago
3 changed file(s) with 28 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
4747 each(&:run)
4848 end
4949 ensure
50 NS::Browser.instance.hydra.abort
50 # The rescue is there to prevent unfinished requests to raise an error, which would prevent
51 # the reverse_each to run
52 # rubocop:disable Style/RescueModifier
53 NS::Browser.instance.hydra.abort rescue nil
54 # rubocop:enable Style/RescueModifier
5155
5256 # Reverse is used here as the app/controllers/core#after_scan finishes the output
5357 # and must be the last one to be executed. It also guarantee that stats will be output
11
22 # Version
33 module CMSScanner
4 VERSION = '0.5.3'
4 VERSION = '0.5.4'
55 end
113113 end
114114 end
115115 end
116
117 context 'when an error is raised by abort' do
118 it 'ignores it and runs the after_scan methods of each controller' do
119 spec = controller_mod::Spec.new
120 base = controller_mod::Base.new
121
122 controllers << base << spec
123
124 # Needed otherwise the default_argv is taken from rspec
125 # (@default_argv=["--pattern", "spec/**{,/*/**}/*_spec.rb"]>)
126 expect(controllers.option_parser).to receive(:results).and_return({})
127
128 [base, spec].each { |c| expect(c).to receive(:before_scan).ordered }
129 [base, spec].each { |c| expect(c).to receive(:run).ordered }
130
131 expect_any_instance_of(Typhoeus::Hydra).to receive(:abort).and_raise('Should be Ignored')
132
133 [spec, base].each { |c| expect(c).to receive(:after_scan).ordered }
134
135 controllers.run
136 end
137 end
116138 end
117139
118140 describe '#register_options_files' do