-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,6 +213,52 @@ class << self | |
project.remove("config/application.rb") | ||
end | ||
|
||
it "must generate a .gitattributes file in the output folder" do | ||
foo = mock_gem("foo", "0.0.1") do | ||
write("lib/foo.rb", FOO_RB) | ||
end | ||
|
||
@project.require_mock_gem(foo) | ||
@project.bundle_install | ||
result = @project.tapioca("gem foo --outdir output") | ||
|
||
assert_stdout_includes(result, <<~OUT) | ||
Compiled foo | ||
OUT | ||
|
||
assert_empty_stderr(result) | ||
assert_success_status(result) | ||
|
||
assert_project_file_equal("output/.gitattributes", <<~CONTENT) | ||
**/*.rbi linguist-generated=true | ||
CONTENT | ||
ensure | ||
@project.remove("output") | ||
end | ||
|
||
it "must not generate a .gitattributes file if the output folder is not created" do | ||
foo = mock_gem("foo", "0.0.1") do | ||
write("lib/foo.rb", FOO_RB) | ||
end | ||
|
||
@project.require_mock_gem(foo) | ||
@project.bundle_install | ||
|
||
# Generate for `foo` but exclude it as well, so that we don't create the output folder | ||
result = @project.tapioca("gem foo --outdir output --exclude foo") | ||
|
||
assert_stdout_includes(result, <<~OUT) | ||
Nothing to do. | ||
OUT | ||
|
||
assert_empty_stderr(result) | ||
assert_success_status(result) | ||
|
||
refute_project_file_exist("output/.gitattributes") | ||
ensure | ||
@project.remove("output") | ||
end | ||
|
||
it "must generate a single gem RBI" do | ||
foo = mock_gem("foo", "0.0.1") do | ||
write("lib/foo.rb", FOO_RB) | ||
|
@@ -1598,6 +1644,20 @@ def baz; end | |
@project.remove("../gems") | ||
end | ||
|
||
it "must generate a .gitattributes file in the output folder" do | ||
result = @project.tapioca("gem --outdir output") | ||
|
||
assert_stdout_includes(result, "create output/[email protected]") | ||
assert_empty_stderr(result) | ||
assert_success_status(result) | ||
|
||
assert_project_file_equal("output/.gitattributes", <<~CONTENT) | ||
**/*.rbi linguist-generated=true | ||
CONTENT | ||
ensure | ||
@project.remove("output") | ||
end | ||
|
||
it "must perform no operations if everything is up-to-date" do | ||
@project.write("sorbet/rbi/gems/[email protected]") | ||
@project.write("sorbet/rbi/gems/[email protected]") | ||
|