Skip to content

Commit

Permalink
Refs #37825 - Enable bootsnap for test, disable reloading for integra…
Browse files Browse the repository at this point in the history
…tional
  • Loading branch information
ofedoren committed Oct 31, 2024
1 parent 466865f commit 472ad12
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions bin/spring
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion config/boot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions test/integration/hostgroup_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion test/integration/org_admin_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 472ad12

Please sign in to comment.