From 83fe7e35aa31b60179623f2ad1d2a6e8a5a42647 Mon Sep 17 00:00:00 2001 From: Denis Defreyne Date: Sun, 24 Jul 2016 13:00:36 +0200 Subject: [PATCH] Improve trailig-slash error message --- lib/nanoc/extra/deployers/fog.rb | 5 +++-- spec/nanoc/extra/deployers/fog_spec.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/nanoc/extra/deployers/fog.rb b/lib/nanoc/extra/deployers/fog.rb index 18bb244ab9..aef6253fc4 100644 --- a/lib/nanoc/extra/deployers/fog.rb +++ b/lib/nanoc/extra/deployers/fog.rb @@ -84,8 +84,9 @@ def run path = config[:path] cdn_id = config[:cdn_id] - # FIXME: confusing error message - raise 'The path requires no trailing slash' if path && path[-1, 1] == '/' + if path && path.end_with?('/') + raise "The path `#{path}` is not supposed to have a trailing slash" + end connection = connect directory = get_or_create_bucket(connection, bucket, path) diff --git a/spec/nanoc/extra/deployers/fog_spec.rb b/spec/nanoc/extra/deployers/fog_spec.rb index 23bdce9d2d..7335d159aa 100644 --- a/spec/nanoc/extra/deployers/fog_spec.rb +++ b/spec/nanoc/extra/deployers/fog_spec.rb @@ -85,7 +85,7 @@ end it 'raises' do - expect { subject }.to raise_error('The path requires no trailing slash') + expect { subject }.to raise_error('The path `foo/` is not supposed to have a trailing slash') end end