Skip to content

Commit

Permalink
Merge pull request #102 from nevinera/install-rspec-cover-it
Browse files Browse the repository at this point in the history
Install `rspec-cover_it`, and satisfy it for all specs
  • Loading branch information
nevinera authored Jun 13, 2023
2 parents bf1227d + dc3d8e0 commit eb85ade
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
8 changes: 6 additions & 2 deletions lib/quiet_quality/annotators.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
module QuietQuality
module Annotators
Unrecognized = Class.new(Error)
end
end

glob = File.expand_path("../annotators/*.rb", __FILE__)
Dir.glob(glob).sort.each { |f| require(f) }

module QuietQuality
module Annotators
Unrecognized = Class.new(Error)

ANNOTATOR_TYPES = {
github_stdout: Annotators::GithubStdout
}.freeze
Expand Down
1 change: 1 addition & 0 deletions quiet_quality.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rubocop", "~> 1.50"
spec.add_development_dependency "debug", "~> 1.7"
spec.add_development_dependency "mdl", "~> 0.12"
spec.add_development_dependency "rspec-cover_it", "~> 0.1.0"
end
15 changes: 15 additions & 0 deletions spec/quiet_quality/message_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
RSpec.describe QuietQuality::Message do
describe ".load" do
let(:data) { {path: "foo.rb", body: "some text", tool_name: :rspec, start_line: 52, level: "high"} }
subject(:loaded) { described_class.load(data) }
it { is_expected.to be_a(described_class) }

it "has the supplied attributes" do
expect(loaded.path).to eq("foo.rb")
expect(loaded.body).to eq("some text")
expect(loaded.tool_name).to eq(:rspec)
expect(loaded.start_line).to eq(52)
expect(loaded.level).to eq("high")
expect(loaded.rule).to be_nil
end
end

subject(:message) { described_class.new(**attributes) }

let(:attributes) do
Expand Down
2 changes: 1 addition & 1 deletion spec/quiet_quality_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RSpec.describe QuietQuality do
RSpec.describe QuietQuality, covers_path: "../lib/quiet_quality.rb" do
describe ".logger" do
subject(:logger) { described_class.logger }
it { is_expected.to be_a(QuietQuality::Logger) }
Expand Down
7 changes: 5 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "rspec"
require "rspec/its"
require "rspec/cover_it"
require "pry"

if ENV["SIMPLECOV"]
Expand Down Expand Up @@ -32,12 +33,14 @@ def format_group(name, files)
end
end

require File.expand_path("../../lib/quiet_quality", __FILE__)

gem_root = File.expand_path("../..", __FILE__)
FIXTURES_DIRECTORY = File.join(gem_root, "spec", "fixtures")
TEMP_DIRECTORY = File.join(gem_root, "tmp")

RSpec::CoverIt.setup(filter: gem_root, autoenforce: true)

require File.expand_path("../../lib/quiet_quality", __FILE__)

support_glob = File.join(gem_root, "spec", "support", "**", "*.rb")
Dir[support_glob].sort.each { |f| require f }

Expand Down

0 comments on commit eb85ade

Please sign in to comment.