antonmi / espec

Elixir Behaviour Driven Development
Other
808 stars 62 forks source link

Ensure that `let!` with a keyword list only evaluates once for each example #228

Closed sascha-wolf closed 7 years ago

sascha-wolf commented 7 years ago

Instead of passing the keyword list directly to before, we now generate a list of calls to the generated functions.

Example

Before

Using let! a: 1, b: 2 results in:

let a: 1, b: 2
before a: 1, b: 2

Now

Using let! a: 1, b: 2 results in:

let a: 1, b: 2

before do
  [a(), b()]
end

This ensures that the values of the keyword list really only get evaluated once, which is important when these values affect the global state.

antonmi commented 7 years ago

Hi, @Zeeker ! Thanks for collaboration!