rails/rails — pull request #3756 by johnmdonahue (2011-11-25 17:31:35+00:00)
Title: Updating newline fix to maintain existing linebreaks and indentation and...

RE: [#3751](https://github.com/rails/rails/pull/3751)

Pull request [#3752](https://github.com/rails/rails/pull/3752) only added a 2 `\n`'s to make the test passing.

This will produce and pass on the following `gem group`:

group :development, :test do

gem "rspec-rails"
end

group :test do

gem "fakeweb"
end

This pull request reverts changes to `test_gem_group_should_wrap_gems_in_a_group` so it expects the original:

group :development, :test do
gem "rspec-rails"
end

group :test do
gem "fakeweb"
end

It also builds on `test_gem_should_insert_on_separate_lines` to actually insert new content without a trailing newline and insure the gems begin on newlines:

File.open('Gemfile', 'a') {|f| f.write('# Some content...') }

...

assert_file 'Gemfile', /^gem "rspec"$/
assert_file 'Gemfile', /^gem "rspec-rails"$/

Let me know if this makes sense. Thanks.