From d22a98cd96ea4293c166e1394f6d7cae1acf39bd Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Wed, 25 Apr 2012 11:38:08 -0700 Subject: [PATCH] monkey patch to_xs for ruby 1.8, and fix a test as a result --- config/initializers/monkey_patch_to_xs.rb | 12 ++++++++++++ spec/controllers/users_controller_spec.rb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 config/initializers/monkey_patch_to_xs.rb diff --git a/config/initializers/monkey_patch_to_xs.rb b/config/initializers/monkey_patch_to_xs.rb new file mode 100644 index 000000000..cae9570f8 --- /dev/null +++ b/config/initializers/monkey_patch_to_xs.rb @@ -0,0 +1,12 @@ +#see https://github.com/hpricot/hpricot/issues/53 +if RUBY_VERSION < "1.9" + module Builder + class XmlBase + unless ::String.method_defined?(:encode) + def _escape(text) + text.to_xs + end + end + end + end +end \ No newline at end of file diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 9c8f52500..160d7269a 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -53,7 +53,7 @@ describe UsersController do p.save end get :public, :username => @user.username, :format => :atom - response.body.should include('<a href="http://diasporaproject.org/">http://diasporaproject.org/</a>') + response.body.should include('a href') end it 'redirects to a profile page if html is requested' do