Files
redux-scraper/spec/helpers/log_entries_helper_spec.rb
2025-02-25 19:59:41 +00:00

40 lines
1.1 KiB
Ruby

require "rails_helper"
RSpec.describe LogEntriesHelper, type: :helper do
describe "#render_msword_content" do
let(:log_entry) do
build(
:http_log_entry,
response:
build(
:blob_file,
content_type: "application/msword",
contents:
File.binread(
Rails.root.join(
"test/fixtures/files/5447897_Thakur_trials_13.doc",
),
),
),
)
end
it "returns the converted HTML content" do
rendered = helper.render_msword_content(log_entry)
expect(rendered).not_to be_nil
# no abiword header
expect(rendered).not_to include("Abiword HTML Document")
# no bbcode tags
expect(rendered).not_to include("[i]")
expect(rendered).not_to include("[b]")
# remove line breaks
expect(rendered).not_to include("<br />")
# remove escaped html tags
expect(rendered).not_to include("&lt;br /&gt;")
expect(rendered).not_to include("&lt;")
expect(rendered).to include("The next morning")
end
end
end