cherry-pick test and source doc from #20050
This commit is contained in:
parent
ce3d2fa05a
commit
e6be33f1dd
@ -503,6 +503,14 @@ Adds a specified source to `Gemfile`:
|
||||
add_source "http://gems.github.com"
|
||||
```
|
||||
|
||||
This method also takes a block:
|
||||
|
||||
```ruby
|
||||
add_source "http://gems.github.com" do
|
||||
gem "rspec-rails"
|
||||
end
|
||||
```
|
||||
|
||||
### `inject_into_file`
|
||||
|
||||
Injects a block of code into a defined position in your file.
|
||||
|
@ -1,3 +1,7 @@
|
||||
* Adding support for passing a block to the `add_source` action of a custom generator
|
||||
|
||||
*Mike Dalton*, *Hirofumi Wakasugi*
|
||||
|
||||
* `assert_file` understands paths with special characters
|
||||
(eg. `v0.1.4~alpha+nightly`).
|
||||
|
||||
|
@ -47,6 +47,14 @@ def test_add_source_adds_source_to_gemfile
|
||||
assert_file 'Gemfile', /source 'http:\/\/gems\.github\.com'/
|
||||
end
|
||||
|
||||
def test_add_source_with_block_adds_source_to_gemfile_with_gem
|
||||
run_generator
|
||||
action :add_source, 'http://gems.github.com' do
|
||||
gem 'rspec-rails'
|
||||
end
|
||||
assert_file 'Gemfile', /source 'http:\/\/gems\.github\.com' do\n gem 'rspec-rails'\nend/
|
||||
end
|
||||
|
||||
def test_gem_should_put_gem_dependency_in_gemfile
|
||||
run_generator
|
||||
action :gem, 'will-paginate'
|
||||
|
Loading…
Reference in New Issue
Block a user