Skip to content

Instantly share code, notes, and snippets.

@thiagokokada
Created August 15, 2018 01:49
Show Gist options
  • Save thiagokokada/1b58c294a9ba0e65e508d541f1d4dcab to your computer and use it in GitHub Desktop.
Save thiagokokada/1b58c294a9ba0e65e508d541f1d4dcab to your computer and use it in GitHub Desktop.
describe "+ 1.0 * 5" do
defmodule FakeIO do
defdelegate puts(message), to: IO
def gets("operation> "), do: "+ 1.0\n"
def gets("operation> "), do: "* 5\n"
end
test "accumulator should be 1.0" do
run = fn -> Calculator.repl(0.0, FakeIO) end
assert capture_io(run) =~ "5.0"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment