Commit 1e78417c33145811cad9890484e929bc834229a6

Authored by Braulio Bhavamitra
1 parent b93de569

rails4: fix remaining unit and functionals tests

test/functional/search_controller_test.rb
@@ -316,7 +316,7 @@ class SearchControllerTest < ActionController::TestCase @@ -316,7 +316,7 @@ class SearchControllerTest < ActionController::TestCase
316 ev1 = create_event(person, :name => 'event 1', :category_ids => [@category.id], :start_date => ten_days_ago) 316 ev1 = create_event(person, :name => 'event 1', :category_ids => [@category.id], :start_date => ten_days_ago)
317 ev2 = create_event(person, :name => 'event 2', :category_ids => [@category.id], :start_date => DateTime.now - 2.month) 317 ev2 = create_event(person, :name => 'event 2', :category_ids => [@category.id], :start_date => DateTime.now - 2.month)
318 318
319 - get :events, day: ten_days_ago.day+1.second, month: ten_days_ago.month, year: ten_days_ago.year 319 + get :events, day: ten_days_ago.day, month: ten_days_ago.month, year: ten_days_ago.year
320 assert_equal [ev1], assigns(:events) 320 assert_equal [ev1], assigns(:events)
321 end 321 end
322 322
@@ -329,7 +329,7 @@ class SearchControllerTest < ActionController::TestCase @@ -329,7 +329,7 @@ class SearchControllerTest < ActionController::TestCase
329 329
330 ev2 = create_event(person, :name => 'event 2', :start_date => ten_days_ago) 330 ev2 = create_event(person, :name => 'event 2', :start_date => ten_days_ago)
331 331
332 - get :events, day: ten_days_ago.day+1.second, month: ten_days_ago.month, year: ten_days_ago.year, category_path: @category.path.split('/') 332 + get :events, day: ten_days_ago.day, month: ten_days_ago.month, year: ten_days_ago.year, category_path: @category.path.split('/')
333 333
334 assert_equal [ev1], assigns(:events) 334 assert_equal [ev1], assigns(:events)
335 end 335 end
test/unit/person_notifier_test.rb
@@ -48,6 +48,8 @@ class PersonNotifierTest < ActiveSupport::TestCase @@ -48,6 +48,8 @@ class PersonNotifierTest < ActiveSupport::TestCase
48 48
49 should 'display author name in delivered mail' do 49 should 'display author name in delivered mail' do
50 @community.add_member(@member) 50 @community.add_member(@member)
  51 + ActionMailer::Base.deliveries.clear
  52 +
51 Comment.create!(:author => @admin, :title => 'test comment', :body => 'body!', :source => @article) 53 Comment.create!(:author => @admin, :title => 'test comment', :body => 'body!', :source => @article)
52 process_delayed_job_queue 54 process_delayed_job_queue
53 notify 55 notify
test/unit/scrap_test.rb
@@ -88,7 +88,8 @@ class ScrapTest < ActiveSupport::TestCase @@ -88,7 +88,8 @@ class ScrapTest < ActiveSupport::TestCase
88 end 88 end
89 89
90 should "create the leave_scrap action tracker verb on scrap creation of one user to another" do 90 should "create the leave_scrap action tracker verb on scrap creation of one user to another" do
91 - p1 = create_user.person 91 + User.current = create_user
  92 + p1 = User.current.person
92 p2 = create_user.person 93 p2 = create_user.person
93 s = Scrap.new 94 s = Scrap.new
94 s.sender= p1 95 s.sender= p1
@@ -105,7 +106,8 @@ class ScrapTest < ActiveSupport::TestCase @@ -105,7 +106,8 @@ class ScrapTest < ActiveSupport::TestCase
105 end 106 end
106 107
107 should "create the leave_scrap action tracker verb on scrap creation of one user to community" do 108 should "create the leave_scrap action tracker verb on scrap creation of one user to community" do
108 - p = create_user.person 109 + User.current = create_user
  110 + p = User.current.person
109 c = fast_create(Community) 111 c = fast_create(Community)
110 s = Scrap.new 112 s = Scrap.new
111 s.sender= p 113 s.sender= p
@@ -163,7 +165,8 @@ class ScrapTest < ActiveSupport::TestCase @@ -163,7 +165,8 @@ class ScrapTest < ActiveSupport::TestCase
163 end 165 end
164 166
165 should "create the leave_scrap_to_self action tracker verb on scrap creation of one user to itself" do 167 should "create the leave_scrap_to_self action tracker verb on scrap creation of one user to itself" do
166 - p = create_user.person 168 + User.current = create_user
  169 + p = User.current.person
167 s = Scrap.new 170 s = Scrap.new
168 s.sender= p 171 s.sender= p
169 s.receiver= p 172 s.receiver= p