From 41bfb1739277cef4679343a5aed32db06b47b729 Mon Sep 17 00:00:00 2001 From: Jason Garber Date: Wed, 13 Dec 2023 22:31:24 -0500 Subject: [PATCH 1/3] RuboCop: RSpec/MultipleExpectations --- spec/lib/svgeez/builder_build_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/lib/svgeez/builder_build_spec.rb b/spec/lib/svgeez/builder_build_spec.rb index 16b8505..b89fea3 100644 --- a/spec/lib/svgeez/builder_build_spec.rb +++ b/spec/lib/svgeez/builder_build_spec.rb @@ -19,14 +19,14 @@ allow(File).to receive(:directory?).and_return(false) end - it "logs an error" do + it "logs an error", :aggregate_failures do expect { described_class.new.build }.to raise_error(SystemExit) expect(logger).to have_received(:error).with("Provided `source` folder does not exist.") end end context "when @source and @destination are the same" do - it "logs an error" do + it "logs an error", :aggregate_failures do builder = described_class.new( "source" => "./foo", "destination" => "./foo" @@ -37,7 +37,7 @@ end end - context "when @destination is nested within @source" do + context "when @destination is nested within @source", :aggregate_failures do it "logs an error" do builder = described_class.new( "source" => "./foo", @@ -77,7 +77,7 @@ end context "when @svgo is not specified" do - it "writes a file" do + it "writes a file", :aggregate_failures do described_class.new( "source" => source_folder_path, "destination" => "./spec/fixtures/icons.svg" @@ -89,7 +89,7 @@ end context "when @svgo is specified" do - it "writes a file" do + it "writes a file", :aggregate_failures do described_class.new( "source" => source_folder_path, "destination" => "./spec/fixtures/icons-svgo.svg", From 9d7081b31a1b37f2daf4ecfaaf57d3f7ed0657a4 Mon Sep 17 00:00:00 2001 From: Jason Garber Date: Wed, 13 Dec 2023 22:52:46 -0500 Subject: [PATCH 2/3] RuboCop: Style/StringLiteralsInInterpolation --- lib/svgeez/elements/symbol_element.rb | 2 +- spec/lib/svgeez/builder_build_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/svgeez/elements/symbol_element.rb b/lib/svgeez/elements/symbol_element.rb index 71361a7..1172f50 100644 --- a/lib/svgeez/elements/symbol_element.rb +++ b/lib/svgeez/elements/symbol_element.rb @@ -10,7 +10,7 @@ def initialize(file_path, file_id) def build File.read(@file_path).match(%r{^.*?)>(?.*?)}m) do |matches| - %(#{element_contents(matches[:content])}) + "#{element_contents(matches[:content])}" end end diff --git a/spec/lib/svgeez/builder_build_spec.rb b/spec/lib/svgeez/builder_build_spec.rb index b89fea3..3b28af3 100644 --- a/spec/lib/svgeez/builder_build_spec.rb +++ b/spec/lib/svgeez/builder_build_spec.rb @@ -96,7 +96,7 @@ "svgo" => true ).build - expect(file).to have_received(:write).with(%(#{File.read("./spec/fixtures/icons-svgo.svg")}\n)) + expect(file).to have_received(:write).with("#{File.read('./spec/fixtures/icons-svgo.svg')}\n") expect(logger).to have_received(:info).exactly(:twice) end end From 1d73a537771609aab7550b274732b7725802cb42 Mon Sep 17 00:00:00 2001 From: Jason Garber Date: Wed, 13 Dec 2023 23:19:40 -0500 Subject: [PATCH 3/3] RuboCop: RSpec/ReceiveMessages --- spec/lib/svgeez/builder_build_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/lib/svgeez/builder_build_spec.rb b/spec/lib/svgeez/builder_build_spec.rb index 3b28af3..adadddf 100644 --- a/spec/lib/svgeez/builder_build_spec.rb +++ b/spec/lib/svgeez/builder_build_spec.rb @@ -70,10 +70,10 @@ allow(file).to receive(:write) - file_paths = %w[facebook github heart skull twitter].map { |i| "./spec/fixtures/icons/#{i}.svg" } - - allow(source).to receive(:file_paths).and_return(file_paths) - allow(source).to receive(:folder_path).and_return(File.expand_path(source_folder_path)) + allow(source).to receive_messages( + file_paths: %w[facebook github heart skull twitter].map { |i| "./spec/fixtures/icons/#{i}.svg" }, + folder_path: File.expand_path(source_folder_path) + ) end context "when @svgo is not specified" do