From 8951c5d64a0d920e9602609132ee7bac6b248dd4 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Fri, 21 Sep 2018 10:34:46 +0100 Subject: [PATCH] Updated Code Conventions (markdown) --- Code-Conventions.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Code-Conventions.md b/Code-Conventions.md index 0d1e14f..ce60f34 100644 --- a/Code-Conventions.md +++ b/Code-Conventions.md @@ -38,11 +38,12 @@ For positioning use % values, not viewport-units (vh, etc) (viewport-units are n ### Prefer `to have_not` as a feature matcher style (instead of `to_not have`) Reference: Capybara finders section of [this blog post](https://blog.codeship.com/faster-rails-tests/) for more details. -### Never use I18n.t in assertions -When asserting text that is translatable, always assert against the translated string, not the call to I18n.t. - -Good -`expect(json_response['errors']).to eq "Hm, something went wrong. No order cycle data found."` +### Always use I18n.t in spec assertions +In specs, when asserting text that is translatable, always assert with a call to I18n.t, never use the translated string in english. Bad -`expect(json_response['errors']).to eq I18n.t('admin.order_cycles.bulk_update.no_data')` \ No newline at end of file +`expect(json_response['errors']).to eq "Hm, something went wrong. No order cycle data found."` + +Good +`expect(json_response['errors']).to eq I18n.t('admin.order_cycles.bulk_update.no_data')` +