1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test/commands/initializers_test.rb
2018-08-16 10:46:11 -04:00

32 lines
903 B
Ruby

# frozen_string_literal: true
require "isolation/abstract_unit"
require "rails/command"
class Rails::Command::InitializersTest < ActiveSupport::TestCase
setup :build_app
teardown :teardown_app
test "`rails initializers` prints out defined initializers invoked by Rails" do
initial_output = run_initializers_command
initial_output_length = initial_output.split("\n").length
assert_operator initial_output_length, :>, 0
assert_not initial_output.include?("set_added_test_module")
add_to_config <<-RUBY
initializer(:set_added_test_module) { }
RUBY
final_output = run_initializers_command
final_output_length = final_output.split("\n").length
assert_equal 1, (final_output_length - initial_output_length)
assert final_output.include?("set_added_test_module")
end
private
def run_initializers_command
rails "initializers"
end
end