1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #18026 from hbd225/fix_duplicate_web-console_entries

Fix Duplicate web-console entries in Gemfile
This commit is contained in:
Rafael Mendonça França 2014-12-15 14:32:20 -02:00
commit 9d1a405d4a
3 changed files with 22 additions and 10 deletions

View file

@ -111,7 +111,6 @@ module Rails
jbuilder_gemfile_entry,
sdoc_gemfile_entry,
psych_gemfile_entry,
console_gemfile_entry,
@extra_entries].flatten.find_all(&@gem_filter)
end
@ -267,15 +266,6 @@ module Rails
GemfileEntry.new('sdoc', '~> 0.4.0', comment, group: :doc)
end
def console_gemfile_entry
comment = 'Use Rails Console on the Browser'
if options.dev? || options.edge?
GemfileEntry.github 'web-console', 'rails/web-console', nil, comment
else
[]
end
end
def coffee_gemfile_entry
comment = 'Use CoffeeScript for .coffee assets and views'
if options.dev? || options.edge?

View file

@ -32,7 +32,11 @@ group :development, :test do
<%- end -%>
# Access an IRB console on exception pages or by using <%%= console %> in views
<%- if options.dev? || options.edge? -%>
gem 'web-console', github: "rails/web-console"
<%- else -%>
gem 'web-console', '~> 2.0'
<%- end -%>
<%- if spring_install? %>
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'

View file

@ -420,6 +420,24 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_gem 'web-console'
end
def test_web_console_with_dev_option
run_generator [destination_root, "--dev"]
assert_file "Gemfile" do |content|
assert_match(/gem 'web-console',\s+github: "rails\/web-console"/, content)
assert_no_match(/gem 'web-console', '~> 2.0'/, content)
end
end
def test_web_console_with_edge_option
run_generator [destination_root, "--edge"]
assert_file "Gemfile" do |content|
assert_match(/gem 'web-console',\s+github: "rails\/web-console"/, content)
assert_no_match(/gem 'web-console', '~> 2.0'/, content)
end
end
def test_spring
run_generator
assert_gem 'spring'