Skip to content

Commit

Permalink
Merge pull request #50 from cpursley/fix-mix-tasks
Browse files Browse the repository at this point in the history
Refactor Mix to avoid conflicts.
  • Loading branch information
cpursley committed Feb 15, 2024
2 parents 37963e0 + a87eaad commit 67f4cbd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: docker-compose -f docker-compose.dbs.yml up -d

- name: Set up test data
run: mix set_up_test_database
run: mix walex.setup

- name: Check warnings
run: |
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,15 @@ More destinations coming. Pull requests welcome!

## Test

You'll need a local Postgres setup with:
You'll need a local Postgres instance running

hostname: "localhost", username: "postgres", password: "postgres"
```bash
MIX_ENV=test mix walex.setup
MIX_ENV=test mix test
```

## Help?

I would love to have your help! I do ask that if you do find a bug, please add a test to your PR that shows the bug and how it was fixed.

Create the "todos_test" database: `mix set_up_test_database`
Run tests: `mix test`
Check quality: `mix quality`
Delete test database: `mix tear_down_test_database`
Thanks!
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Mix.Tasks.Helpers do
defmodule Mix.Tasks.Walex.Helpers do
@moduledoc false
def create_database(database_name) do
"-c \"CREATE DATABASE #{database_name};\""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
defmodule Mix.Tasks.TearDownTestDatabase do
@moduledoc false
defmodule Mix.Tasks.Walex.Drop do
@moduledoc """
Drops the database
"""

use Mix.Task

alias Mix.Tasks.Helpers
alias Mix.Tasks.Walex.Helpers

@test_database "todos_test"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
defmodule Mix.Tasks.SetUpTestDatabase do
@moduledoc false
defmodule Mix.Tasks.Walex.Setup do
@moduledoc """
Creates, migrates and seeds the database
"""

use Mix.Task

alias Mix.Tasks.Helpers
alias Mix.Tasks.Walex.Helpers

@test_database "todos_test"

Expand Down

0 comments on commit 67f4cbd

Please sign in to comment.