From fbf0c9ca0b3a5b1fb572a2dae281cb76e783ab2a Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Sat, 20 Apr 2019 12:32:37 -0400 Subject: [PATCH 01/21] Clean up README badges Removed the dead Gemnasium badge and updated the remaining badges. --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index dbe7692..8e13892 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,20 @@ -# CukeSlicer - -Gem Version +Basic stuff: +[![Gem Version](https://badge.fury.io/rb/cql.svg)](https://rubygems.org/gems/cuke_slicer) +[![Project License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/mit-license.php) +[![Downloads](https://img.shields.io/gem/dt/cql.svg)](https://rubygems.org/gems/cuke_slicer) -Dependency Status +User stuff: +[![Yard Docs](http://img.shields.io/badge/Documentation-API-blue.svg)](https://www.rubydoc.info/gems/cuke_slicer) -Project License +Developer stuff: +[![Build Status](https://travis-ci.org//grange-insurance/cuke_slicer.svg?branch=dev)](https://travis-ci.org/grange-insurance/cuke_slicer) +[![Coverage Status](https://coveralls.io/repos/github/grange-insurance/cuke_slicer/badge.svg?branch=dev)](https://coveralls.io/github/grange-insurance/cuke_slicer?branch=dev) +[![Maintainability](https://codeclimate.com/github/grange-insurance/cuke_slicer/badges/gpa.svg)](https://codeclimate.com/github/grange-insurance/cuke_slicer/maintainability) -Build Status +--- -Coverage Status - -Code Quality +# CukeSlicer The cuke_slicer gem provides an easy and programmatic way to divide a Cucumber test suite into granular test cases that can then be dealt with on an individual basis. Often this means handing them off to a distributed From 5ff38b525a09ae4aad9d3a99e494e852e83919a2 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Sat, 20 Apr 2019 12:33:21 -0400 Subject: [PATCH 02/21] Ignore an IDE metadata folder Ignoring RubyMine's metadata folder. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 31cafb5..815de7d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ tmp *.o *.a mkmf.log +.idea/* + From e81f7a50a6269897bc70c8091d38334fabb6ce17 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Sat, 20 Apr 2019 12:51:38 -0400 Subject: [PATCH 03/21] Clean up Rake tasks Updated the Rake tasks to be more in line with my other projects. --- Rakefile | 67 +++++++++++++++++++++++++++++++++++++-------- cuke_slicer.gemspec | 1 + 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/Rakefile b/Rakefile index fae4890..e5f11ea 100644 --- a/Rakefile +++ b/Rakefile @@ -1,26 +1,71 @@ -require "bundler/gem_tasks" -require 'coveralls/rake/task' +require 'bundler/gem_tasks' +require 'rake' require 'racatt' +require 'coveralls/rake/task' +require 'rainbow' + + +Rainbow.enabled = true + +namespace 'racatt' do + Racatt.create_tasks +end namespace 'cuke_slicer' do + desc 'Removes the current code coverage data' task :clear_coverage do - puts 'Clearing old code coverage results...' + code_coverage_directory = "#{File.dirname(__FILE__)}/coverage" - # Remove previous coverage results so that they don't get merged in the new results - code_coverage_directory = File.join(File.dirname(__FILE__), 'coverage') - FileUtils.remove_dir(code_coverage_directory, true) if File.exists?(code_coverage_directory) + FileUtils.remove_dir(code_coverage_directory, true) end - Racatt.create_tasks + desc 'Check documentation with RDoc' + task :check_documentation do + output = `rdoc lib -C` + puts output + + if output =~ /100.00% documented/ + puts Rainbow('All code documented').green + else + raise Rainbow('Parts of the gem are undocumented').red + end + end + + desc 'Run all of the tests' + task :test_everything => [:clear_coverage] do + rspec_args = '--tag ~@wip --pattern "spec/**/*_spec.rb" --force-color' + + cucumber_version = Gem.loaded_specs['cucumber'].version.version - # Redefining the task from 'racatt' in order to clear the code coverage results - task :test_everything, [:command_options] => :clear_coverage + if cucumber_version =~ /^[123]\./ + cucumber_args = 'features -f progress -t ~@wip --color' + else + cucumber_args = "features -f progress -t 'not @wip' --color" + end + + Rake::Task['racatt:test_everything'].invoke(rspec_args, cucumber_args) + end - # The task that CI will use + # creates coveralls:push task Coveralls::RakeTask.new - task :ci_build => [:clear_coverage, :test_everything, 'coveralls:push'] + + desc 'The task that CI will run. Do not run locally.' + task :ci_build => ['cuke_slicer:test_everything', 'coveralls:push'] + + desc 'Check that things look good before trying to release' + task :prerelease_check do + begin + Rake::Task['cuke_slicer:test_everything'].invoke + Rake::Task['cuke_slicer:check_documentation'].invoke + rescue => e + puts Rainbow("Something isn't right!").red + raise e + end + + puts Rainbow('All is well. :)').green + end end diff --git a/cuke_slicer.gemspec b/cuke_slicer.gemspec index a40d224..6b0f7ef 100644 --- a/cuke_slicer.gemspec +++ b/cuke_slicer.gemspec @@ -27,5 +27,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "simplecov", '~> 0.0' spec.add_development_dependency "racatt", '~> 1.0' spec.add_development_dependency 'coveralls', '< 1.0.0' + spec.add_development_dependency 'rainbow', '< 4.0.0' end From c0e248baaa649535fc9f279f33061e91783993d1 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Sat, 20 Apr 2019 12:51:48 -0400 Subject: [PATCH 04/21] Update copyright notice Updating for 2019. --- LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.txt b/LICENSE.txt index 831710b..84912e7 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2015 Grange Insurance +Copyright (c) 2019 Grange Insurance MIT License From b4b1e1851477961d4d24011ce34dc53e08691587 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Tue, 23 Apr 2019 23:00:40 -0400 Subject: [PATCH 05/21] Rename project history file Renamed to CHANGELOG in order to follow the convention of the CHANGELOG format. --- History.rdoc => CHANGELOG.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename History.rdoc => CHANGELOG.md (100%) diff --git a/History.rdoc b/CHANGELOG.md similarity index 100% rename from History.rdoc rename to CHANGELOG.md From 42c87e68eff0f70b3b033560c1448455db47b691 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Tue, 23 Apr 2019 23:41:07 -0400 Subject: [PATCH 06/21] Update CHANGELOG format Updated the format to match the CHANGELOG conventions. --- CHANGELOG.md | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 934b2e4..4507759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,48 @@ -=== Version 2.0.2 / 2016-11-19 +# Changelog +All notable changes to this project will be documented in this file. -* The gem now declares version limits for all of its dependencies. +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -=== Version 2.0.1 / 2016-11-08 +## [Unreleased] -* Works with both 0.x and 1.x versions of the 'cuke_modeler' gem. +Nothing yet... -=== Version 2.0.0 / 2015-07-08 -* When slicing a directory, the test cases returned can now be provided as model objects in addition to the - previous 'file_path:line_number' format. +## [2.0.2] - 2016-11-19 -* Major performance increase +### Added + - The gem now declares version limits for all of its dependencies. -=== Version 1.0.0 / 2015-04-01 -* Initial release +## [2.0.1] - 2016-11-08 (yanked) + +### Added + + - Works with both 0.x and 1.x versions of the 'cuke_modeler' gem. + + +## [2.0.0] - 2015-07-08 + +### Added + + - When slicing a directory, the test cases returned can now be provided as model objects in addition to the + previous 'file_path:line_number' format. + +### Changed + + - Major performance increase + + +## [1.0.0] - 2015-04-01 + +### Added + + - Initial release + +[Unreleased]: https://github.com/grange-insurance/cuke_slicer/compare/v2.0.2...HEAD +[2.0.2]: https://github.com/grange-insurance/cuke_slicer/compare/v2.0.1...v2.0.2 +[2.0.1]: https://github.com/grange-insurance/cuke_slicer/compare/v2.0.0...v2.0.1 +[2.0.0]: https://github.com/grange-insurance/cuke_slicer/compare/v1.0.0...v2.0.0 +[1.0.0]: https://github.com/grange-insurance/cuke_slicer/compare/1c6e64b963d97f9037f1dc1ebcb6f8f9966f3b71...v1.0.0 From bcf0302a8356f14b48f5755c015f723ba74fb506 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Wed, 24 Apr 2019 00:11:56 -0400 Subject: [PATCH 07/21] Restoring version number Reducing the version number back to the last released version because no significant code changes have actually occurred. --- lib/cuke_slicer/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cuke_slicer/version.rb b/lib/cuke_slicer/version.rb index c1fcd82..8d2ca2f 100644 --- a/lib/cuke_slicer/version.rb +++ b/lib/cuke_slicer/version.rb @@ -1,4 +1,4 @@ module CukeSlicer # The current version for the gem. - VERSION = "2.0.3" + VERSION = "2.0.2" end From a6f0c835b322898894cec580cd90e532f5d80bc6 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Wed, 24 Apr 2019 00:23:36 -0400 Subject: [PATCH 08/21] Add Ruby version limits Officially declaring which versions of Ruby with which this gem will work. --- CHANGELOG.md | 4 +++- cuke_slicer.gemspec | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4507759..5a66af1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -Nothing yet... +### Added + + - Add dependency version limits to Ruby, which was previously unbound. Previously unofficially supported Ruby versions (1.9.3 - 2.x) are now officially supported. ## [2.0.2] - 2016-11-19 diff --git a/cuke_slicer.gemspec b/cuke_slicer.gemspec index 6b0f7ef..e3efef3 100644 --- a/cuke_slicer.gemspec +++ b/cuke_slicer.gemspec @@ -18,6 +18,8 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.required_ruby_version = '>= 1.9.3', '< 3.0' + spec.add_runtime_dependency "cuke_modeler", "< 2.0" spec.add_development_dependency "bundler", "~> 1.6" From b57a67e08458e3c7b129dc350e00458a2035668e Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Wed, 24 Apr 2019 12:57:00 -0400 Subject: [PATCH 09/21] Fix README links Accidentally used the image references to the project from which I copied the badges. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8e13892..05261b0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Basic stuff: -[![Gem Version](https://badge.fury.io/rb/cql.svg)](https://rubygems.org/gems/cuke_slicer) +[![Gem Version](https://badge.fury.io/rb/cuke_slicer.svg)](https://rubygems.org/gems/cuke_slicer) [![Project License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/mit-license.php) -[![Downloads](https://img.shields.io/gem/dt/cql.svg)](https://rubygems.org/gems/cuke_slicer) +[![Downloads](https://img.shields.io/gem/dt/cuke_slicer.svg)](https://rubygems.org/gems/cuke_slicer) User stuff: [![Yard Docs](http://img.shields.io/badge/Documentation-API-blue.svg)](https://www.rubydoc.info/gems/cuke_slicer) From a8547ebfc81a2365c72798c8fef1a0ad1dc670ed Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Wed, 24 Apr 2019 21:07:51 -0400 Subject: [PATCH 10/21] Turn some tests back on Uncommenting some perfectly valid test cases. --- features/test_case_extraction.feature | 20 ++++++++++---------- spec/slicer_integration_spec.rb | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/features/test_case_extraction.feature b/features/test_case_extraction.feature index b8acb50..ca4cf73 100644 --- a/features/test_case_extraction.feature +++ b/features/test_case_extraction.feature @@ -29,16 +29,16 @@ Feature: Test case extraction | path/to/a_test.feature:11 | | path/to/a_test.feature:14 | -# Scenario: Extraction from 'empty' files -# Given the following feature file "empty.feature": -# """ -# Feature: Nothing here yet -# """ -# And the following feature file "really_empty.feature": -# """ -# """ -# When test cases are extracted from them -# Then no test cases are found + Scenario: Extraction from 'empty' files + Given the following feature file "empty.feature": + """ + Feature: Nothing here yet + """ + And the following feature file "really_empty.feature": + """ + """ + When test cases are extracted from them + Then no test cases are found Scenario: Extraction from a directory Given the directory "test_directory" diff --git a/spec/slicer_integration_spec.rb b/spec/slicer_integration_spec.rb index 4f5fff7..c9eaf99 100644 --- a/spec/slicer_integration_spec.rb +++ b/spec/slicer_integration_spec.rb @@ -60,11 +60,11 @@ expect { slicer.slice(@default_file_directory, :file_line) }.to_not raise_error end - # it 'can slice an empty feature file' do - # File.open(test_file, 'w') { |file| file.write('') } - # - # expect { slicer.slice(test_file, :file_line) }.to_not raise_error - # end + it 'can slice an empty feature file' do + File.open(test_file, 'w') { |file| file.write('') } + + expect { slicer.slice(test_file, :file_line) }.to_not raise_error + end it 'can slice a feature that has no tests' do File.open(test_file, 'w') { |file| file.write('Feature: Empty feature') } From 99485cadf17edcfa941d1df4af758d765e6bbd7d Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Wed, 24 Apr 2019 21:15:27 -0400 Subject: [PATCH 11/21] Expand CI matrix Add all the latest 2.x versions of Ruby and Jruby. Also added testing on OSX. --- .travis.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a450463..73328a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,15 @@ +os: + - linux + - osx + language: ruby rvm: - 1.9.3 - - 2.0.0 - - 2.1.2 - - 2.3.3 + - 2.3.8 + - 2.4.5 - 2.5.3 + - 2.6.0 + - jruby-9.1.7.0 gemfile: - gemfiles/cuke_modeler0.gemfile From 9ca60e268578868120b166674c3b5cb56d904f01 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Wed, 24 Apr 2019 21:36:30 -0400 Subject: [PATCH 12/21] Remove CI matrix combination Removing 1.9.3 from OSX because Travis CI does not support it. --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 73328a4..4c5cb27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,4 +15,11 @@ gemfile: - gemfiles/cuke_modeler0.gemfile - gemfiles/cuke_modeler1.gemfile +matrix: + exclude: + # Travis does not provide 1.9.3 on OSX + - rvm: 1.9.3 + os: osx + + script: bundle exec rake cuke_slicer:ci_build From 4f3d2b117d082cd419d30615065f058cc3696784 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Wed, 24 Apr 2019 21:37:57 -0400 Subject: [PATCH 13/21] Loosening dependency version limit No longer limiting Bundler to 1.x. --- cuke_slicer.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuke_slicer.gemspec b/cuke_slicer.gemspec index e3efef3..f17079a 100644 --- a/cuke_slicer.gemspec +++ b/cuke_slicer.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "cuke_modeler", "< 2.0" - spec.add_development_dependency "bundler", "~> 1.6" + spec.add_development_dependency 'bundler', '< 3.0' spec.add_development_dependency "rake" , '~> 11.0' spec.add_development_dependency "rspec", '~> 3.0' spec.add_development_dependency "cucumber", '~> 2.0' From bb85a43d989ebdb5a0e13882fe708b714fcde7a1 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Wed, 24 Apr 2019 21:57:18 -0400 Subject: [PATCH 14/21] Loosening more dependency version limits Updating all direct dependency limits to include their current major version number. --- Rakefile | 12 ++++++++++++ cuke_slicer.gemspec | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index e5f11ea..7d81744 100644 --- a/Rakefile +++ b/Rakefile @@ -33,6 +33,18 @@ namespace 'cuke_slicer' do end end + desc 'Check documentation with RDoc' + task :check_for_outdated_dependencies do + output = `bundle outdated` + puts output + + if output =~ /requested/ + raise Rainbow('Some dependencies are out of date!').red + else + puts Rainbow('All direct dependencies up to date!').green + end + end + desc 'Run all of the tests' task :test_everything => [:clear_coverage] do rspec_args = '--tag ~@wip --pattern "spec/**/*_spec.rb" --force-color' diff --git a/cuke_slicer.gemspec b/cuke_slicer.gemspec index f17079a..aae57b4 100644 --- a/cuke_slicer.gemspec +++ b/cuke_slicer.gemspec @@ -23,9 +23,9 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "cuke_modeler", "< 2.0" spec.add_development_dependency 'bundler', '< 3.0' - spec.add_development_dependency "rake" , '~> 11.0' + spec.add_development_dependency 'rake', '< 13.0.0' spec.add_development_dependency "rspec", '~> 3.0' - spec.add_development_dependency "cucumber", '~> 2.0' + spec.add_development_dependency 'cucumber', '< 5.0.0' spec.add_development_dependency "simplecov", '~> 0.0' spec.add_development_dependency "racatt", '~> 1.0' spec.add_development_dependency 'coveralls', '< 1.0.0' From e7c6a894be743895e1cdf8b3938408a46518c760 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Wed, 24 Apr 2019 22:12:36 -0400 Subject: [PATCH 15/21] Tweak CI dependency version limits Adding a limitation to 'cucumber' depending on which version of Ruby is being used. --- gemfiles/cuke_modeler0.gemfile | 1 + gemfiles/cuke_modeler1.gemfile | 1 + 2 files changed, 2 insertions(+) diff --git a/gemfiles/cuke_modeler0.gemfile b/gemfiles/cuke_modeler0.gemfile index 9ee3cfe..7425c3f 100644 --- a/gemfiles/cuke_modeler0.gemfile +++ b/gemfiles/cuke_modeler0.gemfile @@ -6,6 +6,7 @@ gem 'cuke_modeler', '~> 0.0' if RUBY_VERSION =~ /^1\./ + gem 'cucumber', '< 3.0.0' # Ruby 1.9.x support dropped after this version gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version diff --git a/gemfiles/cuke_modeler1.gemfile b/gemfiles/cuke_modeler1.gemfile index 9769717..521daae 100644 --- a/gemfiles/cuke_modeler1.gemfile +++ b/gemfiles/cuke_modeler1.gemfile @@ -6,6 +6,7 @@ gem 'cuke_modeler', '~> 1.0' if RUBY_VERSION =~ /^1\./ + gem 'cucumber', '< 3.0.0' # Ruby 1.9.x support dropped after this version gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version From a1a617fee29c0ba778f3981434c19a211aa72a4b Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Wed, 24 Apr 2019 22:52:35 -0400 Subject: [PATCH 16/21] Tweak another CI dependency version limit Adding a seemingly unnecessary requirement (because Bundler should already do this normally) to use the most recent 0.x version of 'cuke_modeler' when testing against the 0.x series. It does, however, solve the problem of a needlessly old version of the 0.x series from being used during testing (both locally and in CI). --- gemfiles/cuke_modeler0.gemfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gemfiles/cuke_modeler0.gemfile b/gemfiles/cuke_modeler0.gemfile index 7425c3f..a7dcba8 100644 --- a/gemfiles/cuke_modeler0.gemfile +++ b/gemfiles/cuke_modeler0.gemfile @@ -2,7 +2,9 @@ source 'https://rubygems.org' gemspec :path => "../" -gem 'cuke_modeler', '~> 0.0' +# Bundle is not using the latest in the CukeModeler 0.x series for some reason, so being explicit here +gem 'cuke_modeler', '0.4.1' +# gem 'cuke_modeler', '~> 0.0' # This really should be sufficient... if RUBY_VERSION =~ /^1\./ From c0e364249a12e4b8293f7aa989e1c5881ae018d8 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Sat, 27 Apr 2019 23:19:09 -0400 Subject: [PATCH 17/21] Fix copyright Now using a year range instead of just the most recent year. --- LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.txt b/LICENSE.txt index 84912e7..dc333bd 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2019 Grange Insurance +Copyright (c) 2015-2019 Grange Insurance MIT License From 3d92fe458823f14006c59970f0aa6e081e018b70 Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Sun, 28 Apr 2019 18:35:56 -0400 Subject: [PATCH 18/21] Add some missing test coverage Added a test for bubbling up exceptions during slicing. --- spec/slicer_integration_spec.rb | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/spec/slicer_integration_spec.rb b/spec/slicer_integration_spec.rb index c9eaf99..8a3b4c1 100644 --- a/spec/slicer_integration_spec.rb +++ b/spec/slicer_integration_spec.rb @@ -92,6 +92,43 @@ expect { slicer.slice(test_file, :file_line) }.to raise_error(ArgumentError, /syntax.*lexing problem.*#{test_file}/i) end + it 'does not swallow unexpected exceptions while slicing' do + begin + $old_method = CukeModeler::Parsing.method(:parse_text) + + # Custom error type in order to ensure that we are throwing the correct thing + module CukeSlicer + class TestError < StandardError + end + end + + # Monkey patch the parsing method to throw the error that we need for testing + module CukeModeler + module Parsing + class << self + def parse_text(*args) + raise(CukeSlicer::TestError, 'something went wrong') + end + end + end + end + + + File.write(test_file, 'junk text') + + expect { slicer.slice(test_file, :file_line) }.to raise_error(CukeSlicer::TestError, 'something went wrong') + ensure + # Making sure that our changes don't escape a test and ruin the rest of the suite + module CukeModeler + module Parsing + class << self + define_method(:parse_text, $old_method) + end + end + end + end + end + end end From 416166a9989b57a641fc7a05d0e908347742d7db Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Tue, 30 Apr 2019 23:14:28 -0400 Subject: [PATCH 19/21] Mark non-API code Commented helper code that isn't part of the public API so that RDoc wouldn't complain about it being undocumented and so that users will know to not rely on it. --- lib/cuke_slicer/collections/nested_tag_collection.rb | 2 ++ lib/cuke_slicer/collections/path_collection.rb | 2 ++ lib/cuke_slicer/collections/tag_collection.rb | 2 ++ lib/cuke_slicer/extractors/directory_extractor.rb | 2 ++ lib/cuke_slicer/extractors/file_extractor.rb | 2 ++ lib/cuke_slicer/filters/filter_set.rb | 2 ++ lib/cuke_slicer/helpers/extraction_helpers.rb | 2 ++ lib/cuke_slicer/helpers/filter_helpers.rb | 2 ++ lib/cuke_slicer/helpers/helpers.rb | 2 ++ lib/cuke_slicer/helpers/matching_helpers.rb | 2 ++ 10 files changed, 20 insertions(+) diff --git a/lib/cuke_slicer/collections/nested_tag_collection.rb b/lib/cuke_slicer/collections/nested_tag_collection.rb index b53c1f1..160a90a 100644 --- a/lib/cuke_slicer/collections/nested_tag_collection.rb +++ b/lib/cuke_slicer/collections/nested_tag_collection.rb @@ -1,6 +1,8 @@ require "cuke_slicer/helpers/helpers" +# Internal helper module that is not part of the public API. Subject to change at any time. +# :nodoc: all module CukeSlicer class NestedTagCollection diff --git a/lib/cuke_slicer/collections/path_collection.rb b/lib/cuke_slicer/collections/path_collection.rb index 448c90a..d8f47c2 100644 --- a/lib/cuke_slicer/collections/path_collection.rb +++ b/lib/cuke_slicer/collections/path_collection.rb @@ -1,6 +1,8 @@ require "cuke_slicer/helpers/helpers" +# Internal helper module that is not part of the public API. Subject to change at any time. +# :nodoc: all module CukeSlicer class PathCollection diff --git a/lib/cuke_slicer/collections/tag_collection.rb b/lib/cuke_slicer/collections/tag_collection.rb index 61a2b3a..6d08891 100644 --- a/lib/cuke_slicer/collections/tag_collection.rb +++ b/lib/cuke_slicer/collections/tag_collection.rb @@ -2,6 +2,8 @@ require "cuke_slicer/collections/nested_tag_collection" +# Internal helper module that is not part of the public API. Subject to change at any time. +# :nodoc: all module CukeSlicer class TagCollection diff --git a/lib/cuke_slicer/extractors/directory_extractor.rb b/lib/cuke_slicer/extractors/directory_extractor.rb index e808ab2..d661f74 100644 --- a/lib/cuke_slicer/extractors/directory_extractor.rb +++ b/lib/cuke_slicer/extractors/directory_extractor.rb @@ -1,3 +1,5 @@ +# Internal helper module that is not part of the public API. Subject to change at any time. +# :nodoc: all module CukeSlicer class DirectoryExtractor diff --git a/lib/cuke_slicer/extractors/file_extractor.rb b/lib/cuke_slicer/extractors/file_extractor.rb index 2190154..87b400c 100644 --- a/lib/cuke_slicer/extractors/file_extractor.rb +++ b/lib/cuke_slicer/extractors/file_extractor.rb @@ -3,6 +3,8 @@ require "cuke_slicer/helpers/extraction_helpers" +# Internal helper module that is not part of the public API. Subject to change at any time. +# :nodoc: all module CukeSlicer class FileExtractor diff --git a/lib/cuke_slicer/filters/filter_set.rb b/lib/cuke_slicer/filters/filter_set.rb index 13caaa8..ff3b58d 100644 --- a/lib/cuke_slicer/filters/filter_set.rb +++ b/lib/cuke_slicer/filters/filter_set.rb @@ -3,6 +3,8 @@ require "cuke_slicer/collections/path_collection" +# Internal helper module that is not part of the public API. Subject to change at any time. +# :nodoc: all module CukeSlicer class FilterSet diff --git a/lib/cuke_slicer/helpers/extraction_helpers.rb b/lib/cuke_slicer/helpers/extraction_helpers.rb index 1ca4145..88d7de2 100644 --- a/lib/cuke_slicer/helpers/extraction_helpers.rb +++ b/lib/cuke_slicer/helpers/extraction_helpers.rb @@ -1,3 +1,5 @@ +# Internal helper module that is not part of the public API. Subject to change at any time. +# :nodoc: all module CukeSlicer module ExtractionHelpers diff --git a/lib/cuke_slicer/helpers/filter_helpers.rb b/lib/cuke_slicer/helpers/filter_helpers.rb index 0439261..0a102a9 100644 --- a/lib/cuke_slicer/helpers/filter_helpers.rb +++ b/lib/cuke_slicer/helpers/filter_helpers.rb @@ -1,3 +1,5 @@ +# Internal helper module that is not part of the public API. Subject to change at any time. +# :nodoc: all module CukeSlicer module FilterHelpers diff --git a/lib/cuke_slicer/helpers/helpers.rb b/lib/cuke_slicer/helpers/helpers.rb index 6a42733..d90d681 100644 --- a/lib/cuke_slicer/helpers/helpers.rb +++ b/lib/cuke_slicer/helpers/helpers.rb @@ -1,3 +1,5 @@ +# Internal helper module that is not part of the public API. Subject to change at any time. +# :nodoc: all module CukeSlicer module Helpers diff --git a/lib/cuke_slicer/helpers/matching_helpers.rb b/lib/cuke_slicer/helpers/matching_helpers.rb index cef0a45..7c68d21 100644 --- a/lib/cuke_slicer/helpers/matching_helpers.rb +++ b/lib/cuke_slicer/helpers/matching_helpers.rb @@ -1,3 +1,5 @@ +# Internal helper module that is not part of the public API. Subject to change at any time. +# :nodoc: all module CukeSlicer module MatchingHelpers From 76b0d7130c0c2b6735bbf605930424f4da41e0bc Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Tue, 30 Apr 2019 23:26:20 -0400 Subject: [PATCH 20/21] Updated CHANGELOG Updated the CHANGELOG in preparation for the upcoming release. --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a66af1..cbc3eda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +Nothing yet... + + +## [2.0.3] - 2019-05-01 + ### Added - Add dependency version limits to Ruby, which was previously unbound. Previously unofficially supported Ruby versions (1.9.3 - 2.x) are now officially supported. @@ -43,7 +48,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release -[Unreleased]: https://github.com/grange-insurance/cuke_slicer/compare/v2.0.2...HEAD +[Unreleased]: https://github.com/grange-insurance/cuke_slicer/compare/v2.0.3...HEAD +[2.0.3]: https://github.com/grange-insurance/cuke_slicer/compare/v2.0.2...v2.0.3 [2.0.2]: https://github.com/grange-insurance/cuke_slicer/compare/v2.0.1...v2.0.2 [2.0.1]: https://github.com/grange-insurance/cuke_slicer/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/grange-insurance/cuke_slicer/compare/v1.0.0...v2.0.0 From a39e35d7ab295d25e752de8524b517a07fffd8fb Mon Sep 17 00:00:00 2001 From: Eric Kessler Date: Tue, 30 Apr 2019 23:27:32 -0400 Subject: [PATCH 21/21] Bump version Incrementing the gem version to 2.0.3 in preparation for the upcoming release. --- lib/cuke_slicer/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cuke_slicer/version.rb b/lib/cuke_slicer/version.rb index 8d2ca2f..c1fcd82 100644 --- a/lib/cuke_slicer/version.rb +++ b/lib/cuke_slicer/version.rb @@ -1,4 +1,4 @@ module CukeSlicer # The current version for the gem. - VERSION = "2.0.2" + VERSION = "2.0.3" end