Methods
S
T
Included Modules
Instance Public methods
setup()
# File railties/test/application/runner_test.rb, line 9
def setup
  build_app
  boot_rails

  # Lets create a model so we have something to play with
  app_file "app/models/user.rb", <<-MODEL
  class User
    def self.count
      42
    end
  end
  MODEL
end
teardown()
# File railties/test/application/runner_test.rb, line 23
def teardown
  teardown_app
end
test_default_environment()
# File railties/test/application/runner_test.rb, line 73
def test_default_environment
  assert_match "development", Dir.chdir(app_path) { %x`bundle exec rails runner "puts Rails.env"` }
end
test_environment_with_rack_env()
# File railties/test/application/runner_test.rb, line 83
def test_environment_with_rack_env
  with_rack_env "production" do
    assert_match "production", Dir.chdir(app_path) { %x`bundle exec rails runner "puts Rails.env"` }
  end
end
test_environment_with_rails_env()
# File railties/test/application/runner_test.rb, line 77
def test_environment_with_rails_env
  with_rails_env "production" do
    assert_match "production", Dir.chdir(app_path) { %x`bundle exec rails runner "puts Rails.env"` }
  end
end
test_should_include_runner_in_shebang_line_in_help()
# File railties/test/application/runner_test.rb, line 31
def test_should_include_runner_in_shebang_line_in_help
  assert_match "/rails runner", Dir.chdir(app_path) { %x`bundle exec rails runner --help` }
end
test_should_include_runner_in_shebang_line_in_help_without_option()
# File railties/test/application/runner_test.rb, line 27
def test_should_include_runner_in_shebang_line_in_help_without_option
  assert_match "/rails runner", Dir.chdir(app_path) { %x`bundle exec rails runner` }
end
test_should_run_file()
# File railties/test/application/runner_test.rb, line 39
def test_should_run_file
  app_file "bin/count_users.rb", <<-SCRIPT
  puts User.count
  SCRIPT

  assert_match "42", Dir.chdir(app_path) { %x`bundle exec rails runner "bin/count_users.rb"` }
end
test_should_run_ruby_statement()
# File railties/test/application/runner_test.rb, line 35
def test_should_run_ruby_statement
  assert_match "42", Dir.chdir(app_path) { %x`bundle exec rails runner "puts User.count"` }
end
test_should_set_dollar_0_to_file()
# File railties/test/application/runner_test.rb, line 47
def test_should_set_dollar_0_to_file
  app_file "bin/dollar0.rb", <<-SCRIPT
  puts $0
  SCRIPT

  assert_match "bin/dollar0.rb", Dir.chdir(app_path) { %x`bundle exec rails runner "bin/dollar0.rb"` }
end
test_should_set_dollar_program_name_to_file()
# File railties/test/application/runner_test.rb, line 55
def test_should_set_dollar_program_name_to_file
  app_file "bin/program_name.rb", <<-SCRIPT
  puts $PROGRAM_NAME
  SCRIPT

  assert_match "bin/program_name.rb", Dir.chdir(app_path) { %x`bundle exec rails runner "bin/program_name.rb"` }
end
test_with_hook()
# File railties/test/application/runner_test.rb, line 63
def test_with_hook
  add_to_config <<-RUBY
    runner do |app|
      app.config.ran = true
    end
  RUBY

  assert_match "true", Dir.chdir(app_path) { %x`bundle exec rails runner "puts Rails.application.config.ran"` }
end