aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library/rexml/text/read_with_substitution_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/rexml/text/read_with_substitution_spec.rb')
-rw-r--r--spec/ruby/library/rexml/text/read_with_substitution_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/library/rexml/text/read_with_substitution_spec.rb b/spec/ruby/library/rexml/text/read_with_substitution_spec.rb
new file mode 100644
index 0000000000..7e42c40248
--- /dev/null
+++ b/spec/ruby/library/rexml/text/read_with_substitution_spec.rb
@@ -0,0 +1,13 @@
+require File.expand_path('../../../../spec_helper', __FILE__)
+require 'rexml/document'
+
+describe "REXML::Text.read_with_substitution" do
+ it "reads a text and escapes entities" do
+ REXML::Text.read_with_substitution("&lt; &gt; &amp; &quot; &apos;").should == "< > & \" '"
+ end
+
+ it "accepts an regex for invalid expressions and raises an error if text matches" do
+ lambda {REXML::Text.read_with_substitution("this is illegal", /illegal/)}.should raise_error(Exception)
+ end
+end
+