By default, all new generated Elixir apps via mix new include a nice installation snippet in the README.md.

However, I am always forgetting to update the version constraint in the README.md whenever I bump my app to a new version. Well, no more, after using this simple unit test:

test "README install version check" do app = :my_app app_version = "#{Application.spec(app, :vsn)}" readme = File.read!("README.md") [_, readme_versions] = Regex.run(~r/{:#{app}, "(.+)"}/, readme) assert Version.match?( app_version, readme_versions ), """ Install version constraint in README.md does not match to current app version. Current App Version: #{app_version} Readme Install Versions: #{readme_versions} """ end

Of course you will need to update the app value to whatever your app’s name is.

Enjoy!

DockYard is a digital product agency offering exceptional strategy, design, full stack engineering, web app development, custom software, Ember, Elixir, and Phoenix services, consulting, and training.