Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run tests #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@ To start the ElixirStatus application:
Now you can visit `localhost:4000` from your browser.


## Tests

To run all the tests

1. Install mix dependencies with:
```bash
$ mix deps.get
```

2. Run the tests
```bash
$ mix test
```


## Contribution

Expand Down
2 changes: 2 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ config :elixir_status, ElixirStatus.Endpoint,
pubsub: [name: ElixirStatus.PubSub,
adapter: Phoenix.PubSub.PG2]

config :elixir_status, publisher_blocked_user_names: []
config :elixir_status, publisher_blocked_urls: []

# Configures Elixir's Logger
config :logger, :console,
Expand Down
9 changes: 5 additions & 4 deletions test/elixir_status/publisher_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@ defmodule ElixirStatus.PublisherTest do

alias ElixirStatus.Publisher
alias ElixirStatus.Posting
alias ElixirStatus.User

@valid_attrs %{title: "some content", text: "some content", permalink: "some-content", public: true, published_at: Ecto.DateTime.utc, scheduled_at: nil, uid: "some content", user_id: 42}
@invalid_attrs %{}

test "after_create works without twitter_handle" do
test "after_create works with a user without a twitter_handle" do
changeset = Posting.changeset(%Posting{}, @valid_attrs)
assert changeset.valid?

Repo.insert!(changeset)
|> Publisher.after_create(nil)
|> Publisher.after_create(%User{twitter_handle: nil})
end

test "after_create works with twitter_handle" do
test "after_create works with a user with a twitter_handle" do
changeset = Posting.changeset(%Posting{}, @valid_attrs)
assert changeset.valid?

Repo.insert!(changeset)
|> Publisher.after_create("rrrene")
|> Publisher.after_create(%User{twitter_handle: "rrrene"})
end

test "short title for long titles" do
Expand Down