From 22cd2291f4da30efe8b3d9baf08fd45830e8943c Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 15 Dec 2024 21:45:52 +0100 Subject: [PATCH] Use non-monkey patched syntax `RSpec.describe` Ref: https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/ --- spec/asset_file_spec.rb | 2 +- spec/cached_asset_file_spec.rb | 2 +- spec/finds_asset_paths_spec.rb | 2 +- spec/helpers/inline_svg_spec.rb | 2 +- spec/id_generator_spec.rb | 2 +- spec/inline_svg_spec.rb | 2 +- spec/io_resource_spec.rb | 2 +- spec/propshaft_asset_finder_spec.rb | 2 +- spec/static_asset_finder_spec.rb | 2 +- .../transformations/aria_attributes_spec.rb | 2 +- .../transformations/aria_hidden_attribute_spec.rb | 2 +- .../transformations/class_attribute_spec.rb | 2 +- .../transformations/data_attributes_spec.rb | 2 +- .../transformation_pipeline/transformations/description_spec.rb | 2 +- spec/transformation_pipeline/transformations/height_spec.rb | 2 +- .../transformations/id_attribute_spec.rb | 2 +- .../transformations/preserve_aspect_ratio_spec.rb | 2 +- spec/transformation_pipeline/transformations/size_spec.rb | 2 +- .../transformations/style_attribute_spec.rb | 2 +- spec/transformation_pipeline/transformations/title_spec.rb | 2 +- .../transformations/transformation_spec.rb | 2 +- spec/transformation_pipeline/transformations/view_box_spec.rb | 2 +- spec/transformation_pipeline/transformations/width_spec.rb | 2 +- spec/transformation_pipeline/transformations_spec.rb | 2 +- spec/webpack_asset_finder_spec.rb | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/spec/asset_file_spec.rb b/spec/asset_file_spec.rb index 051dba2..f065ad7 100644 --- a/spec/asset_file_spec.rb +++ b/spec/asset_file_spec.rb @@ -3,7 +3,7 @@ require "inline_svg/finds_asset_paths" require "inline_svg/asset_file" -describe InlineSvg::AssetFile do +RSpec.describe InlineSvg::AssetFile do it "reads data from a file, after qualifying a full path" do example_svg_path = File.expand_path(__FILE__, 'files/example.svg') expect(InlineSvg::FindsAssetPaths).to receive(:by_filename).with('some filename').and_return example_svg_path diff --git a/spec/cached_asset_file_spec.rb b/spec/cached_asset_file_spec.rb index e3c14d9..97b3f52 100644 --- a/spec/cached_asset_file_spec.rb +++ b/spec/cached_asset_file_spec.rb @@ -3,7 +3,7 @@ require 'pathname' require "inline_svg" -describe InlineSvg::CachedAssetFile do +RSpec.describe InlineSvg::CachedAssetFile do let(:fixture_path) { Pathname.new(File.expand_path('files/static_assets', __dir__)) } it "loads assets under configured paths" do diff --git a/spec/finds_asset_paths_spec.rb b/spec/finds_asset_paths_spec.rb index c1fec29..f7707ef 100644 --- a/spec/finds_asset_paths_spec.rb +++ b/spec/finds_asset_paths_spec.rb @@ -3,7 +3,7 @@ require 'pathname' require "inline_svg" -describe InlineSvg::FindsAssetPaths do +RSpec.describe InlineSvg::FindsAssetPaths do after do InlineSvg.reset_configuration! end diff --git a/spec/helpers/inline_svg_spec.rb b/spec/helpers/inline_svg_spec.rb index 5e167a0..356ec36 100644 --- a/spec/helpers/inline_svg_spec.rb +++ b/spec/helpers/inline_svg_spec.rb @@ -11,7 +11,7 @@ def transform(doc) end end -describe InlineSvg::ActionView::Helpers do +RSpec.describe InlineSvg::ActionView::Helpers do let(:helper) { (Class.new { include InlineSvg::ActionView::Helpers }).new } shared_examples "inline_svg helper" do |helper_method:| diff --git a/spec/id_generator_spec.rb b/spec/id_generator_spec.rb index f685281..97e28f4 100644 --- a/spec/id_generator_spec.rb +++ b/spec/id_generator_spec.rb @@ -2,7 +2,7 @@ require "inline_svg/id_generator" -describe InlineSvg::IdGenerator do +RSpec.describe InlineSvg::IdGenerator do it "generates a hexencoded ID based on a salt and a random value" do randomizer = -> { "some-random-value" } diff --git a/spec/inline_svg_spec.rb b/spec/inline_svg_spec.rb index 9f31222..da51204 100644 --- a/spec/inline_svg_spec.rb +++ b/spec/inline_svg_spec.rb @@ -19,7 +19,7 @@ class MyCustomAssetFile def self.named(filename); end end -describe InlineSvg do +RSpec.describe InlineSvg do describe "configuration" do after do InlineSvg.reset_configuration! diff --git a/spec/io_resource_spec.rb b/spec/io_resource_spec.rb index c9f2d9b..2022d65 100644 --- a/spec/io_resource_spec.rb +++ b/spec/io_resource_spec.rb @@ -4,7 +4,7 @@ require "stringio" require "tempfile" -describe InlineSvg::IOResource do +RSpec.describe InlineSvg::IOResource do it "support api methods" do is_expected.to respond_to(:===, :read) end diff --git a/spec/propshaft_asset_finder_spec.rb b/spec/propshaft_asset_finder_spec.rb index cbe8549..0294d4f 100644 --- a/spec/propshaft_asset_finder_spec.rb +++ b/spec/propshaft_asset_finder_spec.rb @@ -2,7 +2,7 @@ require "inline_svg" -describe InlineSvg::PropshaftAssetFinder do +RSpec.describe InlineSvg::PropshaftAssetFinder do context "when the file is not found" do it "returns nil" do stub_const('Rails', double('Rails').as_null_object) diff --git a/spec/static_asset_finder_spec.rb b/spec/static_asset_finder_spec.rb index fc67a28..57835d1 100644 --- a/spec/static_asset_finder_spec.rb +++ b/spec/static_asset_finder_spec.rb @@ -2,7 +2,7 @@ require "inline_svg" -describe InlineSvg::StaticAssetFinder do +RSpec.describe InlineSvg::StaticAssetFinder do context "when the file is not found" do it "returns nil" do stub_const('Rails', double('Rails').as_null_object) diff --git a/spec/transformation_pipeline/transformations/aria_attributes_spec.rb b/spec/transformation_pipeline/transformations/aria_attributes_spec.rb index 71286dd..8976d7e 100644 --- a/spec/transformation_pipeline/transformations/aria_attributes_spec.rb +++ b/spec/transformation_pipeline/transformations/aria_attributes_spec.rb @@ -2,7 +2,7 @@ require "inline_svg/transform_pipeline" -describe InlineSvg::TransformPipeline::Transformations::AriaAttributes do +RSpec.describe InlineSvg::TransformPipeline::Transformations::AriaAttributes do it "adds a role attribute to the SVG document" do document = Nokogiri::XML::Document.parse("Some document") transformation = InlineSvg::TransformPipeline::Transformations::AriaAttributes.create_with_value({}) diff --git a/spec/transformation_pipeline/transformations/aria_hidden_attribute_spec.rb b/spec/transformation_pipeline/transformations/aria_hidden_attribute_spec.rb index 49b574e..e258af2 100644 --- a/spec/transformation_pipeline/transformations/aria_hidden_attribute_spec.rb +++ b/spec/transformation_pipeline/transformations/aria_hidden_attribute_spec.rb @@ -2,7 +2,7 @@ require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::AriaHiddenAttribute do +RSpec.describe InlineSvg::TransformPipeline::Transformations::AriaHiddenAttribute do it "adds an aria-hidden='true' attribute to a SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = InlineSvg::TransformPipeline::Transformations::AriaHiddenAttribute.create_with_value(true) diff --git a/spec/transformation_pipeline/transformations/class_attribute_spec.rb b/spec/transformation_pipeline/transformations/class_attribute_spec.rb index e12f13a..4925081 100644 --- a/spec/transformation_pipeline/transformations/class_attribute_spec.rb +++ b/spec/transformation_pipeline/transformations/class_attribute_spec.rb @@ -2,7 +2,7 @@ require "inline_svg/transform_pipeline" -describe InlineSvg::TransformPipeline::Transformations::ClassAttribute do +RSpec.describe InlineSvg::TransformPipeline::Transformations::ClassAttribute do it "adds a class attribute to a SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = InlineSvg::TransformPipeline::Transformations::ClassAttribute.create_with_value("some-class") diff --git a/spec/transformation_pipeline/transformations/data_attributes_spec.rb b/spec/transformation_pipeline/transformations/data_attributes_spec.rb index 3876b0f..428c3d3 100644 --- a/spec/transformation_pipeline/transformations/data_attributes_spec.rb +++ b/spec/transformation_pipeline/transformations/data_attributes_spec.rb @@ -2,7 +2,7 @@ require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::DataAttributes do +RSpec.describe InlineSvg::TransformPipeline::Transformations::DataAttributes do it "adds a data attribute to a SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = InlineSvg::TransformPipeline::Transformations::DataAttributes.create_with_value({ some: "value" }) diff --git a/spec/transformation_pipeline/transformations/description_spec.rb b/spec/transformation_pipeline/transformations/description_spec.rb index c5ff8a7..03395f9 100644 --- a/spec/transformation_pipeline/transformations/description_spec.rb +++ b/spec/transformation_pipeline/transformations/description_spec.rb @@ -2,7 +2,7 @@ require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::Description do +RSpec.describe InlineSvg::TransformPipeline::Transformations::Description do it "adds a desc element to the SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = InlineSvg::TransformPipeline::Transformations::Description.create_with_value("Some Description") diff --git a/spec/transformation_pipeline/transformations/height_spec.rb b/spec/transformation_pipeline/transformations/height_spec.rb index 7d91a64..f2533a5 100644 --- a/spec/transformation_pipeline/transformations/height_spec.rb +++ b/spec/transformation_pipeline/transformations/height_spec.rb @@ -2,7 +2,7 @@ require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::Height do +RSpec.describe InlineSvg::TransformPipeline::Transformations::Height do it "adds height attribute to a SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = InlineSvg::TransformPipeline::Transformations::Height.create_with_value("5%") diff --git a/spec/transformation_pipeline/transformations/id_attribute_spec.rb b/spec/transformation_pipeline/transformations/id_attribute_spec.rb index 4b1b598..d315a6d 100644 --- a/spec/transformation_pipeline/transformations/id_attribute_spec.rb +++ b/spec/transformation_pipeline/transformations/id_attribute_spec.rb @@ -2,7 +2,7 @@ require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::IdAttribute do +RSpec.describe InlineSvg::TransformPipeline::Transformations::IdAttribute do it "adds an id attribute to a SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = InlineSvg::TransformPipeline::Transformations::IdAttribute.create_with_value("some-id") diff --git a/spec/transformation_pipeline/transformations/preserve_aspect_ratio_spec.rb b/spec/transformation_pipeline/transformations/preserve_aspect_ratio_spec.rb index 0b7e6a5..5a6e0ab 100644 --- a/spec/transformation_pipeline/transformations/preserve_aspect_ratio_spec.rb +++ b/spec/transformation_pipeline/transformations/preserve_aspect_ratio_spec.rb @@ -2,7 +2,7 @@ require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::PreserveAspectRatio do +RSpec.describe InlineSvg::TransformPipeline::Transformations::PreserveAspectRatio do it "adds preserveAspectRatio attribute to a SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = InlineSvg::TransformPipeline::Transformations::PreserveAspectRatio.create_with_value("xMaxYMax meet") diff --git a/spec/transformation_pipeline/transformations/size_spec.rb b/spec/transformation_pipeline/transformations/size_spec.rb index 8f0ca99..96f7a23 100644 --- a/spec/transformation_pipeline/transformations/size_spec.rb +++ b/spec/transformation_pipeline/transformations/size_spec.rb @@ -2,7 +2,7 @@ require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::Size do +RSpec.describe InlineSvg::TransformPipeline::Transformations::Size do it "adds width and height attributes to a SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = InlineSvg::TransformPipeline::Transformations::Size.create_with_value("5% * 5%") diff --git a/spec/transformation_pipeline/transformations/style_attribute_spec.rb b/spec/transformation_pipeline/transformations/style_attribute_spec.rb index a439002..bc63fa8 100644 --- a/spec/transformation_pipeline/transformations/style_attribute_spec.rb +++ b/spec/transformation_pipeline/transformations/style_attribute_spec.rb @@ -2,7 +2,7 @@ require "inline_svg/transform_pipeline" -describe InlineSvg::TransformPipeline::Transformations::ClassAttribute do +RSpec.describe InlineSvg::TransformPipeline::Transformations::ClassAttribute do it "adds a style attribute to a SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = diff --git a/spec/transformation_pipeline/transformations/title_spec.rb b/spec/transformation_pipeline/transformations/title_spec.rb index 647eb9e..9b96ab9 100644 --- a/spec/transformation_pipeline/transformations/title_spec.rb +++ b/spec/transformation_pipeline/transformations/title_spec.rb @@ -2,7 +2,7 @@ require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::Title do +RSpec.describe InlineSvg::TransformPipeline::Transformations::Title do it "adds a title element as the first element in the SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = InlineSvg::TransformPipeline::Transformations::Title.create_with_value("Some Title") diff --git a/spec/transformation_pipeline/transformations/transformation_spec.rb b/spec/transformation_pipeline/transformations/transformation_spec.rb index 8c98cba..631b4ba 100644 --- a/spec/transformation_pipeline/transformations/transformation_spec.rb +++ b/spec/transformation_pipeline/transformations/transformation_spec.rb @@ -3,7 +3,7 @@ require 'inline_svg' require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::Transformation do +RSpec.describe InlineSvg::TransformPipeline::Transformations::Transformation do describe "#with_svg" do it "returns a Nokogiri::XML::Document representing the parsed document fragment" do document = Nokogiri::XML::Document.parse("Some document") diff --git a/spec/transformation_pipeline/transformations/view_box_spec.rb b/spec/transformation_pipeline/transformations/view_box_spec.rb index 3447e68..36b3366 100644 --- a/spec/transformation_pipeline/transformations/view_box_spec.rb +++ b/spec/transformation_pipeline/transformations/view_box_spec.rb @@ -2,7 +2,7 @@ require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::ViewBox do +RSpec.describe InlineSvg::TransformPipeline::Transformations::ViewBox do it "adds viewBox attribute to a SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = diff --git a/spec/transformation_pipeline/transformations/width_spec.rb b/spec/transformation_pipeline/transformations/width_spec.rb index 38118a6..508374f 100644 --- a/spec/transformation_pipeline/transformations/width_spec.rb +++ b/spec/transformation_pipeline/transformations/width_spec.rb @@ -2,7 +2,7 @@ require 'inline_svg/transform_pipeline' -describe InlineSvg::TransformPipeline::Transformations::Width do +RSpec.describe InlineSvg::TransformPipeline::Transformations::Width do it "adds width attribute to a SVG document" do document = Nokogiri::XML::Document.parse('Some document') transformation = InlineSvg::TransformPipeline::Transformations::Width.create_with_value("5%") diff --git a/spec/transformation_pipeline/transformations_spec.rb b/spec/transformation_pipeline/transformations_spec.rb index 76ae416..1a63a82 100644 --- a/spec/transformation_pipeline/transformations_spec.rb +++ b/spec/transformation_pipeline/transformations_spec.rb @@ -11,7 +11,7 @@ def transform(doc) class ASecondCustomTransform < ACustomTransform; end -describe InlineSvg::TransformPipeline::Transformations do +RSpec.describe InlineSvg::TransformPipeline::Transformations do context "looking up transformations" do it "returns built-in transformations when parameters are supplied" do transformations = InlineSvg::TransformPipeline::Transformations.lookup( diff --git a/spec/webpack_asset_finder_spec.rb b/spec/webpack_asset_finder_spec.rb index 35a7f69..9b3c26a 100644 --- a/spec/webpack_asset_finder_spec.rb +++ b/spec/webpack_asset_finder_spec.rb @@ -2,7 +2,7 @@ require "inline_svg" -describe InlineSvg::WebpackAssetFinder do +RSpec.describe InlineSvg::WebpackAssetFinder do context "when the file is not found" do it "returns nil" do stub_const('Rails', double('Rails').as_null_object)