40 lines
1.1 KiB
Ruby
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("<br />")
|
|
expect(rendered).not_to include("<")
|
|
|
|
expect(rendered).to include("The next morning")
|
|
end
|
|
end
|
|
end
|