# Remove items from the common Gemfile that we don't need for this
# test run. This also requires handling some gemspecs.
sed -i -e "/\(system_timer\|sdoc\|w3c_validators\|pg\|execjs\|jquery-rails\|'mysql'\|journey\|ruby-prof\|stackprof\|benchmark-ips\|kindlerb\|turbolinks\|coffee-rails\|debugger\|sprockets-rails\|redcarpet\|bcrypt\|uglifier\|sprockets\|stackprof\)/ s:^:#:"\
-e '/:job/,/end/ s:^:#:'\
-e '/group :doc/,/^end/ s:^:#:' ../Gemfile || die
rm ../Gemfile.lock || die
sed -e '1i gem "activemodel", "~> 5.2.0"'\
-e '1i gem "actionview", "~> 5.2.0"'\
-e '1i gem "railties", "~> 5.2.0"'\
-i test/abstract_unit.rb || die
# Use different timezone notation, this changed at some point due to an external dependency changing.
sed -i -e 's/-0000/GMT/' test/dispatch/response_test.rb test/dispatch/cookies_test.rb test/dispatch/session/cookie_store_test.rb || die
# Avoid broken tests already fixed upstream
sed -i -e '/cookie syntax resilience/askip "broken test"' test/dispatch/request_test.rb || die
sed -i -e '/test_keeps_original_headers_behavior/askip "broken test"' test/dispatch/ssl_test.rb || die