Skip to content

Commit 89a5784

Browse files
Brian Balserbbalser
authored andcommitted
Updated ex_docs
Added is_in matcher
1 parent 1772cd5 commit 89a5784

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

lib/placebo/matchers.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ defmodule Placebo.Matchers do
1919
matcher :ne, do: arg != input
2020

2121
matcher :contains_member, do: Enum.member?(arg, input)
22+
matcher :is_in, do: arg in input
2223
matcher :is_empty, do: Enum.empty?(arg)
2324

2425
matcher :is_alive, do: Process.alive?(arg)

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ defmodule Placebo.MixProject do
2727
[
2828
{:meck, "~> 0.9"},
2929
{:mix_test_watch, "~> 0.6.0", only: :dev, runtime: false},
30-
{:ex_doc, "~> 0.19.1", only: :dev, runtime: false},
30+
{:ex_doc, "~> 0.23.0", only: :dev, runtime: false},
3131
{:stream_data, "~> 0.4", only: [:dev, :test]}
3232
]
3333
end

mix.lock

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
%{
22
"earmark": {:hex, :earmark, "1.2.6", "b6da42b3831458d3ecc57314dff3051b080b9b2be88c2e5aa41cd642a5b044ed", [:mix], [], "hexpm", "b42a23e9bd92d65d16db2f75553982e58519054095356a418bb8320bbacb58b1"},
3+
"earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"},
34
"espec": {:hex, :espec, "1.5.1", "46c603c4adb4244b152ea53c4d5f4545ab1eb1de1556588ec908b8e4ba570188", [:mix], [{:meck, "0.8.9", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm"},
4-
"ex_doc": {:hex, :ex_doc, "0.19.1", "519bb9c19526ca51d326c060cb1778d4a9056b190086a8c6c115828eaccea6cf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.7", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "dc87f778d8260da0189a622f62790f6202af72f2f3dee6e78d91a18dd2fcd137"},
5+
"ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"},
56
"file_system": {:hex, :file_system, "0.2.5", "a3060f063b116daf56c044c273f65202e36f75ec42e678dc10653056d3366054", [:mix], [], "hexpm", "c11255c9af50d831a09d469533b9dbb0fcfe4586ef6681f2205ad0e29cda89ef"},
67
"hamcrest": {:hex, :hamcrest, "0.1.3", "6c79b5bbdde0bea1563e1ce4810ff89fdcec41ab1019dcaace146c4925506b65", [:make, :rebar3], [], "hexpm"},
7-
"makeup": {:hex, :makeup, "0.5.5", "9e08dfc45280c5684d771ad58159f718a7b5788596099bdfb0284597d368a882", [:mix], [{:nimble_parsec, "~> 0.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d7152ff93f2eac07905f510dfa03397134345ba4673a00fbf7119bab98632940"},
8-
"makeup_elixir": {:hex, :makeup_elixir, "0.10.0", "0f09c2ddf352887a956d84f8f7e702111122ca32fbbc84c2f0569b8b65cbf7fa", [:mix], [{:makeup, "~> 0.5.5", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "4a36dd2d0d5c5f98d95b3f410d7071cd661d5af310472229dd0e92161f168a44"},
8+
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
9+
"makeup_elixir": {:hex, :makeup_elixir, "0.15.0", "98312c9f0d3730fde4049985a1105da5155bfe5c11e47bdc7406d88e01e4219b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "75ffa34ab1056b7e24844c90bfc62aaf6f3a37a15faa76b07bc5eba27e4a8b4a"},
910
"meck": {:hex, :meck, "0.9.0", "cb40c223cf403db2d09def59d32d3682074ebecceb64f3e6f6c4477458df124d", [:rebar3], [], "hexpm", "f813e90dd0b89b2516a0201a355e84b1abc78b5751aa0cbf669a9d85a810ac63"},
1011
"mix_test_watch": {:hex, :mix_test_watch, "0.6.0", "5e206ed04860555a455de2983937efd3ce79f42bd8536fc6b900cc286f5bb830", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "ea6f2a3766f18c2f53ca5b2d40b623ce2831c1646f36ff2b608607e20fc6c63c"},
11-
"nimble_parsec": {:hex, :nimble_parsec, "0.4.0", "ee261bb53214943679422be70f1658fff573c5d0b0a1ecd0f18738944f818efe", [:mix], [], "hexpm", "ebb595e19456a72786db6dcd370d320350cb624f0b6203fcc7e23161d49b0ffb"},
12+
"nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"},
1213
"stream_data": {:hex, :stream_data, "0.4.2", "fa86b78c88ec4eaa482c0891350fcc23f19a79059a687760ddcf8680aac2799b", [:mix], [], "hexpm", "54d6bf6f1e5e27fbf4a7784a2bffbb993446d0efd079debca0f27bf859c0d1cf"},
1314
}

test/async_test.exs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ defmodule Placebo.Async.Test1 do
66
allow Regex.regex?(:foo), return: :foo
77
Process.sleep(1_000)
88
assert :foo == Regex.regex?(:foo)
9+
assert false == Regex.regex?(:fool)
910
Process.sleep(1_000)
1011
assert_called Regex.regex?(:foo)
1112
end
@@ -19,6 +20,7 @@ defmodule Placebo.Async.Test2 do
1920
allow Regex.regex?(:fool), return: :bar
2021
Process.sleep(1_000)
2122
assert :bar == Regex.regex?(:fool)
23+
assert false == Regex.regex?(:foo)
2224
Process.sleep(1_000)
2325
assert_called Regex.regex?(:fool)
2426
end

test/matchers_test.exs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,20 @@ defmodule Placebo.MatchersTest do
6161
assert URI.decode("foobaz") == :baz
6262
assert URI.decode("other") == :no_match
6363
end
64+
65+
test "is_in" do
66+
allow Regex.regex?(any()), return: :no_match
67+
allow Regex.regex?(is_in([1, 2, 3])), return: :match
68+
69+
assert Regex.regex?(2) == :match
70+
assert Regex.regex?(4) == :no_match
71+
end
72+
73+
test "contains_member" do
74+
allow Regex.regex?(any()), return: :no_match
75+
allow Regex.regex?(contains_member("a")), return: :match
76+
77+
assert Regex.regex?(["b", "a", "c"]) == :match
78+
assert Regex.regex?(["d", "e", "f"]) == :no_match
79+
end
6480
end

0 commit comments

Comments
 (0)