Commit f2c19fc89a921f15262f7edb398907a88cb8b726
1 parent
7cef4608
Exists in
master
and in
22 other branches
[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 | 81 | end |
| 82 | 82 | |
| 83 | 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 | 85 | p2 = fast_create(Person) |
| 86 | 86 | s = Scrap.new |
| 87 | 87 | s.sender= p1 |
| ... | ... | @@ -116,7 +116,7 @@ class ScrapTest < ActiveSupport::TestCase |
| 116 | 116 | end |
| 117 | 117 | |
| 118 | 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 | 120 | p2 = fast_create(Person) |
| 121 | 121 | p1.add_friend(p2) |
| 122 | 122 | ActionTrackerNotification.destroy_all |
| ... | ... | @@ -166,7 +166,7 @@ class ScrapTest < ActiveSupport::TestCase |
| 166 | 166 | end |
| 167 | 167 | |
| 168 | 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 | 170 | p2 = fast_create(Person) |
| 171 | 171 | p1.add_friend(p2) |
| 172 | 172 | ActionTrackerNotification.destroy_all |
| ... | ... | @@ -212,10 +212,10 @@ class ScrapTest < ActiveSupport::TestCase |
| 212 | 212 | |
| 213 | 213 | should "update the scrap on reply creation" do |
| 214 | 214 | Scrap.delete_all |
| 215 | + person = fast_create(Person) | |
| 215 | 216 | s = fast_create(Scrap, :updated_at => DateTime.parse('2010-01-01')) |
| 216 | 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 | 219 | s.reload |
| 220 | 220 | assert_not_equal DateTime.parse('2010-01-01'), s.updated_at.strftime('%Y-%m-%d') |
| 221 | 221 | end | ... | ... |