|
1 |
| - |
2 |
| -require 'java' |
3 |
| - |
4 | 1 | target = File.expand_path('target', "#{File.dirname(__FILE__)}/../../..")
|
5 | 2 | jars = File.exist?(lib = "#{target}/lib") && ( Dir.entries(lib) - [ '.', '..' ] )
|
6 | 3 | raise "missing .jar dependencies please run `rake test_prepare'" if ! jars || jars.empty?
|
7 | 4 | $CLASSPATH << File.expand_path('classes', target)
|
8 | 5 | $CLASSPATH << File.expand_path('test-classes', target)
|
9 | 6 | jars.each { |jar| $CLASSPATH << File.expand_path(jar, lib) }
|
10 | 7 |
|
11 |
| -puts "using JRuby #{JRUBY_VERSION} (#{RUBY_VERSION})" |
12 |
| - |
13 | 8 | java_import 'javax.servlet.http.HttpServletRequest'
|
14 | 9 | java_import 'javax.servlet.http.HttpServletResponse'
|
15 | 10 |
|
@@ -171,30 +166,28 @@ def should_not_eval_as_nil(code, runtime = @runtime) # alias
|
171 | 166 | end
|
172 | 167 |
|
173 | 168 | # current 'library' environment (based on appraisals) e.g. :rails72
|
174 |
| -CURRENT_LIB = defined?(Rails::VERSION) ? |
175 |
| - :"rails#{Rails::VERSION::MAJOR}#{Rails::VERSION::MINOR}" : :stub |
| 169 | +CURRENT_LIB = defined?(Rails::VERSION) ? :"rails#{Rails::VERSION::MAJOR}#{Rails::VERSION::MINOR}" : :stub |
| 170 | + |
| 171 | +puts "using JRuby #{JRUBY_VERSION} (#{RUBY_VERSION}) CURRENT_LIB: #{CURRENT_LIB.inspect}" |
176 | 172 |
|
177 | 173 | RSpec.configure do |config|
|
178 | 174 |
|
179 | 175 | config.include SharedHelpers
|
180 | 176 |
|
181 |
| - config.before :each do |
| 177 | + config.before(:each) do |
182 | 178 | @env_save = ENV.to_hash
|
183 | 179 | mock_servlet_context
|
184 | 180 | end
|
185 | 181 |
|
186 |
| - config.after :each do |
| 182 | + config.after(:each) do |
187 | 183 | (ENV.keys - @env_save.keys).each {|k| ENV.delete k}
|
188 | 184 | @env_save.each {|k,v| ENV[k] = v}
|
189 | 185 | Dir.chdir(WD_START) unless Dir.getwd == WD_START
|
190 | 186 | $servlet_context = nil if defined? $servlet_context
|
191 | 187 | end
|
192 | 188 |
|
193 |
| - config.filter_run_excluding :lib => lambda { |lib| |
194 |
| - return false if lib.nil? # no :lib => specified run with all |
195 |
| - lib = lib.is_a?(Array) ? lib : [ lib ] |
196 |
| - return ! lib.include?(CURRENT_LIB) |
197 |
| - } |
| 189 | + # NOTE: only works when no other example filtering is in place: e.g. `rspec ... --example=logger` won't filter here |
| 190 | + config.filter_run_excluding lib: lambda { |lib| lib.nil? ? false : !Array(lib).include?(CURRENT_LIB) } |
198 | 191 |
|
199 | 192 | config.backtrace_exclusion_patterns = [
|
200 | 193 | /bin\//,
|
|
0 commit comments