Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore folders that either start or end with spec or test, which will… #65

Merged
merged 3 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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