-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move integration tests to bash script
- Loading branch information
1 parent
eccf8db
commit 716db46
Showing
6 changed files
with
29 additions
and
108 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 |
---|---|---|
@@ -1,24 +1,9 @@ | ||
defmodule Mix.Tasks.Torch.InstallTest do | ||
use Torch.MixCase | ||
|
||
setup_all :prepare_example_apps | ||
|
||
describe ".run/1" do | ||
setup :clean_generated_files | ||
|
||
test_mix_config_errors("torch.install") | ||
|
||
@tag :integration | ||
test "injects layout template into regular project" do | ||
for format <- @formats do | ||
System.cmd("mix", ["torch.install", "--format", "#{format}"], cd: @project_dir) | ||
|
||
assert File.exists?( | ||
"#{@project_dir}/lib/example_web/templates/layout/torch.html.#{format}" | ||
) | ||
end | ||
end | ||
|
||
# TODO: add test for umbrella project | ||
end | ||
end |
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 |
---|---|---|
@@ -1,27 +1,9 @@ | ||
defmodule Mix.Tasks.Torch.UninstallTest do | ||
use Torch.MixCase | ||
|
||
setup_all :prepare_example_apps | ||
|
||
describe ".run/1" do | ||
setup :clean_generated_files | ||
|
||
test_mix_config_errors("torch.uninstall") | ||
|
||
@tag :integration | ||
test "removes all torch files from regular project if they exist" do | ||
for format <- @formats do | ||
System.cmd("mix", ["torch.install", "--format", "#{format}"], cd: @project_dir) | ||
System.cmd("mix", ["torch.uninstall", "--format", "#{format}"], cd: @project_dir) | ||
|
||
refute File.exists?("#{@project_dir}/priv/templates/phx.gen.html/") | ||
|
||
refute File.exists?( | ||
"#{@project_dir}/lib/example_web/templates/layout/torch.html.#{format}" | ||
) | ||
end | ||
end | ||
|
||
# TODO: add test for umbrella project | ||
end | ||
end |
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,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
mix deps.get || { echo 'Dependencies could not be fetched!'; exit 1; } | ||
MIX_ENV=test mix ecto.drop || { echo 'Database could not be dropped'; exit 1; } | ||
mix torch.install || { echo 'Torch could not be installed!'; exit 1; } | ||
mix torch.gen.html Blog Post posts title:string || { echo 'Torch files not generated!'; exit 1; } | ||
cp ../../routers/modified.ex lib/example_web/router.ex | ||
mix test || { echo 'Tests failed!'; exit 1; } | ||
|
||
# Clean up generated files | ||
rm -rf priv/templates | ||
rm -rf priv/repo/migrations/*.exs | ||
rm -rf lib/example/blog | ||
rm -rf test/example/blog | ||
rm -rf lib/example_web/controllers/post_controller.ex | ||
rm -rf lib/example_web/templates/layout/torch.html.eex | ||
rm -rf lib/example_web/templates/post/ | ||
rm -rf lib/example_web/views/post_view.ex | ||
rm -rf test/example_web/controllers/post_controller_test.exs | ||
cp ../../routers/original.ex lib/example_web/router.ex | ||
|
||
echo 'Tests succeeded!' | ||
exit 0 |
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