]> git.openstreetmap.org Git - rails.git/blob - test/application_system_test_case.rb
Merge pull request #2464 from hikemaniac/fix-comment-textarea
[rails.git] / test / application_system_test_case.rb
1 require "test_helper"
2 require "capybara/poltergeist"
3
4 # Work around weird debian/ubuntu phantomjs
5 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=817277
6 # https://github.com/ariya/phantomjs/issues/14376
7 ENV["QT_QPA_PLATFORM"] = "phantom" if IO.popen(["phantomjs", "--version"], :err => :close).read.empty?
8
9 ActiveSupport.on_load(:action_dispatch_system_test_case) do
10   ActionDispatch::SystemTesting::Server.silence_puma = true
11 end
12
13 class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
14   driven_by :poltergeist, :screen_size => [1400, 1400], :options => { :timeout => 120 }
15
16   def initialize(*args)
17     stub_request(:get, "https://api.hostip.info/country.php?ip=127.0.0.1")
18       .to_return(:status => 404)
19     super(*args)
20   end
21
22   # Phantomjs can pick up browser Accept-Language preferences from your desktop environment.
23   # We don't want this to happen during the tests!
24   setup do
25     page.driver.add_headers("Accept-Language" => "en")
26   end
27 end