diff --git a/bin/spring b/bin/spring index 7fe232c3aae..c2ee6ba19c1 100755 --- a/bin/spring +++ b/bin/spring @@ -2,8 +2,7 @@ # This file loads spring without using Bundler, in order to be fast. # It gets overwritten when you run the `spring binstub` command. - -unless defined?(Spring) +if !defined?(Spring) && ARGV.grep(/test\/integration/).empty? # Disable spring for integration test require 'rubygems' require 'bundler' diff --git a/config/boot.rb b/config/boot.rb index 77d8aa1d777..37ccc74b87b 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -5,5 +5,5 @@ # Set up boootsnap on Ruby 2.3+ in development env with Bundler enabled and development group early_env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development" require 'active_support/dependencies' - require('bootsnap/setup') if early_env == "development" && File.exist?(ENV['BUNDLE_GEMFILE']) && !Gem::Specification.stubs_for("bootsnap").empty? + require('bootsnap/setup') if %w[development test].include?(early_env) && File.exist?(ENV['BUNDLE_GEMFILE']) && !Gem::Specification.stubs_for("bootsnap").empty? end diff --git a/config/environments/test.rb b/config/environments/test.rb index 83ee4b560b2..c3d6dafaad4 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -10,7 +10,8 @@ # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! - config.cache_classes = false + # Disable reloading for integration tests + config.cache_classes = ARGV.grep(/test\/integration/).any? config.eager_load = true diff --git a/test/integration/hostgroup_js_test.rb b/test/integration/hostgroup_js_test.rb index 7873e90fba7..1ef4dca91ac 100644 --- a/test/integration/hostgroup_js_test.rb +++ b/test/integration/hostgroup_js_test.rb @@ -23,8 +23,9 @@ class HostgroupJSTest < IntegrationTestWithJavascript select2 os.ptables.first.name, :from => 'hostgroup_ptable_id' fill_in 'hostgroup_root_pass', :with => '12345678' click_button 'Submit' - - hostgroup = Hostgroup.where(:name => "myhostgroup1").first + hostgroup = wait_for do + Hostgroup.where(:name => "myhostgroup1").first + end refute_nil hostgroup assert_equal os.id, hostgroup.operatingsystem_id assert page.has_current_path? hostgroups_path diff --git a/test/integration/org_admin_js_test.rb b/test/integration/org_admin_js_test.rb index f6794fa6ea9..224f2c3063a 100644 --- a/test/integration/org_admin_js_test.rb +++ b/test/integration/org_admin_js_test.rb @@ -95,7 +95,9 @@ def test_org_admin_tries_to_create_domain_when_unselect_the_organization ensure_selected_option_of_multiselect(@org1.name, select_id: 'domain_organization_ids') page.click_button 'Submit' - created_domain = Domain.unscoped.find_by_name(domain.name) + created_domain = wait_for do + Domain.unscoped.find_by_name(domain.name) + end # sets the only organization anyway assert_equal [@org1], created_domain.organizations end