Skip to content

Commit a2f8a74

Browse files
authored
Merge pull request #113 from kianmeng/misc-doc-changes
Misc doc changes
2 parents 8116eb3 + 0fda358 commit a2f8a74

File tree

4 files changed

+38
-32
lines changed

4 files changed

+38
-32
lines changed

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015–2016 PSPDFKit GmbH (pspdfkit.com)
3+
Copyright (c) 2015–2020 PSPDFKit GmbH (pspdfkit.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
22-

README.md

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Bypass
22

3+
<!-- MDOC !-->
4+
35
[![Build Status](https://travis-ci.org/PSPDFKit-labs/bypass.svg?branch=master)](https://travis-ci.org/PSPDFKit-labs/bypass)
6+
[![Module Version](https://img.shields.io/hexpm/v/bypass.svg)](https://hex.pm/packages/bypass)
7+
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/bypass/)
8+
[![Total Download](https://img.shields.io/hexpm/dt/bypass.svg)](https://hex.pm/packages/bypass)
9+
[![License](https://img.shields.io/hexpm/l/bypass.svg)](https://github.com/PSPDFKit-labs/bypass/blob/master/LICENSE)
10+
[![Last Updated](https://img.shields.io/github/last-commit/PSPDFKit-labs/bypass.svg)](https://github.com/PSPDFKit-labs/bypass/commits/master)
411

5-
[Online Documentation](https://hexdocs.pm/bypass).
6-
7-
<!-- MDOC !-->
812

913
`Bypass` provides a quick way to create a custom plug that can be put in place
1014
instead of an actual HTTP server to return prebaked responses to client
@@ -105,38 +109,38 @@ test configuration is basically the same, there are only two differences:
105109
being used with (defaults to `:ex_unit`). This simply disables the automatic
106110
integration with some hooks provided by `ExUnit`.
107111

108-
```elixir
109-
config :bypass, test_framework: :espec
110-
```
112+
```elixir
113+
config :bypass, test_framework: :espec
114+
```
111115

112116
2. In your specs, you must explicitly verify the declared expectations. You can
113117
do it in the `finally` block.
114118

115-
```elixir
116-
defmodule TwitterClientSpec do
117-
use ESpec, async: true
119+
```elixir
120+
defmodule TwitterClientSpec do
121+
use ESpec, async: true
118122

119-
before do
120-
bypass = Bypass.open()
121-
{:shared, bypass: bypass}
122-
end
123+
before do
124+
bypass = Bypass.open()
125+
{:shared, bypass: bypass}
126+
end
123127

124-
finally do
125-
Bypass.verify_expectations!(shared.bypass)
126-
end
128+
finally do
129+
Bypass.verify_expectations!(shared.bypass)
130+
end
127131

128-
specify "the client can handle an error response" do
129-
Bypass.expect_once(shared.bypass, "POST", "/1.1/statuses/update.json", fn conn ->
130-
Plug.Conn.resp(conn, 429, ~s<{"errors": [{"code": 88, "message": "Rate limit exceeded"}]}>)
131-
end)
132+
specify "the client can handle an error response" do
133+
Bypass.expect_once(shared.bypass, "POST", "/1.1/statuses/update.json", fn conn ->
134+
Plug.Conn.resp(conn, 429, ~s<{"errors": [{"code": 88, "message": "Rate limit exceeded"}]}>)
135+
end)
132136

133-
{:ok, client} = TwitterClient.start_link(url: endpoint_url(shared.bypass.port))
134-
assert {:error, :rate_limited} == TwitterClient.post_tweet(client, "Elixir is awesome!")
135-
end
137+
{:ok, client} = TwitterClient.start_link(url: endpoint_url(shared.bypass.port))
138+
assert {:error, :rate_limited} == TwitterClient.post_tweet(client, "Elixir is awesome!")
139+
end
136140

137-
defp endpoint_url(port), do: "http://localhost:#{port}/"
138-
end
139-
```
141+
defp endpoint_url(port), do: "http://localhost:#{port}/"
142+
end
143+
```
140144

141145
## Configuration options
142146

@@ -151,7 +155,7 @@ config :bypass, enable_debug_log: true
151155

152156
## Installation
153157

154-
Add bypass to your list of dependencies in mix.exs:
158+
Add `:bypass` to your list of dependencies in mix.exs:
155159

156160
```elixir
157161
def deps do

lib/bypass.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ defmodule Bypass do
242242
do: Bypass.Instance.call(pid, {:stub, method, path, fun})
243243

244244
@doc """
245-
Makes a expection to pass.
245+
Makes an expectation to pass.
246246
247247
```
248248
Bypass.expect(bypass, fn _conn ->

mix.exs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ defmodule Bypass.Mixfile do
4242
defp docs do
4343
[
4444
main: "Bypass",
45+
api_reference: false,
4546
source_url: @source_url,
46-
source_ref: "v#{@version}"
47+
source_ref: "v#{@version}",
48+
extras: ["CHANGELOG.md"]
4749
]
4850
end
4951

@@ -58,10 +60,11 @@ defmodule Bypass.Mixfile do
5860

5961
defp package do
6062
[
61-
files: ["lib", "mix.exs", "README.md", "LICENSE"],
63+
files: ["lib", "mix.exs", "README.md", "CHANGELOG.md", "LICENSE"],
6264
maintainers: ["PSPDFKit"],
6365
licenses: ["MIT"],
6466
links: %{
67+
"Changelog" => "#{@source_url}/blob/master/CHANGELOG.md",
6568
"GitHub" => @source_url,
6669
"PSPDFKit" => "https://pspdfkit.com"
6770
}

0 commit comments

Comments
 (0)