forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rails#52705 from thejonroberts/devcontainer-genera…
…tor-dev-flag-error Fix Devcontainer generator with --dev option path error
- Loading branch information
Showing
3 changed files
with
44 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# frozen_string_literal: true | ||
|
||
require "generators/generators_test_helper" | ||
require "rails/generators/rails/devcontainer/devcontainer_generator" | ||
|
||
module Rails | ||
module Generators | ||
class DevcontainerGeneratorTest < Rails::Generators::TestCase | ||
include GeneratorsTestHelper | ||
|
||
def test_generates_devcontainer_files | ||
run_generator | ||
|
||
assert_file ".devcontainer/compose.yaml" | ||
assert_file ".devcontainer/Dockerfile" | ||
assert_file ".devcontainer/devcontainer.json" | ||
end | ||
|
||
def test_default_json_has_no_mounts | ||
run_generator | ||
|
||
assert_devcontainer_json_file do |devcontainer_config| | ||
assert_nil devcontainer_config["mounts"] | ||
end | ||
end | ||
|
||
def test_dev_option_devcontainer_json_mounts_local_rails | ||
run_generator ["--dev"] | ||
|
||
assert_devcontainer_json_file do |devcontainer_json| | ||
mounts = devcontainer_json["mounts"].sole | ||
|
||
assert_equal "bind", mounts["type"] | ||
assert_equal Rails::Generators::RAILS_DEV_PATH, mounts["source"] | ||
assert_equal Rails::Generators::RAILS_DEV_PATH, mounts["target"] | ||
end | ||
end | ||
end | ||
end | ||
end |