Skip to content

Commit

Permalink
Update Gemfile templates to provide correct debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
David Rodríguez de Dios committed Apr 8, 2014
1 parent 7901ae1 commit d8a4e48
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
6 changes: 5 additions & 1 deletion railties/lib/rails/generators/rails/app/templates/Gemfile
Expand Up @@ -23,8 +23,12 @@ source 'https://rubygems.org'
# gem 'capistrano-rails', group: :development

<% unless defined?(JRUBY_VERSION) -%>
# Use debugger
# To use a debugger
<% if RUBY_VERSION < '2.0.0' -%>
# gem 'debugger', group: [:development, :test]
<% else -%>
# gem 'byebug', group: [:development, :test]
<% end -%>
<% end -%>
<% if RUBY_PLATFORM.match(/bccwin|cygwin|emx|mingw|mswin|wince/) -%>
Expand Down
8 changes: 6 additions & 2 deletions railties/lib/rails/generators/rails/plugin/templates/Gemfile
Expand Up @@ -38,6 +38,10 @@ end

<% end -%>
<% unless defined?(JRUBY_VERSION) -%>
# To use debugger
# gem 'debugger'
# To use a debugger
<% if RUBY_VERSION < '2.0.0' -%>
# gem 'debugger', group: [:development, :test]
<% else -%>
# gem 'byebug', group: [:development, :test]
<% end -%>
<% end -%>
7 changes: 5 additions & 2 deletions railties/test/generators/app_generator_test.rb
Expand Up @@ -305,14 +305,17 @@ def test_inclusion_of_jbuilder
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

Expand Down
7 changes: 5 additions & 2 deletions railties/test/generators/plugin_generator_test.rb
Expand Up @@ -64,14 +64,17 @@ def test_generating_test_files_in_full_mode
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

Expand Down

0 comments on commit d8a4e48

Please sign in to comment.