/, saved.body
end
should 'be able to add image with alignment when textile' do
diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb
index 41ec6d0..69cc7f8 100644
--- a/test/functional/profile_editor_controller_test.rb
+++ b/test/functional/profile_editor_controller_test.rb
@@ -500,7 +500,7 @@ class ProfileEditorControllerTest < ActionController::TestCase
xhr :get, :update_categories, :profile => profile.identifier, :category_id => top.id
assert_template 'shared/update_categories'
assert_equal top, assigns(:current_category)
- assert_equal [c1, c2], assigns(:categories)
+ assert_equivalent [c1, c2], assigns(:categories)
end
should 'display manage my groups button for person' do
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 533299b..132349e 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -3,7 +3,6 @@ ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'rails/test_help'
require 'mocha'
-require 'hpricot'
require 'noosfero/test'
require 'authenticated_test_helper'
diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb
index 9bc2f95..cb5e63b 100644
--- a/test/unit/application_helper_test.rb
+++ b/test/unit/application_helper_test.rb
@@ -261,7 +261,7 @@ class ApplicationHelperTest < ActionView::TestCase
fast_create(Community, :is_template => true, :environment_id => environment.id)
environment.community_default_template= community
environment.save
-
+
assert_tag_in_string template_options(:communities, 'community'), :tag => 'input',
:attributes => { :name => "community[template_id]", :value => community.id, :checked => true }
end
@@ -273,7 +273,7 @@ class ApplicationHelperTest < ActionView::TestCase
fast_create(Person, :is_template => true, :environment_id => environment.id)
environment.person_default_template= person
environment.save
-
+
assert_tag_in_string template_options(:people, 'profile_data'), :tag => 'input',
:attributes => { :name => "profile_data[template_id]", :value => person.id, :checked => true }
end
@@ -287,7 +287,7 @@ class ApplicationHelperTest < ActionView::TestCase
environment.enterprise_default_template= enterprise
environment.save
environment.reload
-
+
assert_tag_in_string template_options(:enterprises, 'create_enterprise'), :tag => 'input',
:attributes => { :name => "create_enterprise[template_id]", :value => enterprise.id, :checked => true }
end
@@ -734,16 +734,16 @@ class ApplicationHelperTest < ActionView::TestCase
"
parsed_html = convert_macro(html, mock())
- parsed_divs = Hpricot(parsed_html).search('div')
- expected_divs = Hpricot("
- Test1
- Test2
+ parsed_divs = Nokogiri::HTML.fragment(parsed_html).css('div')
+ expected_divs = Nokogiri::HTML.fragment("
+ Test1
+ Test2
Unsupported macro unexistent!
- ").search('div')
+ ").css('div')
# comparing div attributes between parsed and expected html
parsed_divs.each_with_index do |div, i|
- assert_equal expected_divs[i].attributes.to_hash, div.attributes.to_hash
+ assert_equal expected_divs[i].attributes.to_xml, div.attributes.to_xml
assert_equal expected_divs[i].inner_text, div.inner_text
end
end
diff --git a/test/unit/comment_helper_test.rb b/test/unit/comment_helper_test.rb
index 91c3200..d24591c 100644
--- a/test/unit/comment_helper_test.rb
+++ b/test/unit/comment_helper_test.rb
@@ -137,7 +137,7 @@ class CommentHelperTest < ActiveSupport::TestCase
plugin_action = {:link => 'plugin_action', :action_bar => true}
@plugins.stubs(:dispatch).returns([plugin_action])
html = comment_actions(comment)
- assert_match /plugin_action/, Hpricot(html).search('.comments-action-bar').html
+ assert_match /plugin_action/, Nokogiri::HTML.fragment(html).css('.comments-action-bar').to_html
end
def link_to_function(content, url, options = {})
diff --git a/test/unit/external_feed_test.rb b/test/unit/external_feed_test.rb
index f6e299d..9375a06 100644
--- a/test/unit/external_feed_test.rb
+++ b/test/unit/external_feed_test.rb
@@ -166,7 +166,7 @@ class ExternalFeedTest < ActiveSupport::TestCase
next if a.kind_of?(RssFeed)
dd << a.body.to_s.strip.gsub(/\s+/, ' ')
end
- assert_equal '
Html content 1.
Html content 2.
', dd.sort.join
+ assert_equal '
Html content 1.
Html content 2.
', dd.sort.join
end
should 'use feed title as author name' do
diff --git a/test/unit/macro_test.rb b/test/unit/macro_test.rb
index 647f551..6d60534 100644
--- a/test/unit/macro_test.rb
+++ b/test/unit/macro_test.rb
@@ -15,7 +15,7 @@ class MacroTest < ActiveSupport::TestCase
def setup
@macro = Plugin1::Macro.new
- @macro_element = Hpricot(MACRO).search('.macro').first
+ @macro_element = Nokogiri::HTML.fragment(MACRO).css('.macro').first
end
attr_reader :macro, :macro_element
diff --git a/test/unit/text_article_test.rb b/test/unit/text_article_test.rb
index a3f9149..500acb8 100644
--- a/test/unit/text_article_test.rb
+++ b/test/unit/text_article_test.rb
@@ -1,9 +1,9 @@
require_relative "../test_helper"
class TextArticleTest < ActiveSupport::TestCase
-
+
# mostly dummy test. Can be removed when (if) there are real tests for this
- # this class.
+ # this class.
should 'inherit from Article' do
assert_kind_of Article, TextArticle.new
end
@@ -44,7 +44,7 @@ class TextArticleTest < ActiveSupport::TestCase
env = Environment.default
article.body = "
"
article.save!
- assert_equal "
", article.body
+ assert_equal "
", article.body
end
should 'change link to relative path' do
@@ -60,18 +60,18 @@ class TextArticleTest < ActiveSupport::TestCase
person = create_user('testuser').person
article = TextArticle.new(:profile => person, :name => 'test')
env = Environment.default
- article.body = "
"
+ article.body = "
"
article.save!
- assert_equal "
", article.body
+ assert_equal "
", article.body
end
should 'change image path to relative for domain with port' do
person = create_user('testuser').person
article = TextArticle.new(:profile => person, :name => 'test')
env = Environment.default
- article.body = "
"
+ article.body = "
"
article.save!
- assert_equal "
", article.body
+ assert_equal "
", article.body
end
should 'change image path to relative for domain with www' do
@@ -80,16 +80,16 @@ class TextArticleTest < ActiveSupport::TestCase
env = Environment.default
env.force_www = true
env.save!
- article.body = "
"
+ article.body = "
"
article.save!
- assert_equal "
", article.body
+ assert_equal "
", article.body
end
should 'not be translatable if there is no language available on environment' do
environment = fast_create(Environment)
environment.languages = nil
profile = fast_create(Person, :environment_id => environment.id)
-
+
text = TextArticle.new(:profile => profile)
assert !text.translatable?
@@ -102,11 +102,10 @@ class TextArticleTest < ActiveSupport::TestCase
text = fast_create(TextArticle, :profile_id => profile.id)
assert !text.translatable?
-
environment.languages = ['en','pt','fr']
environment.save
- text.reload
+ text.reload
assert text.translatable?
end
diff --git a/vendor/cardmagic-contacts-f66219e6589ccaf3ab9e3574fdd41225d0dd5073/lib/contacts/aol.rb b/vendor/cardmagic-contacts-f66219e6589ccaf3ab9e3574fdd41225d0dd5073/lib/contacts/aol.rb
index 27eddcb..fb0f91d 100644
--- a/vendor/cardmagic-contacts-f66219e6589ccaf3ab9e3574fdd41225d0dd5073/lib/contacts/aol.rb
+++ b/vendor/cardmagic-contacts-f66219e6589ccaf3ab9e3574fdd41225d0dd5073/lib/contacts/aol.rb
@@ -8,20 +8,19 @@ class Hash
end
class Contacts
- require 'hpricot'
class Aol < Base
URL = "http://www.aol.com/"
LOGIN_URL = "https://my.screenname.aol.com/_cqr/login/login.psp"
LOGIN_REFERER_URL = "http://webmail.aol.com/"
LOGIN_REFERER_PATH = "sitedomain=sns.webmail.aol.com&lang=en&locale=us&authLev=0&uitype=mini&loginId=&redirType=js&xchk=false"
AOL_NUM = "29970-343" # this seems to change each time they change the protocol
-
+
CONTACT_LIST_URL = "http://webmail.aol.com/#{AOL_NUM}/aim-2/en-us/Lite/ContactList.aspx?folder=Inbox&showUserFolders=False"
CONTACT_LIST_CSV_URL = "http://webmail.aol.com/#{AOL_NUM}/aim-2/en-us/Lite/ABExport.aspx?command=all"
PROTOCOL_ERROR = "AOL has changed its protocols, please upgrade this library first. If that does not work, dive into the code and submit a patch at http://github.com/cardmagic/contacts"
-
+
def real_connect
-
+
postdata = {
"loginId" => login,
"password" => password,
@@ -62,15 +61,15 @@ class Contacts
until forward.nil?
data, resp, cookies, forward, old_url = get(forward, cookies, old_url) + [forward]
end
-
+
data, resp, cookies, forward, old_url = get("#{LOGIN_URL}?#{LOGIN_REFERER_PATH}", cookies) + [LOGIN_REFERER_URL]
until forward.nil?
data, resp, cookies, forward, old_url = get(forward, cookies, old_url) + [forward]
end
- doc = Hpricot(data)
- (doc/:input).each do |input|
- postdata["usrd"] = input.attributes["value"] if input.attributes["name"] == "usrd"
+ doc = Nokogiri::HTML.fragment data
+ doc.css('input').each do |input|
+ postdata["usrd"] = input["value"] if input["name"] == "usrd"
end
# parse data for and add it to the postdata
@@ -78,13 +77,13 @@ class Contacts
postdata["SNS_LDC"] = cookie_hash_from_string(cookies)["SNS_LDC"]
postdata["LTState"] = cookie_hash_from_string(cookies)["LTState"]
# raise data.inspect
-
+
data, resp, cookies, forward, old_url = post(LOGIN_URL, postdata.to_query_string, cookies, LOGIN_REFERER_URL) + [LOGIN_REFERER_URL]
-
+
until forward.nil?
data, resp, cookies, forward, old_url = get(forward, cookies, old_url) + [forward]
end
-
+
if data.index("Invalid Screen Name or Password.")
raise AuthenticationError, "Username and password do not match"
elsif data.index("Required field must not be blank")
@@ -113,19 +112,19 @@ class Contacts
until forward.nil?
data, resp, cookies, forward, old_url = get(forward, cookies, old_url) + [forward]
end
-
+
if resp.code_type != Net::HTTPOK
raise ConnectionError, self.class.const_get(:PROTOCOL_ERROR)
end
# parse data and grab
- doc = Hpricot(data)
- (doc/:input).each do |input|
- postdata["user"] = input.attributes["value"] if input.attributes["name"] == "user"
+ doc = Nokogiri::HTML.fragment data
+ doc.css('input').each do |input|
+ postdata["user"] = input["value"] if input["name"] == "user"
end
-
+
data, resp, cookies, forward, old_url = get(CONTACT_LIST_CSV_URL, @cookies, CONTACT_LIST_URL) + [CONTACT_LIST_URL]
-
+
if forward.nil?
parse data
else
@@ -134,15 +133,15 @@ class Contacts
end
end
private
-
+
def parse(data, options={})
data = CSV.parse(data)
col_names = data.shift
@contacts = data.map do |person|
["#{person[0]} #{person[1]}", person[4]] unless person[4].empty?
end.compact
- end
+ end
end
TYPES[:aol] = Aol
-end
\ No newline at end of file
+end
diff --git a/vendor/plugins/ruby_bosh/Rakefile b/vendor/plugins/ruby_bosh/Rakefile
index bfa451c..417877c 100644
--- a/vendor/plugins/ruby_bosh/Rakefile
+++ b/vendor/plugins/ruby_bosh/Rakefile
@@ -12,7 +12,7 @@ begin
s.add_dependency("builder")
s.add_dependency("rest-client")
- s.add_dependency("hpricot")
+ s.add_dependency("nokogiri")
s.add_dependency("SystemTimer")
end
rescue LoadError
diff --git a/vendor/plugins/ruby_bosh/lib/ruby_bosh.rb b/vendor/plugins/ruby_bosh/lib/ruby_bosh.rb
index 401f270..b5cfa23 100644
--- a/vendor/plugins/ruby_bosh/lib/ruby_bosh.rb
+++ b/vendor/plugins/ruby_bosh/lib/ruby_bosh.rb
@@ -2,10 +2,10 @@ require 'rest_client'
require 'builder'
require 'rexml/document'
require 'base64'
-require 'hpricot'
+require 'nokogiri'
require 'timeout'
-class RubyBOSH
+class RubyBOSH
BOSH_XMLNS = 'http://jabber.org/protocol/httpbind'
TLS_XMLNS = 'urn:ietf:params:xml:ns:xmpp-tls'
SASL_XMLNS = 'urn:ietf:params:xml:ns:xmpp-sasl'
@@ -24,12 +24,12 @@ class RubyBOSH
end
attr_accessor :jid, :rid, :sid, :success
- def initialize(jid, pw, service_url, opts={})
+ def initialize(jid, pw, service_url, opts={})
@service_url = service_url
@jid, @pw = jid, pw
@host = jid.split("@").last
@success = false
- @timeout = opts[:timeout] || 3 #seconds
+ @timeout = opts[:timeout] || 3 #seconds
@headers = {"Content-Type" => "text/xml; charset=utf-8",
"Accept" => "text/xml"}
@wait = opts[:wait] || 5
@@ -47,7 +47,7 @@ class RubyBOSH
def connect
initialize_bosh_session
- if send_auth_request
+ if send_auth_request
send_restart_request
request_resource_binding
@success = send_session_request
@@ -55,12 +55,12 @@ class RubyBOSH
raise RubyBOSH::AuthFailed, "could not authenticate #{@jid}" unless success?
@rid += 1 #updates the rid for the next call from the browser
-
+
[@jid, @sid, @rid]
end
private
- def initialize_bosh_session
+ def initialize_bosh_session
response = deliver(construct_body(:wait => @wait, :to => @host,
:hold => @hold, :window => @window,
"xmpp:version" => '1.0'))
@@ -72,7 +72,7 @@ class RubyBOSH
builder = Builder::XmlMarkup.new
parameters = {:rid => @rid, :xmlns => BOSH_XMLNS,
- "xmpp:version" => "1.0",
+ "xmpp:version" => "1.0",
"xmlns:xmpp" => "urn:xmpp:xbosh"}.merge(params)
if block_given?
@@ -82,10 +82,10 @@ class RubyBOSH
end
end
- def send_auth_request
+ def send_auth_request
request = construct_body(:sid => @sid) do |body|
- auth_string = "#{@jid}\x00#{@jid.split("@").first.strip}\x00#{@pw}"
- body.auth(Base64.encode64(auth_string).gsub(/\s/,''),
+ auth_string = "#{@jid}\x00#{@jid.split("@").first.strip}\x00#{@pw}"
+ body.auth(Base64.encode64(auth_string).gsub(/\s/,''),
:xmlns => SASL_XMLNS, :mechanism => 'PLAIN')
end
@@ -100,16 +100,16 @@ class RubyBOSH
def request_resource_binding
request = construct_body(:sid => @sid) do |body|
- body.iq(:id => "bind_#{rand(100000)}", :type => "set",
+ body.iq(:id => "bind_#{rand(100000)}", :type => "set",
:xmlns => "jabber:client") do |iq|
iq.bind(:xmlns => BIND_XMLNS) do |bind|
bind.resource("bosh_#{rand(10000)}")
end
end
end
-
+
response = deliver(request)
- response.include?("")
+ response.include?("")
end
def send_session_request
@@ -117,16 +117,16 @@ class RubyBOSH
body.iq(:xmlns => CLIENT_XMLNS, :type => "set",
:id => "sess_#{rand(100000)}") do |iq|
iq.session(:xmlns => SESSION_XMLNS)
- end
+ end
end
response = deliver(request)
- response.include?("body")
+ response.include?("body")
end
def parse(_response)
- doc = Hpricot(_response.to_s)
- doc.search("//body").each do |body|
+ doc = Nokogiri::HTML.fragment(_response.to_s)
+ doc.search("body").each do |body|
@sid = body.attributes["sid"].to_s
end
_response
@@ -156,6 +156,6 @@ end
if __FILE__ == $0
- p RubyBOSH.initialize_session(ARGV[0], ARGV[1],
+ p RubyBOSH.initialize_session(ARGV[0], ARGV[1],
"http://localhost:5280/http-bind")
end
diff --git a/vendor/plugins/ruby_bosh/ruby_bosh.gemspec b/vendor/plugins/ruby_bosh/ruby_bosh.gemspec
index 012d6ec..8d7fb14 100644
--- a/vendor/plugins/ruby_bosh/ruby_bosh.gemspec
+++ b/vendor/plugins/ruby_bosh/ruby_bosh.gemspec
@@ -24,18 +24,15 @@ Gem::Specification.new do |s|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q, [">= 0"])
s.add_runtime_dependency(%q, [">= 0"])
- s.add_runtime_dependency(%q, [">= 0"])
s.add_runtime_dependency(%q, [">= 0"])
else
s.add_dependency(%q, [">= 0"])
s.add_dependency(%q, [">= 0"])
- s.add_dependency(%q, [">= 0"])
s.add_dependency(%q, [">= 0"])
end
else
s.add_dependency(%q, [">= 0"])
s.add_dependency(%q, [">= 0"])
- s.add_dependency(%q, [">= 0"])
s.add_dependency(%q, [">= 0"])
end
end
--
libgit2 0.21.2