View Source Flagship (flagship v0.1.0)

Main interface to working with feature flags in a test environment.

Summary

Functions

Flags are persisted across tests, prefer with_flag/3 when setting a feature flag for a single test so that it is reset at the end of the test

Test macro to have two seperate tests with different values for a feature flag. This is handy when the test does stateful operations like database calls and you want ecto to clean up data between tests.

Same as test_with_flag/4 but with the ability to pass in a test context

Sets the flag value, then executess the given test, and resets the flag value

Functions

Flags are persisted across tests, prefer with_flag/3 when setting a feature flag for a single test so that it is reset at the end of the test

Link to this macro

test_with_flag(test_name, flag_name, flag_values, test_block)

View Source (macro)

Test macro to have two seperate tests with different values for a feature flag. This is handy when the test does stateful operations like database calls and you want ecto to clean up data between tests.

The example below will create two tests named:

  • it works with OPS-1000 set to true
  • it works with OPS-1000 set to false

Example

test_with_flag "it works", "OPS-1000-feature-flag", [true, false] do
  game = create_game!()

  assert [game] = App.Games.list_games()
end
Link to this macro

test_with_flag(test_name, test_context, flag_name, flag_values, test_block)

View Source (macro)

Same as test_with_flag/4 but with the ability to pass in a test context

The example below will create two tests named:

  • renders with valid html with OPS-1000 set to true
  • renders with valid html with OPS-1000 set to false

Example

test_with_flag "renders with valid html", %{conn: conn}, "OPS-1000-feature-flag", [true, false] do
   ...
end
Link to this function

with_flag(name, values, test)

View Source

Sets the flag value, then executess the given test, and resets the flag value