forked from simplecov-ruby/simplecov
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.rb
More file actions
52 lines (42 loc) · 1.48 KB
/
env.rb
File metadata and controls
52 lines (42 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true
if RUBY_VERSION < "1.9"
$stderr.puts "Sorry, Cucumber features are only meant to run on Ruby 1.9+ :("
exit 0
end
require "bundler"
Bundler.setup
require "aruba/cucumber"
require "aruba/config/jruby" if RUBY_ENGINE == "jruby"
require_relative "aruba_freedom_patch"
require "capybara/cucumber"
require "phantomjs/poltergeist"
# Fake rack app for capybara that just returns the latest coverage report from aruba temp project dir
Capybara.app = lambda { |env|
request_path = env["REQUEST_PATH"] || "/"
request_path = "/index.html" if request_path == "/"
[
200,
{"Content-Type" => "text/html"},
[File.read(File.join(File.dirname(__FILE__), "../../tmp/aruba/project/coverage", request_path))],
]
}
Capybara.default_driver = Capybara.javascript_driver = :poltergeist
Capybara.configure do |config|
config.ignore_hidden_elements = false
end
Before do
# JRuby takes it's time... See https://github.com/cucumber/aruba/issues/134
@aruba_timeout_seconds = RUBY_ENGINE == "jruby" ? 60 : 20
this_dir = File.dirname(__FILE__)
# Clean up and create blank state for fake project
cd(".") do
FileUtils.rm_rf "project"
FileUtils.cp_r File.join(this_dir, "../../spec/faked_project/"), "project"
end
step 'I cd to "project"'
end
# Workaround for https://github.com/cucumber/aruba/pull/125
Aruba.configure do |config|
config.exit_timeout = RUBY_ENGINE == "jruby" ? 60 : 20
config.command_runtime_environment = {"JRUBY_OPTS" => "--dev --debug"}
end