Commit f2c19fc89a921f15262f7edb398907a88cb8b726

Authored by Rodrigo Souto
1 parent 7cef4608

[postgres-tests] Fixing scrap tests

Showing 1 changed file with 5 additions and 5 deletions   Show diff stats
test/unit/scrap_test.rb
@@ -81,7 +81,7 @@ class ScrapTest < ActiveSupport::TestCase @@ -81,7 +81,7 @@ class ScrapTest < ActiveSupport::TestCase
81 end 81 end
82 82
83 should "create the leave_scrap action tracker verb on scrap creation of one user to another" do 83 should "create the leave_scrap action tracker verb on scrap creation of one user to another" do
84 - p1 = ActionTracker::Record.current_user_from_model 84 + p1 = fast_create(Person)
85 p2 = fast_create(Person) 85 p2 = fast_create(Person)
86 s = Scrap.new 86 s = Scrap.new
87 s.sender= p1 87 s.sender= p1
@@ -116,7 +116,7 @@ class ScrapTest < ActiveSupport::TestCase @@ -116,7 +116,7 @@ class ScrapTest < ActiveSupport::TestCase
116 end 116 end
117 117
118 should "notify leave_scrap action tracker verb to friends and itself" do 118 should "notify leave_scrap action tracker verb to friends and itself" do
119 - p1 = ActionTracker::Record.current_user_from_model 119 + p1 = fast_create(Person)
120 p2 = fast_create(Person) 120 p2 = fast_create(Person)
121 p1.add_friend(p2) 121 p1.add_friend(p2)
122 ActionTrackerNotification.destroy_all 122 ActionTrackerNotification.destroy_all
@@ -166,7 +166,7 @@ class ScrapTest < ActiveSupport::TestCase @@ -166,7 +166,7 @@ class ScrapTest < ActiveSupport::TestCase
166 end 166 end
167 167
168 should "notify leave_scrap_to_self action tracker verb to friends and itself" do 168 should "notify leave_scrap_to_self action tracker verb to friends and itself" do
169 - p1 = Person.first 169 + p1 = fast_create(Person)
170 p2 = fast_create(Person) 170 p2 = fast_create(Person)
171 p1.add_friend(p2) 171 p1.add_friend(p2)
172 ActionTrackerNotification.destroy_all 172 ActionTrackerNotification.destroy_all
@@ -212,10 +212,10 @@ class ScrapTest < ActiveSupport::TestCase @@ -212,10 +212,10 @@ class ScrapTest < ActiveSupport::TestCase
212 212
213 should "update the scrap on reply creation" do 213 should "update the scrap on reply creation" do
214 Scrap.delete_all 214 Scrap.delete_all
  215 + person = fast_create(Person)
215 s = fast_create(Scrap, :updated_at => DateTime.parse('2010-01-01')) 216 s = fast_create(Scrap, :updated_at => DateTime.parse('2010-01-01'))
216 assert_equal DateTime.parse('2010-01-01'), s.updated_at.strftime('%Y-%m-%d') 217 assert_equal DateTime.parse('2010-01-01'), s.updated_at.strftime('%Y-%m-%d')
217 - DateTime.stubs(:now).returns(DateTime.parse('2010-09-07'))  
218 - s1 = Scrap.create(defaults_for_scrap(:scrap_id => s.id)) 218 + s1 = Scrap.create!(:content => 'some content', :sender => person, :receiver => person, :scrap_id => s.id)
219 s.reload 219 s.reload
220 assert_not_equal DateTime.parse('2010-01-01'), s.updated_at.strftime('%Y-%m-%d') 220 assert_not_equal DateTime.parse('2010-01-01'), s.updated_at.strftime('%Y-%m-%d')
221 end 221 end