From ba3db6eba78b77981790546c5ba5cde75d6c721a Mon Sep 17 00:00:00 2001 From: Joseph Wynn Date: Thu, 29 Dec 2016 22:00:36 +1300 Subject: [PATCH 1/2] Use SimpleCov directly so that coverage can be inspected locally --- Gemfile | 1 + features/support/env.rb | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index d8db122..ccd96a3 100644 --- a/Gemfile +++ b/Gemfile @@ -7,5 +7,6 @@ group :development do gem 'cucumber', '~> 2.1' gem 'test-unit', '~> 3.1' + gem 'simplecov', :require => false gem 'coveralls', :require => false end diff --git a/features/support/env.rb b/features/support/env.rb index f305609..71ff1b1 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,7 +1,11 @@ -if ENV['CI'] - require 'coveralls' - Coveralls.wear! -end +require 'simplecov' +require 'coveralls' + +formatters = [SimpleCov::Formatter::HTMLFormatter] +formatters << Coveralls::SimpleCov::Formatter if ENV['CI'] + +SimpleCov.formatters = formatters +SimpleCov.start require 'test/unit/assertions' require 'jekyll-responsive-image' From 746205e726fc65485241669fb28278ba49e0e744 Mon Sep 17 00:00:00 2001 From: Joseph Wynn Date: Thu, 29 Dec 2016 22:04:49 +1300 Subject: [PATCH 2/2] Consolidate some tests to reduce the test:code ratio --- features/extra-image-generation.feature | 19 ++++------------ features/image-hashes.feature | 30 ------------------------- 2 files changed, 4 insertions(+), 45 deletions(-) diff --git a/features/extra-image-generation.feature b/features/extra-image-generation.feature index 6cecce1..b9fb0c8 100644 --- a/features/extra-image-generation.feature +++ b/features/extra-image-generation.feature @@ -3,33 +3,22 @@ Feature: Extra image generation I want to resize images that aren't used in posts or pages In order to use them in my stylesheets - Scenario: Resizing a single image + Scenario: Specifying a single image and glob patterns Given I have a responsive_image configuration with: """ sizes: - width: 100 extra_images: - assets/everybody-loves-jalapeño-pineapple-cornbread.png + - assets/*.jpeg """ And I have a file "index.html" with "Hello, world!" When I run Jekyll Then the image "assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100x50.png" should have the dimensions "100x50" + And the image "assets/resized/progressive-100x50.jpeg" should have the dimensions "100x50" And the file "_site/assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100x50.png" should exist - - Scenario: Using glob patterns - Given I have a responsive_image configuration with: - """ - sizes: - - width: 100 - extra_images: - - assets/*.png - """ - - And I have a file "index.html" with "Hello, world!" - When I run Jekyll - Then the image "assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100x50.png" should have the dimensions "100x50" - And the file "_site/assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100x50.png" should exist + And the file "_site/assets/resized/progressive-100x50.jpeg" should exist Scenario: Honouring Jekyll 'source' configuration Given I have copied my site to "sub-dir/my-site-copy" diff --git a/features/image-hashes.feature b/features/image-hashes.feature index 613c5f9..b88fa31 100644 --- a/features/image-hashes.feature +++ b/features/image-hashes.feature @@ -4,36 +4,6 @@ Feature: Image hashes inside responsive image templates In order to create custom responsive image templates Scenario: Using the {% responsive_image %} tag - Given I have a configuration with: - """ - responsive_image: - template: _includes/hash.html - output_path_format: assets/resized/%{dirname}/%{width}/%{basename} - sizes: - - width: 100 - """ - And I have a file "index.html" with "{% responsive_image path: assets/subdir/test.png %}" - When I run Jekyll - Then the file "_site/index.html" should contain: - """ - path: assets/subdir/test.png - width: 300 - height: 150 - basename: test.png - dirname: subdir - filename: test - extension: png - - path: assets/resized/subdir/100/test.png - width: 100 - height: 50 - basename: test.png - dirname: resized/subdir/100 - filename: test - extension: png - """ - - Scenario: Honouring Jekyll 'source' configuration Given I have copied my site to "my-site-copy/src" And I have a configuration with: """