mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-08 22:56:06 +00:00
28 lines
651 B
Ruby
28 lines
651 B
Ruby
require 'spec_helper'
|
|
|
|
describe HtmlHelper do
|
|
class HelperStub
|
|
extend ActionView::Helpers::SanitizeHelper::ClassMethods
|
|
include ActionView::Helpers::SanitizeHelper
|
|
end
|
|
|
|
subject do
|
|
obj = HelperStub.new
|
|
obj.extend HtmlHelper
|
|
end
|
|
|
|
describe "stripping html from a string" do
|
|
it "strips tags" do
|
|
subject.strip_html('<p><b>Hello</b> <em>world</em>!</p>').should == 'Hello world!'
|
|
end
|
|
|
|
it "removes nbsp and amp entities" do
|
|
subject.strip_html('Hello world&&').should == 'Hello world&&'
|
|
end
|
|
|
|
it "returns nil for nil input" do
|
|
subject.strip_html(nil).should be_nil
|
|
end
|
|
end
|
|
end
|