From 466dce0f66b96e1870057149879b6e3bc1af079d Mon Sep 17 00:00:00 2001 From: Alan Cruikshanks Date: Mon, 28 Nov 2016 12:08:14 +0000 Subject: [PATCH] Fix rspec focus label left in tests This change removes a focus label left in a test in the last PR #42, as per issue #43. It also updates `.travis.yml` to add a new check for focus labels to attempt to prevent it happening again. If the check finds a match it will break the build. --- .travis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7e22029..1d635af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,17 @@ git: # https://docs.travis-ci.com/user/languages/ruby#Caching-Bundler cache: bundler +# Using the ability to customise the Travis build to check for 'focus' labels +# i.e. labels used when working on a spec but which we don't want appearing in +# the final commit to master +before_script: + - echo "Checking for use of 'focus' labels in specs" + # Reworking of http://stackoverflow.com/a/30495279/6117745 + # If grep returns 0 (match found), test 0 -eq 1 will return 1. + # If grep returns 1 (no match found), test 1 -eq 1 will return 0. + # If grep returns 2 (error), test 2 -eq 1 will return 1. + - grep -r --include="*_spec.rb" "focus: true" spec/; test $? -eq 1 + # This section was added as per https://docs.travis-ci.com/user/code-climate/ # To protect our codeclimate stats rather than adding the Codeclimate API key for ea-area_lookup # in the open we used this guide https://docs.travis-ci.com/user/encryption-keys/ to encryt the