Commit 2e3c97a0e0cb698f1474d961ca37cc2b1b39dc78

Authored by Victor Costa
2 parents 78d34e9b 05765444

Merge branch 'fix_notification_mail' into stable

@@ -47,8 +47,9 @@ group :cucumber do @@ -47,8 +47,9 @@ group :cucumber do
47 gem 'selenium-webdriver', '~> 2.39.0' 47 gem 'selenium-webdriver', '~> 2.39.0'
48 end 48 end
49 49
50 -# include plugin gemfiles  
51 -Dir.glob(File.join('config', 'plugins', '*')).each do |plugin|  
52 - plugin_gemfile = File.join(plugin, 'Gemfile')  
53 - eval File.read(plugin_gemfile) if File.exists?(plugin_gemfile) 50 +# include gemfiles from enabled plugins
  51 +# plugins in baseplugins/ are not included on purpose. They should not have any
  52 +# dependencies.
  53 +Dir.glob('config/plugins/*/Gemfile').each do |gemfile|
  54 + eval File.read(gemfile)
54 end 55 end
app/controllers/public/account_controller.rb
@@ -200,7 +200,7 @@ class AccountController < ApplicationController @@ -200,7 +200,7 @@ class AccountController < ApplicationController
200 else 200 else
201 @change_password.errors[:base] << _('Could not find any user with %s equal to "%s".') % [fields_label, params[:value]] 201 @change_password.errors[:base] << _('Could not find any user with %s equal to "%s".') % [fields_label, params[:value]]
202 end 202 end
203 - rescue ActiveRecord::RecordInvald 203 + rescue ActiveRecord::RecordInvalid
204 @change_password.errors[:base] << _('Could not perform password recovery for the user.') 204 @change_password.errors[:base] << _('Could not perform password recovery for the user.')
205 end 205 end
206 end 206 end
app/models/task.rb
@@ -286,7 +286,7 @@ class Task &lt; ActiveRecord::Base @@ -286,7 +286,7 @@ class Task &lt; ActiveRecord::Base
286 def send_notification(action) 286 def send_notification(action)
287 if sends_email? 287 if sends_email?
288 if self.requestor 288 if self.requestor
289 - TaskMailer.generic_message("task_#{action}", self) 289 + TaskMailer.generic_message("task_#{action}", self).deliver
290 end 290 end
291 end 291 end
292 end 292 end
app/views/task_mailer/generic_message.text.erb 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +<%= @message %>
debian/control
@@ -50,6 +50,7 @@ Depends: @@ -50,6 +50,7 @@ Depends:
50 ruby-hpricot, 50 ruby-hpricot,
51 ruby-nokogiri, 51 ruby-nokogiri,
52 ruby-acts-as-taggable-on, 52 ruby-acts-as-taggable-on,
  53 + ruby-progressbar,
53 ruby-prototype-rails, 54 ruby-prototype-rails,
54 ruby-rails-autolink, 55 ruby-rails-autolink,
55 memcached, 56 memcached,
lib/tasks/ci.rake
@@ -10,6 +10,15 @@ namespace :ci do @@ -10,6 +10,15 @@ namespace :ci do
10 File.exist?(f) 10 File.exist?(f)
11 end 11 end
12 12
  13 + changed_plugin_files = changed_files.select do |f|
  14 + f.split(File::SEPARATOR).first == 'plugins'
  15 + end
  16 + changed_plugins = changed_plugin_files.map do |f|
  17 + f.split(File::SEPARATOR)[1]
  18 + end.uniq
  19 +
  20 + changed_files -= changed_plugin_files
  21 +
13 # explicitly changed tests 22 # explicitly changed tests
14 tests = changed_files.select { |f| f =~ /test\/.*_test\.rb$/ } 23 tests = changed_files.select { |f| f =~ /test\/.*_test\.rb$/ }
15 features = changed_files.select { |f| f =~ /\.feature$/ } 24 features = changed_files.select { |f| f =~ /\.feature$/ }
@@ -27,6 +36,13 @@ namespace :ci do @@ -27,6 +36,13 @@ namespace :ci do
27 sh 'testrb', '-Itest', *tests unless tests.empty? 36 sh 'testrb', '-Itest', *tests unless tests.empty?
28 sh 'cucumber', *features unless features.empty? 37 sh 'cucumber', *features unless features.empty?
29 sh 'cucumber', '-p', 'selenium', *features unless features.empty? 38 sh 'cucumber', '-p', 'selenium', *features unless features.empty?
  39 +
  40 + changed_plugins.each do |plugin|
  41 + task = "test:noosfero_plugins:#{plugin}"
  42 + puts "Running #{task}"
  43 + Rake::Task[task].execute
  44 + end
  45 +
30 end 46 end
31 47
32 end 48 end
plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
@@ -101,9 +101,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -101,9 +101,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
101 should 'render tracks in track list block' do 101 should 'render tracks in track list block' do
102 @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.last) 102 @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.last)
103 get :view_page, @step.url 103 get :view_page, @step.url
104 - file = File.open('result.html', 'w+')  
105 - file.write(@response.body)  
106 - file.close  
107 assert_tag :tag => 'div', :attributes => { :class => "item category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'steps' }, :descendant => { :tag => 'span', :attributes => { :class => "step #{@block.status_class(@step)}" } } } 104 assert_tag :tag => 'div', :attributes => { :class => "item category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'steps' }, :descendant => { :tag => 'span', :attributes => { :class => "step #{@block.status_class(@step)}" } } }
108 end 105 end
109 106
plugins/custom_forms/test/functional/custom_forms_plugin_myprofile_controller_test.rb
@@ -226,7 +226,7 @@ class CustomFormsPluginMyprofileControllerTest &lt; ActionController::TestCase @@ -226,7 +226,7 @@ class CustomFormsPluginMyprofileControllerTest &lt; ActionController::TestCase
226 end 226 end
227 227
228 should 'list pending submissions for a form' do 228 should 'list pending submissions for a form' do
229 - person = fast_create(Person) 229 + person = create_user('john').person
230 form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software', :for_admission => true) 230 form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software', :for_admission => true)
231 task = CustomFormsPlugin::AdmissionSurvey.create!(:form_id => form.id, :target => person, :requestor => profile) 231 task = CustomFormsPlugin::AdmissionSurvey.create!(:form_id => form.id, :target => person, :requestor => profile)
232 232
plugins/custom_forms/test/unit/custom_forms_plugin/admission_survey_test.rb
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + &#39;/../../../../../test/test_helper&#39; @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + &#39;/../../../../../test/test_helper&#39;
3 class CustomFormsPlugin::AdmissionSurveyTest < ActiveSupport::TestCase 3 class CustomFormsPlugin::AdmissionSurveyTest < ActiveSupport::TestCase
4 should 'add member to community on perform' do 4 should 'add member to community on perform' do
5 profile = fast_create(Community) 5 profile = fast_create(Community)
6 - person = fast_create(Person) 6 + person = create_user('john').person
7 form = CustomFormsPlugin::Form.create!(:name => 'Simple Form', :profile => profile) 7 form = CustomFormsPlugin::Form.create!(:name => 'Simple Form', :profile => profile)
8 task = CustomFormsPlugin::AdmissionSurvey.create!(:form_id => form.id, :target => person, :requestor => profile) 8 task = CustomFormsPlugin::AdmissionSurvey.create!(:form_id => form.id, :target => person, :requestor => profile)
9 9
plugins/custom_forms/test/unit/custom_forms_plugin/form_test.rb
@@ -244,7 +244,7 @@ class CustomFormsPlugin::FormTest &lt; ActiveSupport::TestCase @@ -244,7 +244,7 @@ class CustomFormsPlugin::FormTest &lt; ActiveSupport::TestCase
244 244
245 should 'cancel survey tasks after removing a form' do 245 should 'cancel survey tasks after removing a form' do
246 profile = fast_create(Profile) 246 profile = fast_create(Profile)
247 - person = fast_create(Person) 247 + person = create_user('john').person
248 248
249 form1 = CustomFormsPlugin::Form.create!(:name => 'Free Software', :profile => profile) 249 form1 = CustomFormsPlugin::Form.create!(:name => 'Free Software', :profile => profile)
250 form2 = CustomFormsPlugin::Form.create!(:name => 'Operation System', :profile => profile) 250 form2 = CustomFormsPlugin::Form.create!(:name => 'Operation System', :profile => profile)
plugins/custom_forms/test/unit/custom_forms_plugin/membership_survey_test.rb
@@ -13,7 +13,7 @@ class CustomFormsPlugin::MembershipSurveyTest &lt; ActiveSupport::TestCase @@ -13,7 +13,7 @@ class CustomFormsPlugin::MembershipSurveyTest &lt; ActiveSupport::TestCase
13 13
14 should 'create submission with answers on perform' do 14 should 'create submission with answers on perform' do
15 profile = fast_create(Profile) 15 profile = fast_create(Profile)
16 - person = fast_create(Person) 16 + person = create_user('john').person
17 form = CustomFormsPlugin::Form.create!(:name => 'Simple Form', :profile => profile) 17 form = CustomFormsPlugin::Form.create!(:name => 'Simple Form', :profile => profile)
18 field = CustomFormsPlugin::Field.create!(:name => 'Name', :form => form) 18 field = CustomFormsPlugin::Field.create!(:name => 'Name', :form => form)
19 task = CustomFormsPlugin::MembershipSurvey.create!(:form_id => form.id, :submission => {field.id.to_s => 'Jack'}, :target => person, :requestor => profile) 19 task = CustomFormsPlugin::MembershipSurvey.create!(:form_id => form.id, :submission => {field.id.to_s => 'Jack'}, :target => person, :requestor => profile)
@@ -31,7 +31,7 @@ class CustomFormsPlugin::MembershipSurveyTest &lt; ActiveSupport::TestCase @@ -31,7 +31,7 @@ class CustomFormsPlugin::MembershipSurveyTest &lt; ActiveSupport::TestCase
31 31
32 should 'have a scope that retrieves all tasks requested by profile' do 32 should 'have a scope that retrieves all tasks requested by profile' do
33 profile = fast_create(Profile) 33 profile = fast_create(Profile)
34 - person = fast_create(Person) 34 + person = create_user('john').person
35 form = CustomFormsPlugin::Form.create!(:name => 'Simple Form', :profile => profile) 35 form = CustomFormsPlugin::Form.create!(:name => 'Simple Form', :profile => profile)
36 task1 = CustomFormsPlugin::MembershipSurvey.create!(:form_id => form.id, :target => person, :requestor => profile) 36 task1 = CustomFormsPlugin::MembershipSurvey.create!(:form_id => form.id, :target => person, :requestor => profile)
37 task2 = CustomFormsPlugin::MembershipSurvey.create!(:form_id => form.id, :target => person, :requestor => fast_create(Profile)) 37 task2 = CustomFormsPlugin::MembershipSurvey.create!(:form_id => form.id, :target => person, :requestor => fast_create(Profile))
plugins/custom_forms/test/unit/ext/role_assingment_test.rb
@@ -5,7 +5,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase @@ -5,7 +5,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase
5 environment = Environment.default 5 environment = Environment.default
6 environment.enable_plugin(CustomFormsPlugin) 6 environment.enable_plugin(CustomFormsPlugin)
7 organization = fast_create(Organization) 7 organization = fast_create(Organization)
8 - person = fast_create(Person) 8 + person = create_user('john').person
9 f1 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 1', :on_membership => true) 9 f1 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 1', :on_membership => true)
10 f2 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 2', :on_membership => true) 10 f2 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 2', :on_membership => true)
11 f3 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 3', :on_membership => false) 11 f3 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 3', :on_membership => false)
@@ -19,7 +19,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase @@ -19,7 +19,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase
19 environment = Environment.default 19 environment = Environment.default
20 environment.enable_plugin(CustomFormsPlugin) 20 environment.enable_plugin(CustomFormsPlugin)
21 organization = fast_create(Organization) 21 organization = fast_create(Organization)
22 - person = fast_create(Person) 22 + person = create_user('john').person
23 form = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form', :on_membership => true, :access => 'associated') 23 form = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form', :on_membership => true, :access => 'associated')
24 24
25 assert_difference 'CustomFormsPlugin::MembershipSurvey.count', 1 do 25 assert_difference 'CustomFormsPlugin::MembershipSurvey.count', 1 do
@@ -31,7 +31,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase @@ -31,7 +31,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase
31 environment = Environment.default 31 environment = Environment.default
32 environment.enable_plugin(CustomFormsPlugin) 32 environment.enable_plugin(CustomFormsPlugin)
33 organization = fast_create(Organization) 33 organization = fast_create(Organization)
34 - person = fast_create(Person) 34 + person = create_user('john').person
35 form1 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 1', :on_membership => true) 35 form1 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 1', :on_membership => true)
36 organization.add_member(person) 36 organization.add_member(person)
37 37
@@ -59,7 +59,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase @@ -59,7 +59,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase
59 environment = Environment.default 59 environment = Environment.default
60 environment.enable_plugin(CustomFormsPlugin) 60 environment.enable_plugin(CustomFormsPlugin)
61 organization = fast_create(Organization) 61 organization = fast_create(Organization)
62 - person = fast_create(Person) 62 + person = create_user('john').person
63 f1 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 1', :for_admission => true) 63 f1 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 1', :for_admission => true)
64 f2 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 2', :for_admission => true) 64 f2 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 2', :for_admission => true)
65 f3 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 3', :for_admission => false) 65 f3 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 3', :for_admission => false)
plugins/remote_user/lib/remote_user_plugin.rb
@@ -13,17 +13,27 @@ class RemoteUserPlugin &lt; Noosfero::Plugin @@ -13,17 +13,27 @@ class RemoteUserPlugin &lt; Noosfero::Plugin
13 13
14 begin 14 begin
15 remote_user = request.headers["HTTP_REMOTE_USER"] 15 remote_user = request.headers["HTTP_REMOTE_USER"]
  16 + user_data = request.env['HTTP_REMOTE_USER_DATA']
16 17
17 - if remote_user.nil? 18 + if remote_user.blank?
18 if logged_in? 19 if logged_in?
19 self.current_user.forget_me 20 self.current_user.forget_me
20 reset_session 21 reset_session
21 end 22 end
22 else 23 else
  24 + if user_data.blank?
  25 + remote_user_email = remote_user + '@remote.user'
  26 + remote_user_name = remote_user
  27 + else
  28 + user_data = JSON.parse(user_data)
  29 + remote_user_email = user_data['email']
  30 + remote_user_name = user_data['name']
  31 + end
  32 +
23 if !logged_in? 33 if !logged_in?
24 self.current_user = User.find_by_login(remote_user) 34 self.current_user = User.find_by_login(remote_user)
25 unless self.current_user 35 unless self.current_user
26 - self.current_user = User.create!(:login => remote_user, :email => (remote_user + '@remote.user'), :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user)) 36 + self.current_user = User.create!(:login => remote_user, :email => remote_user_email, :name => remote_user_name, :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user))
27 self.current_user.activate 37 self.current_user.activate
28 end 38 end
29 self.current_user.save! 39 self.current_user.save!
@@ -34,7 +44,7 @@ class RemoteUserPlugin &lt; Noosfero::Plugin @@ -34,7 +44,7 @@ class RemoteUserPlugin &lt; Noosfero::Plugin
34 44
35 self.current_user = User.find_by_login(remote_user) 45 self.current_user = User.find_by_login(remote_user)
36 unless self.current_user 46 unless self.current_user
37 - self.current_user = User.create!(:login => remote_user, :email => (remote_user + '@remote.user'), :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user)) 47 + self.current_user = User.create!(:login => remote_user, :email => remote_user_email, :name => remote_user_name, :password => ('pw4'+remote_user), :password_confirmation => ('pw4'+remote_user))
38 self.current_user.activate 48 self.current_user.activate
39 end 49 end
40 self.current_user.save! 50 self.current_user.save!
plugins/remote_user/test/functional/remote_user_plugin_test.rb
@@ -42,26 +42,64 @@ class AccountControllerTest &lt; ActionController::TestCase @@ -42,26 +42,64 @@ class AccountControllerTest &lt; ActionController::TestCase
42 assert_equal user2.id, session[:user] 42 assert_equal user2.id, session[:user]
43 end 43 end
44 44
45 - should 'create a new user if the remote user does not exist' do 45 + should 'create a new user with remote_user_data if the remote user does not exist' do
46 User.destroy_all 46 User.destroy_all
47 47
48 assert_equal 0, User.count 48 assert_equal 0, User.count
49 49
50 @request.env["HTTP_REMOTE_USER"] = "testuser" 50 @request.env["HTTP_REMOTE_USER"] = "testuser"
  51 + @request.env["CONTENT_TYPE"] = "application/json"
  52 + @request.env["HTTP_REMOTE_USER_DATA"] = '{"email":"testuser@domain.com", "name":"Test User"}'
51 get :index 53 get :index
52 54
53 assert_equal 1, User.count 55 assert_equal 1, User.count
54 assert_equal "testuser", User.last.login 56 assert_equal "testuser", User.last.login
55 assert_equal true, User.last.activated? 57 assert_equal true, User.last.activated?
56 assert_equal User.last.id, session[:user] 58 assert_equal User.last.id, session[:user]
  59 + assert_equal "Test User", User.last.name
  60 + assert_equal "testuser@domain.com", User.last.email
57 end 61 end
58 62
59 - should 'create a new user even if there is a logged user but the remote user is different' do 63 + should 'create a new user with remote_user_data even if there is a logged user but the remote user is different' do
60 user = create_user('testuser', :email => 'testuser@example.com', :password => 'test', :password_confirmation => 'test') 64 user = create_user('testuser', :email => 'testuser@example.com', :password => 'test', :password_confirmation => 'test')
61 user.activate 65 user.activate
62 66
63 login_as user.login 67 login_as user.login
64 68
  69 + @request.env["HTTP_REMOTE_USER"] = 'another_user'
  70 + @request.env["CONTENT_TYPE"] = "application/json"
  71 + @request.env["HTTP_REMOTE_USER_DATA"] = '{"email":"another_user@domain.com", "name":"Another User"}'
  72 + get :index
  73 +
  74 + assert_equal 2, User.count
  75 + assert_equal "another_user", User.last.login
  76 + assert_equal true, User.last.activated?
  77 + assert_equal User.last.id, session[:user]
  78 + assert_equal "Another User", User.last.name
  79 + assert_equal "another_user@domain.com", User.last.email
  80 + end
  81 +
  82 + should 'create a new user without remote_user_data if the remote user does not exist' do
  83 + User.destroy_all
  84 +
  85 + assert_equal 0, User.count
  86 +
  87 + @request.env["HTTP_REMOTE_USER"] = "testuser"
  88 + get :index
  89 +
  90 + assert_equal 1, User.count
  91 + assert_equal "testuser", User.last.login
  92 + assert_equal true, User.last.activated?
  93 + assert_equal User.last.id, session[:user]
  94 + assert_equal "testuser", User.last.name
  95 + assert_equal "testuser@remote.user", User.last.email
  96 + end
  97 +
  98 + should 'create a new user without remote_user_data even if there is a logged user but the remote user is different' do
  99 + user = create_user('testuser', :email => 'testuser@example.com', :password => 'test', :password_confirmation => 'test')
  100 + user.activate
  101 +
  102 + login_as user.login
65 103
66 @request.env["HTTP_REMOTE_USER"] = 'another_user' 104 @request.env["HTTP_REMOTE_USER"] = 'another_user'
67 get :index 105 get :index
@@ -70,5 +108,23 @@ class AccountControllerTest &lt; ActionController::TestCase @@ -70,5 +108,23 @@ class AccountControllerTest &lt; ActionController::TestCase
70 assert_equal "another_user", User.last.login 108 assert_equal "another_user", User.last.login
71 assert_equal true, User.last.activated? 109 assert_equal true, User.last.activated?
72 assert_equal User.last.id, session[:user] 110 assert_equal User.last.id, session[:user]
  111 + assert_equal "another_user", User.last.name
  112 + assert_equal "another_user@remote.user", User.last.email
  113 + end
  114 +
  115 + should 'logout if there is a current logged user but not a remote user' do
  116 + user1 = create_user('testuser', :email => 'testuser@example.com', :password => 'test', :password_confirmation => 'test')
  117 + user1.activate
  118 +
  119 + login_as user1.login
  120 +
  121 + get :index
  122 +
  123 + assert session[:user].blank?
  124 +
  125 + @request.env["HTTP_REMOTE_USER"] = ""
  126 + get :index
  127 +
  128 + assert session[:user].blank?
73 end 129 end
74 end 130 end
plugins/solr/install.rb
@@ -8,7 +8,6 @@ Dir[tasks_dir].each do |file| @@ -8,7 +8,6 @@ Dir[tasks_dir].each do |file|
8 load file 8 load file
9 end 9 end
10 10
11 -begin  
12 - Rake::Task['solr:download'].invoke  
13 -rescue Exception => exception  
14 -end 11 +puts 'To download solr:'
  12 +puts '$ cd plugins/solr'
  13 +puts '$ rake solr:download'
plugins/spaminator/test/unit/spaminator_plugin/spaminator_test.rb
@@ -50,6 +50,7 @@ class SpaminatorPlugin::SpaminatorTest &lt; ActiveSupport::TestCase @@ -50,6 +50,7 @@ class SpaminatorPlugin::SpaminatorTest &lt; ActiveSupport::TestCase
50 end 50 end
51 51
52 should 'process only people from the environment and that are not abusers' do 52 should 'process only people from the environment and that are not abusers' do
  53 + Person.delete_all
53 p1 = fast_create(Person) 54 p1 = fast_create(Person)
54 p2 = fast_create(Person) 55 p2 = fast_create(Person)
55 p3 = fast_create(Person, :environment_id => fast_create(Environment)) 56 p3 = fast_create(Person, :environment_id => fast_create(Environment))
script/noosfero-plugins
@@ -98,9 +98,12 @@ _enable(){ @@ -98,9 +98,12 @@ _enable(){
98 dependencies_ok=true 98 dependencies_ok=true
99 dependencies_file="$source/dependencies.rb" 99 dependencies_file="$source/dependencies.rb"
100 if [ -e $source/Gemfile ]; then 100 if [ -e $source/Gemfile ]; then
101 - if ! (cd $source && bundle --local); then 101 + gemfile=$(mktemp --tmpdir=.)
  102 + cat Gemfile $source/Gemfile > $gemfile
  103 + if ! RUBYOPT='' BUNDLE_GEMFILE="$gemfile" bundle --local --quiet; then
102 dependencies_ok=false 104 dependencies_ok=false
103 fi 105 fi
  106 + rm -f $gemfile $gemfile.lock
104 fi 107 fi
105 if ! run $dependencies_file; then 108 if ! run $dependencies_file; then
106 dependencies_ok=false 109 dependencies_ok=false
test/unit/task_test.rb
@@ -29,7 +29,9 @@ class TaskTest &lt; ActiveSupport::TestCase @@ -29,7 +29,9 @@ class TaskTest &lt; ActiveSupport::TestCase
29 end 29 end
30 30
31 def test_should_call_perform_in_finish 31 def test_should_call_perform_in_finish
32 - TaskMailer.expects(:generic_message).with('task_finished', anything) 32 + mail = mock
  33 + mail.expects(:deliver)
  34 + TaskMailer.expects(:generic_message).with('task_finished', anything).returns(mail)
33 t = Task.create 35 t = Task.create
34 t.requestor = sample_user 36 t.requestor = sample_user
35 t.expects(:perform) 37 t.expects(:perform)
@@ -38,7 +40,9 @@ class TaskTest &lt; ActiveSupport::TestCase @@ -38,7 +40,9 @@ class TaskTest &lt; ActiveSupport::TestCase
38 end 40 end
39 41
40 def test_should_have_cancelled_status_after_cancel 42 def test_should_have_cancelled_status_after_cancel
41 - TaskMailer.expects(:generic_message).with('task_cancelled', anything) 43 + mail = mock
  44 + mail.expects(:deliver)
  45 + TaskMailer.expects(:generic_message).with('task_cancelled', anything).returns(mail)
42 t = Task.create 46 t = Task.create
43 t.requestor = sample_user 47 t.requestor = sample_user
44 t.cancel 48 t.cancel
@@ -54,7 +58,9 @@ class TaskTest &lt; ActiveSupport::TestCase @@ -54,7 +58,9 @@ class TaskTest &lt; ActiveSupport::TestCase
54 t = Task.create 58 t = Task.create
55 t.requestor = sample_user 59 t.requestor = sample_user
56 60
57 - TaskMailer.expects(:generic_message).with('task_finished', t) 61 + mail = mock
  62 + mail.expects(:deliver)
  63 + TaskMailer.expects(:generic_message).with('task_finished', t).returns(mail)
58 64
59 t.finish 65 t.finish
60 end 66 end
@@ -63,7 +69,9 @@ class TaskTest &lt; ActiveSupport::TestCase @@ -63,7 +69,9 @@ class TaskTest &lt; ActiveSupport::TestCase
63 t = Task.create 69 t = Task.create
64 t.requestor = sample_user 70 t.requestor = sample_user
65 71
66 - TaskMailer.expects(:generic_message).with('task_cancelled', t) 72 + mail = mock
  73 + mail.expects(:deliver)
  74 + TaskMailer.expects(:generic_message).with('task_cancelled', t).returns(mail)
67 75
68 t.cancel 76 t.cancel
69 end 77 end
@@ -93,7 +101,9 @@ class TaskTest &lt; ActiveSupport::TestCase @@ -93,7 +101,9 @@ class TaskTest &lt; ActiveSupport::TestCase
93 task = Task.new 101 task = Task.new
94 task.requestor = sample_user 102 task.requestor = sample_user
95 103
96 - TaskMailer.expects(:generic_message).with('task_created', task) 104 + mail = mock
  105 + mail.expects(:deliver)
  106 + TaskMailer.expects(:generic_message).with('task_created', task).returns(mail)
97 task.save! 107 task.save!
98 end 108 end
99 109
@@ -281,7 +291,9 @@ class TaskTest &lt; ActiveSupport::TestCase @@ -281,7 +291,9 @@ class TaskTest &lt; ActiveSupport::TestCase
281 task.requestor = sample_user 291 task.requestor = sample_user
282 task.save! 292 task.save!
283 293
284 - TaskMailer.expects(:generic_message).with('task_activated', task) 294 + mail = mock
  295 + mail.expects(:deliver)
  296 + TaskMailer.expects(:generic_message).with('task_activated', task).returns(mail)
285 task.activate 297 task.activate
286 end 298 end
287 299