Skip to content

Commit

Permalink
Ignore folders that either start or end with spec or test, which will… (
Browse files Browse the repository at this point in the history
#65)

* Ignore folders that either start or end with spec or test, which will skip nested folders as well as top level

* Add test to verify nested spec folders are ignored

* Update changelog

Co-authored-by: bronzdoc <lsagastume1990@gmail.com>
  • Loading branch information
rdormer and bronzdoc authored Jan 25, 2021
1 parent 382fc62 commit d456a76
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
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).

## [Unreleased] Skip both nested and top level spec and test folders
## [Unreleased] [(commits)](https://github.com/fastruby/skunk/compare/v0.4.2...HEAD)

* [FEATURE] Share your results using an environment variable (by [@rahulpuroht]() and [@etagwerker]())
Expand Down
3 changes: 2 additions & 1 deletion lib/skunk/cli/commands/status_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def analysed_modules_count

def non_test_modules
@non_test_modules ||= analysed_modules.reject do |a_module|
a_module.pathname.to_s.start_with?("test", "spec")
module_path = a_module.pathname.dirname.to_s
module_path.start_with?("test", "spec") || module_path.end_with?("test", "spec")
end
end

Expand Down
5 changes: 5 additions & 0 deletions samples/engines/spec/nested_sample_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

def hello
puts "hello world"
end
8 changes: 8 additions & 0 deletions test/lib/skunk/cli/commands/status_reporter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ def analysed_module.churn
_(reporter.update_status_message).must_include output
_(reporter.update_status_message).must_include "Generated with Skunk v#{Skunk::VERSION}"
end

context "When there's nested spec files" do
let(:paths) { "samples" }
it "reports the SkunkScore" do
_(reporter.update_status_message).must_include output
_(reporter.update_status_message).must_include "Generated with Skunk v#{Skunk::VERSION}"
end
end
end
end

Expand Down

0 comments on commit d456a76

Please sign in to comment.