Skip to content

Commit

Permalink
Merge pull request #181 from tagliala/chore/use-explicit-rspec-describe
Browse files Browse the repository at this point in the history
Use non-monkey patched syntax `RSpec.describe`
  • Loading branch information
jamesmartin authored Dec 30, 2024
2 parents 087d347 + 22cd229 commit 3a12c9e
Show file tree
Hide file tree
Showing 25 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion spec/asset_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/cached_asset_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/finds_asset_paths_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'pathname'
require "inline_svg"

describe InlineSvg::FindsAssetPaths do
RSpec.describe InlineSvg::FindsAssetPaths do
after do
InlineSvg.reset_configuration!
end
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/inline_svg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:|
Expand Down
2 changes: 1 addition & 1 deletion spec/id_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
2 changes: 1 addition & 1 deletion spec/inline_svg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion spec/io_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/propshaft_asset_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spec/static_asset_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("<svg>Some document</svg>")
transformation = InlineSvg::TransformPipeline::Transformations::AriaAttributes.create_with_value({})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation = InlineSvg::TransformPipeline::Transformations::AriaHiddenAttribute.create_with_value(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation = InlineSvg::TransformPipeline::Transformations::ClassAttribute.create_with_value("some-class")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation = InlineSvg::TransformPipeline::Transformations::DataAttributes.create_with_value({ some: "value" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation = InlineSvg::TransformPipeline::Transformations::Description.create_with_value("Some Description")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation = InlineSvg::TransformPipeline::Transformations::Height.create_with_value("5%")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation = InlineSvg::TransformPipeline::Transformations::IdAttribute.create_with_value("some-id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation = InlineSvg::TransformPipeline::Transformations::PreserveAspectRatio.create_with_value("xMaxYMax meet")
Expand Down
2 changes: 1 addition & 1 deletion spec/transformation_pipeline/transformations/size_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation = InlineSvg::TransformPipeline::Transformations::Size.create_with_value("5% * 5%")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation =
Expand Down
2 changes: 1 addition & 1 deletion spec/transformation_pipeline/transformations/title_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation = InlineSvg::TransformPipeline::Transformations::Title.create_with_value("Some Title")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("<svg>Some document</svg>")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation =
Expand Down
2 changes: 1 addition & 1 deletion spec/transformation_pipeline/transformations/width_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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('<svg>Some document</svg>')
transformation = InlineSvg::TransformPipeline::Transformations::Width.create_with_value("5%")
Expand Down
2 changes: 1 addition & 1 deletion spec/transformation_pipeline/transformations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion spec/webpack_asset_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3a12c9e

Please sign in to comment.