ex-unit Questions

2

Solved

I'm testing the return value of a function. Which of the two is the preferred way? test "extra verbose, using assert" do {:error, reason} = MyModule.my_fun assert reason == :nope end test "usin...
Freehearted asked 12/4, 2017 at 8:29

2

Solved

For debugging purposes during a failing integration test, I would like to still be able to see my application logs. Is there a command I can pass to the mix test task to accomplish this?
Eiderdown asked 26/7, 2016 at 0:19

3

Solved

I'm trying to launch IEx.pry within a test. However I cannot get to run the tests within an iex session. Note that I'm not using mix. ExUnit.start defmodule Calc do def add(a,b) do a + b end e...
Elconin asked 25/11, 2016 at 12:58

3

Solved

In Ruby, specifically RSpec, you can tell the test runner to abort on the first test that does not pass by the command-line flag --fail-fast. This helps a lot to not waste time or lose focus when f...
Fontanez asked 23/5, 2018 at 12:35

3

I am doing a channel test that is receiving lots of messages. I may receive a message during setup, adjust some state and then I want to assert ( or refute ) another copy of that message was sent. ...
Laburnum asked 19/10, 2016 at 19:41

2

Problem I want to test an Elixir module that interacts with the host system and has methods that have side effects. For this question and to keep it brief, assume it is the creation of several dir...

3

I have an authentication plug and I want to test my controllers. The problem is that the line in this plug has user_id = get_session(conn, :user_id) And it's always nil when I'm using this meth...
Ilo asked 1/7, 2016 at 4:45

2

Solved

I have an Elixir program I'd like to test which gets input from the user via IO.gets several times. How would I go about faking this input in a test? Note: I would like to return a different valu...
Cathay asked 9/6, 2016 at 2:27

0

We are trying to run each test in a completely clean dets environment, and each test is responsible for its own setup. We're running into issues where we can not completely remove the directory bet...
Exequies asked 1/6, 2017 at 15:44

1

Is there a command-line invocation I can used in conjunction with mix that will output all test names without running the tests?
Humane asked 28/9, 2016 at 16:9

1

Solved

I wrote this test case: assert_raise ArgumentError, myFn(a,b) but it does not evaluate in the way I'd expect. myFn raises an ArgumentError (do: raise ArgumentError), but it is not caught by asse...
Atreus asked 8/6, 2016 at 13:16

1

Solved

I have a method in my elixir app, let's say Some.Module.func/1, that returns a tuple of two numbers. I'm writing tests in ExUnit and only need to test the first element in tuple and don't really ca...
Culprit asked 24/10, 2015 at 16:33
1

© 2022 - 2024 — McMap. All rights reserved.