From 7901ae13a1d8187c1b620b51df7d840818fd759d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez=20de=20Dios?= Date: Tue, 8 Apr 2014 20:55:23 +0200 Subject: Keep debugger support only for rubies < 2.0.0 --- railties/test/commands/console_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'railties/test') diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb index a34beaedb3..87c5527b81 100644 --- a/railties/test/commands/console_test.rb +++ b/railties/test/commands/console_test.rb @@ -22,11 +22,11 @@ class Rails::ConsoleTest < ActiveSupport::TestCase def test_debugger_option console = Rails::Console.new(app, parse_arguments(["--debugger"])) assert console.debugger? - end + end if RUBY_VERSION < '2.0.0' def test_no_options console = Rails::Console.new(app, parse_arguments([])) - assert !console.debugger? + assert !console.debugger? if RUBY_VERSION < '2.0.0' assert !console.sandbox? end @@ -41,7 +41,7 @@ class Rails::ConsoleTest < ActiveSupport::TestCase rails_console.expects(:require_debugger).returns(nil) silence_stream(STDOUT) { rails_console.start } - end + end if RUBY_VERSION < '2.0.0' def test_start_with_sandbox app.expects(:sandbox=).with(true) -- cgit v1.2.3 From d8a4e482202bc8d42a16b2311598d49d34304bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez=20de=20Dios?= Date: Tue, 8 Apr 2014 20:57:12 +0200 Subject: Update Gemfile templates to provide correct debugger --- railties/test/generators/app_generator_test.rb | 7 +++++-- railties/test/generators/plugin_generator_test.rb | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'railties/test') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 8e1aeddb2b..68b71e9927 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -305,14 +305,17 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_file "Gemfile", /gem 'jbuilder'/ end - def test_inclusion_of_debugger + def test_inclusion_of_a_debugger run_generator if defined?(JRUBY_VERSION) assert_file "Gemfile" do |content| + assert_no_match(/byebug/, content) assert_no_match(/debugger/, content) end - else + elsif RUBY_VERSION < '2.0.0' assert_file "Gemfile", /# gem 'debugger'/ + else + assert_file "Gemfile", /# gem 'byebug'/ end end diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index 7a2701f813..853af80111 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -64,14 +64,17 @@ class PluginGeneratorTest < Rails::Generators::TestCase assert_file "test/integration/navigation_test.rb", /ActionDispatch::IntegrationTest/ end - def test_inclusion_of_debugger + def test_inclusion_of_a_debugger run_generator [destination_root, '--full'] if defined?(JRUBY_VERSION) assert_file "Gemfile" do |content| + assert_no_match(/byebug/, content) assert_no_match(/debugger/, content) end - else + elsif RUBY_VERSION < '2.0.0' assert_file "Gemfile", /# gem 'debugger'/ + else + assert_file "Gemfile", /# gem 'byebug'/ end end -- cgit v1.2.3 From 6fae9ac58147948474c3fa472f0eb04525737d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez=20de=20Dios?= Date: Thu, 10 Apr 2014 16:02:13 +0200 Subject: Isolate debugger related code --- railties/test/commands/console_test.rb | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'railties/test') diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb index 87c5527b81..1273f9d4c2 100644 --- a/railties/test/commands/console_test.rb +++ b/railties/test/commands/console_test.rb @@ -19,14 +19,8 @@ class Rails::ConsoleTest < ActiveSupport::TestCase assert console.sandbox? end - def test_debugger_option - console = Rails::Console.new(app, parse_arguments(["--debugger"])) - assert console.debugger? - end if RUBY_VERSION < '2.0.0' - def test_no_options console = Rails::Console.new(app, parse_arguments([])) - assert !console.debugger? if RUBY_VERSION < '2.0.0' assert !console.sandbox? end @@ -36,13 +30,6 @@ class Rails::ConsoleTest < ActiveSupport::TestCase assert_match(/Loading \w+ environment \(Rails/, output) end - def test_start_with_debugger - rails_console = Rails::Console.new(app, parse_arguments(["--debugger"])) - rails_console.expects(:require_debugger).returns(nil) - - silence_stream(STDOUT) { rails_console.start } - end if RUBY_VERSION < '2.0.0' - def test_start_with_sandbox app.expects(:sandbox=).with(true) FakeConsole.expects(:start) @@ -52,6 +39,25 @@ class Rails::ConsoleTest < ActiveSupport::TestCase assert_match(/Loading \w+ environment in sandbox \(Rails/, output) end + if RUBY_VERSION < '2.0.0' + def test_debugger_option + console = Rails::Console.new(app, parse_arguments(["--debugger"])) + assert console.debugger? + end + + def test_no_options_does_not_set_debugger_flag + console = Rails::Console.new(app, parse_arguments([])) + assert !console.debugger? + end + + def test_start_with_debugger + rails_console = Rails::Console.new(app, parse_arguments(["--debugger"])) + rails_console.expects(:require_debugger).returns(nil) + + silence_stream(STDOUT) { rails_console.start } + end + end + def test_console_with_environment start ["-e production"] assert_match(/\sproduction\s/, output) -- cgit v1.2.3 From f612c2b0526e326eb6c25a7bbf375ac3ac793a3c Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Fri, 11 Apr 2014 02:28:35 +0930 Subject: Move assets precompile (and version) to an initializer sprockets-rails 2.1 needs the precompile list to be available in all environments. --- railties/test/generators/app_generator_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/test') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 8e1aeddb2b..b7bc721247 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -237,6 +237,7 @@ class AppGeneratorTest < Rails::Generators::TestCase def test_generator_if_skip_sprockets_is_given run_generator [destination_root, "--skip-sprockets"] + assert_no_file "config/initializers/assets.rb" assert_file "config/application.rb" do |content| assert_match(/#\s+require\s+["']sprockets\/railtie["']/, content) end @@ -252,7 +253,6 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_no_match(/config\.assets\.digest = true/, content) assert_no_match(/config\.assets\.js_compressor = :uglifier/, content) assert_no_match(/config\.assets\.css_compressor = :sass/, content) - assert_no_match(/config\.assets\.version = '1\.0'/, content) end end -- cgit v1.2.3