diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-20 20:18:52 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-20 20:18:52 +0000 |
commit | 1d15d5f08032acf1b7bceacbb450d617ff6e0931 (patch) | |
tree | a3785a79899302bc149e4a6e72f624ac27dc1f10 /spec/ruby/library/rexml/cdata | |
parent | 75bfc6440d595bf339007f4fb280fd4d743e89c1 (diff) |
Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory.
[Misc #13792] [ruby-core:82287]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/rexml/cdata')
-rw-r--r-- | spec/ruby/library/rexml/cdata/clone_spec.rb | 10 | ||||
-rw-r--r-- | spec/ruby/library/rexml/cdata/initialize_spec.rb | 24 | ||||
-rw-r--r-- | spec/ruby/library/rexml/cdata/shared/to_s.rb | 11 | ||||
-rw-r--r-- | spec/ruby/library/rexml/cdata/to_s_spec.rb | 7 | ||||
-rw-r--r-- | spec/ruby/library/rexml/cdata/value_spec.rb | 7 |
5 files changed, 59 insertions, 0 deletions
diff --git a/spec/ruby/library/rexml/cdata/clone_spec.rb b/spec/ruby/library/rexml/cdata/clone_spec.rb new file mode 100644 index 0000000000..15dcf13a04 --- /dev/null +++ b/spec/ruby/library/rexml/cdata/clone_spec.rb @@ -0,0 +1,10 @@ +require File.expand_path('../../../../spec_helper', __FILE__) +require 'rexml/document' + +describe "REXML::CData#clone" do + it "makes a copy of itself" do + c = REXML::CData.new("some text") + c.clone.to_s.should == c.to_s + c.clone.should == c + end +end diff --git a/spec/ruby/library/rexml/cdata/initialize_spec.rb b/spec/ruby/library/rexml/cdata/initialize_spec.rb new file mode 100644 index 0000000000..bc0bc5cd6d --- /dev/null +++ b/spec/ruby/library/rexml/cdata/initialize_spec.rb @@ -0,0 +1,24 @@ +require File.expand_path('../../../../spec_helper', __FILE__) +require 'rexml/document' + +describe "REXML::CData#initialize" do + it "creates a new CData object" do + c = REXML::CData.new("some text") + c.should be_kind_of(REXML::CData) + c.should be_kind_of(REXML::Text) + end + + it "respects whitespace if whitespace is true" do + c = REXML::CData.new("whitespace test", true) + c1 = REXML::CData.new("whitespace test", false) + + c.to_s.should == "whitespace test" + c1.to_s.should == "whitespace test" + end + + it "receives parent as third argument" do + e = REXML::Element.new("root") + REXML::CData.new("test", true, e) + e.to_s.should == "<root><![CDATA[test]]></root>" + end +end diff --git a/spec/ruby/library/rexml/cdata/shared/to_s.rb b/spec/ruby/library/rexml/cdata/shared/to_s.rb new file mode 100644 index 0000000000..f8c4951c95 --- /dev/null +++ b/spec/ruby/library/rexml/cdata/shared/to_s.rb @@ -0,0 +1,11 @@ +describe :rexml_cdata_to_s, shared: true do + it "returns the contents of the CData" do + c = REXML::CData.new("some text") + c.send(@method).should == "some text" + end + + it "does not escape text" do + c1 = REXML::CData.new("some& text\n") + c1.send(@method).should == "some& text\n" + end +end diff --git a/spec/ruby/library/rexml/cdata/to_s_spec.rb b/spec/ruby/library/rexml/cdata/to_s_spec.rb new file mode 100644 index 0000000000..3fb233cdaf --- /dev/null +++ b/spec/ruby/library/rexml/cdata/to_s_spec.rb @@ -0,0 +1,7 @@ +require File.expand_path('../../../../spec_helper', __FILE__) +require File.expand_path('../shared/to_s', __FILE__) +require 'rexml/document' + +describe "REXML::CData#to_s" do + it_behaves_like :rexml_cdata_to_s, :to_s +end diff --git a/spec/ruby/library/rexml/cdata/value_spec.rb b/spec/ruby/library/rexml/cdata/value_spec.rb new file mode 100644 index 0000000000..f9af73c0f6 --- /dev/null +++ b/spec/ruby/library/rexml/cdata/value_spec.rb @@ -0,0 +1,7 @@ +require File.expand_path('../../../../spec_helper', __FILE__) +require File.expand_path('../shared/to_s', __FILE__) +require 'rexml/document' + +describe "REXML::CData#value" do + it_behaves_like :rexml_cdata_to_s, :value +end |