Commit e562726f32be1cdaae882d947e44ab58018eb92d

Authored by Victor Costa
2 parents e70703a1 7fdbafc3

Merge branch 'rails3' into rails3_stable

Conflicts:
	Gemfile
@@ -16,6 +16,7 @@ gem 'hpricot' @@ -16,6 +16,7 @@ gem 'hpricot'
16 gem 'nokogiri' 16 gem 'nokogiri'
17 gem 'rake', :require => false 17 gem 'rake', :require => false
18 gem 'grape', '0.2.1' 18 gem 'grape', '0.2.1'
  19 +gem 'rest-client'
19 20
20 # FIXME list here all actual dependencies (i.e. the ones in debian/control), 21 # FIXME list here all actual dependencies (i.e. the ones in debian/control),
21 # with their GEM names (not the Debian package names) 22 # with their GEM names (not the Debian package names)
app/controllers/my_profile/cms_controller.rb
@@ -248,12 +248,15 @@ class CmsController < MyProfileController @@ -248,12 +248,15 @@ class CmsController < MyProfileController
248 end.compact unless params[:marked_groups].nil? 248 end.compact unless params[:marked_groups].nil?
249 if request.post? 249 if request.post?
250 @failed = {} 250 @failed = {}
  251 + if @marked_groups.empty?
  252 + return session[:notice] = _("Select some group to publish your article")
  253 + end
251 @marked_groups.each do |item| 254 @marked_groups.each do |item|
252 task = ApproveArticle.create!(:article => @article, :name => item[:name], :target => item[:group], :requestor => profile) 255 task = ApproveArticle.create!(:article => @article, :name => item[:name], :target => item[:group], :requestor => profile)
253 begin 256 begin
254 task.finish unless item[:group].moderated_articles? 257 task.finish unless item[:group].moderated_articles?
255 rescue Exception => ex 258 rescue Exception => ex
256 - @failed[ex.message] ? @failed[ex.message] << item[:group].name : @failed[ex.message] = [item[:group].name] 259 + @failed[ex.message] ? @failed[ex.message] << item[:group].name : @failed[ex.message] = [item[:group].name]
257 end 260 end
258 end 261 end
259 if @failed.blank? 262 if @failed.blank?
app/controllers/my_profile/friends_controller.rb
@@ -11,7 +11,7 @@ class FriendsController &lt; MyProfileController @@ -11,7 +11,7 @@ class FriendsController &lt; MyProfileController
11 def remove 11 def remove
12 @friend = profile.friends.find(params[:id]) 12 @friend = profile.friends.find(params[:id])
13 if request.post? && params[:confirmation] 13 if request.post? && params[:confirmation]
14 - profile.remove_friend(@friend) 14 + Friendship.remove_friendship(profile, @friend)
15 redirect_to :action => 'index' 15 redirect_to :action => 'index'
16 end 16 end
17 end 17 end
app/models/friendship.rb
@@ -15,4 +15,9 @@ class Friendship &lt; ActiveRecord::Base @@ -15,4 +15,9 @@ class Friendship &lt; ActiveRecord::Base
15 Friendship.update_cache_counter(:friends_count, friendship.person, -1) 15 Friendship.update_cache_counter(:friends_count, friendship.person, -1)
16 Friendship.update_cache_counter(:friends_count, friendship.friend, -1) 16 Friendship.update_cache_counter(:friends_count, friendship.friend, -1)
17 end 17 end
  18 +
  19 + def self.remove_friendship(person1, person2)
  20 + person1.remove_friend(person2)
  21 + person2.remove_friend(person1)
  22 + end
18 end 23 end
app/models/slideshow_block.rb
@@ -6,6 +6,8 @@ class SlideshowBlock &lt; Block @@ -6,6 +6,8 @@ class SlideshowBlock &lt; Block
6 settings_items :navigation, :type => 'boolean', :default => false 6 settings_items :navigation, :type => 'boolean', :default => false
7 settings_items :image_size, :type => 'string', :default => 'thumb' 7 settings_items :image_size, :type => 'string', :default => 'thumb'
8 8
  9 + attr_accessible :gallery_id, :image_size, :interval, :shuffle, :navigation
  10 +
9 def self.description 11 def self.description
10 _('Slideshow') 12 _('Slideshow')
11 end 13 end
app/views/cms/view.html.erb
@@ -25,7 +25,9 @@ @@ -25,7 +25,9 @@
25 <div id='article-full-path'> 25 <div id='article-full-path'>
26 <strong><%= _('Current folder: ') %></strong> 26 <strong><%= _('Current folder: ') %></strong>
27 <%= link_to profile.identifier, :action => 'index' %> 27 <%= link_to profile.identifier, :action => 'index' %>
28 - <%= @article.hierarchy.map {|item| " / " + ((item == @article) ? item.name : link_to(item.slug, :id => item.id)) } %> 28 + <% @article.hierarchy.each do |item| %>
  29 + <%= " / " + ((item == @article) ? item.name.html_safe : link_to(item.slug, :id => item.id).html_safe) %>
  30 + <% end %>
29 </div> 31 </div>
30 <% end %> 32 <% end %>
31 33
features/step_definitions/web_steps.rb
@@ -27,13 +27,13 @@ end @@ -27,13 +27,13 @@ end
27 27
28 When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector| 28 When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
29 with_scope(selector) do 29 with_scope(selector) do
30 - first(:button, button).click 30 + click_button(button, :match => :prefer_exact)
31 end 31 end
32 end 32 end
33 33
34 When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| 34 When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
35 with_scope(selector) do 35 with_scope(selector) do
36 - first(:link, link).click 36 + click_link(link, :match => :prefer_exact)
37 end 37 end
38 end 38 end
39 39
lib/tasks/plugins_tests.rake
1 @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template'] 1 @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template']
  2 +@all_plugins.sort!
2 @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium] 3 @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium]
3 4
4 def enabled_plugins 5 def enabled_plugins
@@ -110,7 +111,7 @@ def run_cucumber(profile, files) @@ -110,7 +111,7 @@ def run_cucumber(profile, files)
110 sh 'xvfb-run', 'ruby', '-S', 'cucumber', '--profile', profile.to_s, '--format', ENV['CUCUMBER_FORMAT'] || 'progress' , *files 111 sh 'xvfb-run', 'ruby', '-S', 'cucumber', '--profile', profile.to_s, '--format', ENV['CUCUMBER_FORMAT'] || 'progress' , *files
111 end 112 end
112 113
113 -def custom_run(name, files, run=:individually) 114 +def custom_run(name, files, run=:all)
114 case run 115 case run
115 when :all 116 when :all
116 run_test name, files 117 run_test name, files
@@ -122,7 +123,7 @@ def custom_run(name, files, run=:individually) @@ -122,7 +123,7 @@ def custom_run(name, files, run=:individually)
122 end 123 end
123 end 124 end
124 125
125 -def run_tests(name, plugins, run=:individually) 126 +def run_tests(name, plugins, run=:all)
126 plugins = Array(plugins) 127 plugins = Array(plugins)
127 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}" 128 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}"
128 files = Dir.glob(glob) 129 files = Dir.glob(glob)
@@ -169,7 +170,7 @@ def test_sequence(plugins, tasks) @@ -169,7 +170,7 @@ def test_sequence(plugins, tasks)
169 fail 'There are broken tests to be fixed!' if fail_flag 170 fail 'There are broken tests to be fixed!' if fail_flag
170 end 171 end
171 172
172 -def plugin_test_task(plugin, task, run=:individually) 173 +def plugin_test_task(plugin, task, run=:all)
173 desc "Run #{task} tests for #{plugin_name(plugin)}" 174 desc "Run #{task} tests for #{plugin_name(plugin)}"
174 task task do 175 task task do
175 test_sequence(plugin, task) 176 test_sequence(plugin, task)
public/javascripts/chat.js
@@ -529,11 +529,27 @@ jQuery(function($) { @@ -529,11 +529,27 @@ jQuery(function($) {
529 function create_conversation_tab(title, jid_id) { 529 function create_conversation_tab(title, jid_id) {
530 if (! $('#' + Jabber.tab_prefix + jid_id).length > 0) { 530 if (! $('#' + Jabber.tab_prefix + jid_id).length > 0) {
531 // opening chat with selected online friend 531 // opening chat with selected online friend
532 - var tab = $tabs.tabs('add', '#' + Jabber.tab_prefix + jid_id, title); 532 + var panel = $('<div id="'+Jabber.tab_prefix + jid_id+'"></div>').appendTo($tabs);
  533 + panel.append("<div class='conversation'><div class='history'></div><div class='input-div'><div class='icon-chat'></div><textarea class='input'></textarea></div></div>");
  534 +
  535 + //FIXME
  536 + //var notice = $starting_chat_notice.replace('%{name}', $(ui.tab).html());
  537 + //Jabber.show_notice(jid_id, notice);
  538 +
  539 + // define textarea name as '<TAB_ID>'
  540 + panel.find('textarea').attr('name', panel.id);
  541 +
  542 + if (Jabber.is_a_room(jid_id)) {
  543 + panel.append(Jabber.templates.occupant_list);
  544 + panel.find('.history').addClass('room');
  545 + }
  546 +
  547 + $tabs.find('.ui-tabs-nav').append( "<li><a href='"+('#' + Jabber.tab_prefix + jid_id)+"'><span class=\"unread-messages\" style=\"display:none\"></span>"+title+"</a></li>" );
  548 + $tabs.tabs('refresh');
  549 +
533 var jid = Jabber.jid_of(jid_id); 550 var jid = Jabber.jid_of(jid_id);
534 $("a[href='#" + Jabber.tab_prefix + jid_id + "']").addClass($('#' + jid_id).attr('class') || 'icon-chat'); 551 $("a[href='#" + Jabber.tab_prefix + jid_id + "']").addClass($('#' + jid_id).attr('class') || 'icon-chat');
535 $('#' + Jabber.tab_prefix + jid_id).find('textarea').attr('data-to', jid); 552 $('#' + Jabber.tab_prefix + jid_id).find('textarea').attr('data-to', jid);
536 - $tabs.tabs('select', '#' + Jabber.tab_prefix + jid_id);  
537 } 553 }
538 } 554 }
539 555
@@ -555,7 +571,7 @@ jQuery(function($) { @@ -555,7 +571,7 @@ jQuery(function($) {
555 var $tabs = $('#chat-window #tabs').tabs({ 571 var $tabs = $('#chat-window #tabs').tabs({
556 tabTemplate: '<li class="tab"><a href="#{href}"><span class="unread-messages" style="display:none"></span>#{label}</a></li>', 572 tabTemplate: '<li class="tab"><a href="#{href}"><span class="unread-messages" style="display:none"></span>#{label}</a></li>',
557 panelTemplate: "<div class='conversation'><div class='history'></div><div class='input-div'><div class='icon-chat'></div><textarea class='input'></textarea></div></div>", 573 panelTemplate: "<div class='conversation'><div class='history'></div><div class='input-div'><div class='icon-chat'></div><textarea class='input'></textarea></div></div>",
558 - add: function(event, ui) { 574 + add: function(event, ui) { //FIXME DEPRECATED
559 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, ''); 575 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, '');
560 576
561 var notice = $starting_chat_notice.replace('%{name}', $(ui.tab).html()); 577 var notice = $starting_chat_notice.replace('%{name}', $(ui.tab).html());
@@ -575,7 +591,7 @@ jQuery(function($) { @@ -575,7 +591,7 @@ jQuery(function($) {
575 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, ''); 591 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, '');
576 count_unread_messages(jid_id, true); 592 count_unread_messages(jid_id, true);
577 }, 593 },
578 - remove: function(event, ui) { 594 + remove: function(event, ui) { //FIXME DEPRECATED
579 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, ''); 595 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, '');
580 if (Jabber.is_a_room(jid_id)) { 596 if (Jabber.is_a_room(jid_id)) {
581 // exiting from a chat room 597 // exiting from a chat room
public/stylesheets/application.css
@@ -2642,6 +2642,9 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation @@ -2642,6 +2642,9 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation
2642 background: #B8CFE7; 2642 background: #B8CFE7;
2643 padding: 0px 20px 5px 20px; 2643 padding: 0px 20px 5px 20px;
2644 } 2644 }
  2645 +#TB_window .login-box .button-bar {
  2646 + padding-top: 0;
  2647 +}
2645 .login-box-content .button-bar .button { 2648 .login-box-content .button-bar .button {
2646 position: relative; 2649 position: relative;
2647 } 2650 }
test/functional/cms_controller_test.rb
@@ -1791,6 +1791,14 @@ class CmsControllerTest &lt; ActionController::TestCase @@ -1791,6 +1791,14 @@ class CmsControllerTest &lt; ActionController::TestCase
1791 assert_equal other_person, a.created_by 1791 assert_equal other_person, a.created_by
1792 end 1792 end
1793 1793
  1794 + should 'continue on the same page, when no group is selected' do
  1795 + c = Community.create!(:name => 'test comm', :identifier => 'test_comm')
  1796 + c.affiliate(profile, Profile::Roles.all_roles(c.environment.id))
  1797 + article = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails')
  1798 + post :publish, :profile => profile.identifier, :id => article.id, :marked_groups => {c.id.to_s => {}}
  1799 + assert_template 'cms/publish'
  1800 + end
  1801 +
1794 protected 1802 protected
1795 1803
1796 # FIXME this is to avoid adding an extra dependency for a proper JSON parser. 1804 # FIXME this is to avoid adding an extra dependency for a proper JSON parser.
test/functional/friends_controller_test.rb
@@ -36,12 +36,12 @@ class FriendsControllerTest &lt; ActionController::TestCase @@ -36,12 +36,12 @@ class FriendsControllerTest &lt; ActionController::TestCase
36 36
37 should 'actually remove friend' do 37 should 'actually remove friend' do
38 profile.add_friend(friend) 38 profile.add_friend(friend)
  39 + friend.add_friend(profile)
39 40
40 - assert_difference 'Friendship.count', -1 do 41 + assert_difference 'Friendship.count', -2 do
41 post :remove, :id => friend.id, :confirmation => '1' 42 post :remove, :id => friend.id, :confirmation => '1'
42 assert_redirected_to :action => 'index' 43 assert_redirected_to :action => 'index'
43 end 44 end
44 - assert_equal friend, Profile.find(friend.id)  
45 end 45 end
46 46
47 should 'display find people button' do 47 should 'display find people button' do
test/integration/manage_friendships_test.rb 0 → 100644
@@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
  1 +require "#{File.dirname(__FILE__)}/../test_helper"
  2 +
  3 +class ManageFriendshipsTest < ActionController::IntegrationTest
  4 +
  5 + def setup
  6 + FriendsController.any_instance.stubs(:get_layout).returns('application')
  7 + ProfileController.any_instance.stubs(:get_layout).returns('application')
  8 +
  9 + Friendship.delete_all
  10 + Person.delete_all
  11 + @person = create_user("albert", :password => 'test',
  12 + :password_confirmation => 'test').person
  13 + @person.user.activate
  14 +
  15 + @friend = fast_create(Person, :identifier => "isaac")
  16 +
  17 + login(@person.identifier, 'test')
  18 + end
  19 +
  20 + should 'remove friendships' do
  21 + @person.add_friend(@friend)
  22 + @friend.add_friend(@person)
  23 +
  24 + get "/myprofile/#{@person.identifier}/friends/remove/#{@friend.id}"
  25 + assert_response :success
  26 +
  27 + post "/myprofile/#{@person.identifier}/friends/remove/#{@friend.id}",
  28 + :confirmation => '1'
  29 + assert_response :redirect
  30 +
  31 + follow_redirect!
  32 +
  33 + assert assigns(:friends).empty?
  34 + assert !@person.is_a_friend?(@friend)
  35 + assert !@friend.is_a_friend?(@person)
  36 + end
  37 +end
test/test_helper.rb
@@ -277,16 +277,4 @@ class ActionController::IntegrationTest @@ -277,16 +277,4 @@ class ActionController::IntegrationTest
277 277
278 end 278 end
279 279
280 -def with_constants(constants, &block)  
281 - old_constants = Hash.new  
282 - constants.each do |constant, val|  
283 - old_constants[constant] = Object.const_get(constant)  
284 - silence_stderr{ Object.const_set(constant, val) }  
285 - end  
286 - block.call  
287 - old_constants.each do |constant, val|  
288 - silence_stderr{ Object.const_set(constant, val) }  
289 - end  
290 -end  
291 -  
292 Profile 280 Profile
test/unit/application_helper_test.rb
@@ -472,13 +472,13 @@ class ApplicationHelperTest &lt; ActionView::TestCase @@ -472,13 +472,13 @@ class ApplicationHelperTest &lt; ActionView::TestCase
472 profile = mock 472 profile = mock
473 profile.stubs(:theme).returns('some-theme') 473 profile.stubs(:theme).returns('some-theme')
474 stubs(:profile).returns(profile) 474 stubs(:profile).returns(profile)
475 - with_constants :NOOSFERO_CONF => {'gravatar' => 'crazyvatar'} do  
476 - assert_equal gravatar_default, 'crazyvatar'  
477 - end 475 +
  476 + NOOSFERO_CONF.stubs(:[]).with('gravatar').returns('crazyvatar')
  477 + assert_equal gravatar_default, 'crazyvatar'
  478 +
478 stubs(:theme_option).returns('gravatar' => 'nicevatar') 479 stubs(:theme_option).returns('gravatar' => 'nicevatar')
479 - with_constants :NOOSFERO_CONF => {'gravatar' => 'crazyvatar'} do  
480 - assert_equal gravatar_default, 'nicevatar'  
481 - end 480 + NOOSFERO_CONF.stubs(:[]).with('gravatar').returns('nicevatar')
  481 + assert_equal gravatar_default, 'nicevatar'
482 end 482 end
483 483
484 should 'use theme passed via param when in development mode' do 484 should 'use theme passed via param when in development mode' do
test/unit/friendship_test.rb
@@ -58,4 +58,18 @@ class FriendshipTest &lt; ActiveSupport::TestCase @@ -58,4 +58,18 @@ class FriendshipTest &lt; ActiveSupport::TestCase
58 assert_equal ['a'], ta.get_friend_name 58 assert_equal ['a'], ta.get_friend_name
59 end 59 end
60 60
  61 + should 'remove friendships when a friend removal occurs' do
  62 + p1 = create_user('testuser1').person
  63 + p2 = create_user('testuser2').person
  64 + p1.add_friend(p2, 'friends')
  65 + p2.add_friend(p1, 'friends')
  66 +
  67 + assert_difference 'Friendship.count', -2 do
  68 + Friendship.remove_friendship(p1, p2)
  69 + end
  70 +
  71 + assert_not_includes p1.friends(true), p2
  72 + assert_not_includes p2.friends(true), p1
  73 + end
  74 +
61 end 75 end
test/unit/google_maps_test.rb
@@ -3,13 +3,12 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39; @@ -3,13 +3,12 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39;
3 class GoogleMapsTest < ActiveSupport::TestCase 3 class GoogleMapsTest < ActiveSupport::TestCase
4 4
5 should 'provide initial_zoom setting' do 5 should 'provide initial_zoom setting' do
6 - with_constants :NOOSFERO_CONF => {'googlemaps_initial_zoom' => 2} do  
7 - assert_equal 2, GoogleMaps.initial_zoom  
8 - end 6 + NOOSFERO_CONF.stubs(:[]).with('googlemaps_initial_zoom').returns(2)
  7 + assert_equal 2, GoogleMaps.initial_zoom
9 end 8 end
10 9
11 should 'use 4 as default initial_zoom' do 10 should 'use 4 as default initial_zoom' do
12 - GoogleMaps.stubs(:config).returns({}) 11 + NOOSFERO_CONF.stubs(:[]).with('googlemaps_initial_zoom').returns(nil)
13 assert_equal 4, GoogleMaps.initial_zoom 12 assert_equal 4, GoogleMaps.initial_zoom
14 end 13 end
15 14
test/unit/mail_conf_test.rb
@@ -3,22 +3,22 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39; @@ -3,22 +3,22 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39;
3 class MailConfTest < ActiveSupport::TestCase 3 class MailConfTest < ActiveSupport::TestCase
4 4
5 should 'enable if told to' do 5 should 'enable if told to' do
6 - NOOSFERO_CONF['mail_enabled'] = true 6 + NOOSFERO_CONF.stubs(:[]).with('mail_enabled').returns(true)
7 assert_equal true, MailConf.enabled? 7 assert_equal true, MailConf.enabled?
8 end 8 end
9 9
10 should 'disable if told to' do 10 should 'disable if told to' do
11 - NOOSFERO_CONF['mail_enabled'] = false 11 + NOOSFERO_CONF.stubs(:[]).with('mail_enabled').returns(false)
12 assert_equal false, MailConf.enabled? 12 assert_equal false, MailConf.enabled?
13 end 13 end
14 14
15 should 'disable by default' do 15 should 'disable by default' do
16 - NOOSFERO_CONF['mail_enabled'] = nil 16 + NOOSFERO_CONF.stubs(:[]).with('mail_enabled').returns(nil)
17 assert_equal false, MailConf.enabled? 17 assert_equal false, MailConf.enabled?
18 end 18 end
19 19
20 should 'provide webmail url preference' do 20 should 'provide webmail url preference' do
21 - NOOSFERO_CONF['webmail_url'] = 'http://some.url/webmail/%s/%s' 21 + NOOSFERO_CONF.stubs(:[]).with('webmail_url').returns('http://some.url/webmail/%s/%s')
22 assert_equal 'http://some.url/webmail/login/example.com', MailConf.webmail_url('login', 'example.com') 22 assert_equal 'http://some.url/webmail/login/example.com', MailConf.webmail_url('login', 'example.com')
23 end 23 end
24 24
vendor/plugins/ruby_bosh/lib/ruby_bosh.rb
@@ -4,7 +4,6 @@ require &#39;rexml/document&#39; @@ -4,7 +4,6 @@ require &#39;rexml/document&#39;
4 require 'base64' 4 require 'base64'
5 require 'hpricot' 5 require 'hpricot'
6 require 'timeout' 6 require 'timeout'
7 -require 'system_timer'  
8 7
9 class RubyBOSH 8 class RubyBOSH
10 BOSH_XMLNS = 'http://jabber.org/protocol/httpbind' 9 BOSH_XMLNS = 'http://jabber.org/protocol/httpbind'
@@ -15,7 +14,7 @@ class RubyBOSH @@ -15,7 +14,7 @@ class RubyBOSH
15 CLIENT_XMLNS = 'jabber:client' 14 CLIENT_XMLNS = 'jabber:client'
16 15
17 class Error < StandardError; end 16 class Error < StandardError; end
18 - class Timeout < RubyBOSH::Error; end 17 + class TimeoutError < RubyBOSH::Error; end
19 class AuthFailed < RubyBOSH::Error; end 18 class AuthFailed < RubyBOSH::Error; end
20 class ConnFailed < RubyBOSH::Error; end 19 class ConnFailed < RubyBOSH::Error; end
21 20
@@ -134,12 +133,12 @@ class RubyBOSH @@ -134,12 +133,12 @@ class RubyBOSH
134 end 133 end
135 134
136 def deliver(xml) 135 def deliver(xml)
137 - SystemTimer.timeout(@timeout) do 136 + Timeout::timeout(@timeout) do
138 send(xml) 137 send(xml)
139 recv(RestClient.post(@service_url, xml, @headers)) 138 recv(RestClient.post(@service_url, xml, @headers))
140 end 139 end
141 rescue ::Timeout::Error => e 140 rescue ::Timeout::Error => e
142 - raise RubyBOSH::Timeout, e.message 141 + raise RubyBOSH::TimeoutError, e.message
143 rescue Errno::ECONNREFUSED => e 142 rescue Errno::ECONNREFUSED => e
144 raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}" 143 raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}"
145 rescue Exception => e 144 rescue Exception => e