Skip to content

Commit

Permalink
fix: Fix content_fixer error when content is an integer (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
armandfardeau authored Aug 28, 2023
1 parent 52b9e17 commit 1cd3102
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/decidim/content_fixer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def repair
end

def find_and_replace(content)
return if content.nil?
return content unless content.is_a?(String) && content.include?(@deprecated_endpoint)

wrapper = nokogiri_will_wrap_with_p?(content) ? "p" : "body"

Expand Down
8 changes: 8 additions & 0 deletions spec/lib/decidim/content_fixer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@
expect(subject.find_and_replace(content)).to eq(nil)
end
end

context "when content is an integer" do
let(:content) { 1 }

it "returns an empty string" do
expect(subject.find_and_replace(content)).to eq(1)
end
end
end

describe "#new_source" do
Expand Down

0 comments on commit 1cd3102

Please sign in to comment.