File tree Expand file tree Collapse file tree 1 file changed +6
-24
lines changed Expand file tree Collapse file tree 1 file changed +6
-24
lines changed Original file line number Diff line number Diff line change 11
11
require "capybara/apparition"
12
12
require "simplecov"
13
13
14
- # Fake rack app for capybara that just returns the latest coverage report from aruba temp project dir
15
- Capybara . app = lambda { |env |
16
- request_path = env [ "REQUEST_PATH" ] || "/"
17
- request_path = "/index.html" if request_path == "/"
18
- corresponding_file_path =
19
- File . join ( File . dirname ( __FILE__ ) , "../../tmp/aruba/project/coverage" , request_path )
20
-
21
- content =
22
- if File . exist? ( corresponding_file_path )
23
- File . read ( corresponding_file_path )
24
- else
25
- # See #776 for whatever reason sometimes JRuby in one feature couldn't
26
- # find the loading.gif - which isn't essential so answering empty string
27
- # should be good enough
28
- warn "Couldn't find #{ corresponding_file_path } generating empty response"
29
- ""
30
- end
31
-
32
- [
33
- 200 ,
34
- { "Content-Type" => "text/html" } ,
35
- [ content ]
36
- ]
37
- }
14
+ # Rack app for Capybara which returns the latest coverage report from Aruba temp project dir
15
+ coverage_dir = File . expand_path ( "../../tmp/aruba/project/coverage/" , __dir__ )
16
+ Capybara . app = Rack ::Builder . new do
17
+ use Rack ::Static , urls : { "/" => "index.html" } , root : coverage_dir
18
+ run Rack ::Directory . new ( coverage_dir )
19
+ end . to_app
38
20
39
21
Capybara . configure do |config |
40
22
config . ignore_hidden_elements = false
You can’t perform that action at this time.
0 commit comments