Permalink
Browse files

Ensure mix test works on a new app

  • Loading branch information...
1 parent 80ce757 commit 25d40ef2b22364b9173579772a491079538b8023 @josevalim josevalim committed Sep 6, 2012
Showing with 32 additions and 3 deletions.
  1. +32 −3 test/mix/tasks_test.exs
View
@@ -57,8 +57,29 @@ defmodule Mix.TasksTest do
in_tmp "my_run_app", fn ->
app_with_dynamo_deps_path
- output = System.cmd %b{mix run "IO.inspect ApplicationRouter.__info__(:self)"}
- assert output =~ %r(ApplicationRouter)
+ output = System.cmd %b{mix run "IO.inspect HelloRouter.__info__(:self)"}
+ assert output =~ %r(HelloRouter)
+ end
+ end
+
+ test "tests application code" do
+ in_tmp "my_test_app", fn ->
+ app_with_dynamo_deps_path
+
+ File.write! "test/routers/hello_router_test.exs", """
+ Code.require_file "../../test_helper.exs", __FILE__
+
+ defmodule HelloRouterTest do
+ use ExUnit.Case
+
+ test "hello router is autoloaded" do
+ assert HelloRouter.__info__(:self)
+ end
+ end
+ """
+
+ output = System.cmd %b{mix test}
+ assert output =~ %r(3 tests, 0 failures)
end
end
@@ -78,6 +99,14 @@ defmodule Mix.TasksTest do
defp app_with_dynamo_deps_path do
Mix.Tasks.Dynamo.run [".", "--dev"]
File.cp! "../../mix.lock", "mix.lock"
- File.write! "mix.exs", Regex.replace(%r"deps: deps", File.read!("mix.exs"), %b(deps: deps, deps_path: "../../deps"))
+
+ File.write! "mix.exs",
+ Regex.replace(%r"deps: deps", File.read!("mix.exs"), %b(deps: deps, deps_path: "../../deps"))
+
+ File.write! "app/routers/hello_router.ex", """
+ defmodule HelloRouter do
+ use Dynamo.Router
+ end
+ """
end
end

0 comments on commit 25d40ef

Please sign in to comment.