Skip to content
This repository
Browse code

added test for pings less than 30min in freq

  • Loading branch information...
commit ab7f9d536a71f45ac25adcea30555858ba603aa6 1 parent b2fb99d
Shoaib Burq authored August 31, 2008
186  log/merb_test.log
@@ -421,3 +421,189 @@ Wed, 27 Aug 2008 13:28:21 GMT  ~  info  ~  Logfile created
421 421
  ~ Connecting to database...
422 422
  ~ Compiling routes...
423 423
  ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  424
+ ~ Loaded TEST Environment...
  425
+ ~ loading gem 'merb_activerecord' ...
  426
+ ~ loading gem 'activerecord' ...
  427
+ ~ Connecting to database...
  428
+ ~ Compiling routes...
  429
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  430
+ ~ Loaded TEST Environment...
  431
+ ~ loading gem 'merb_activerecord' ...
  432
+ ~ loading gem 'activerecord' ...
  433
+ ~ Connecting to database...
  434
+ ~ Compiling routes...
  435
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  436
+ ~ Loaded TEST Environment...
  437
+ ~ loading gem 'merb_activerecord' ...
  438
+ ~ loading gem 'activerecord' ...
  439
+ ~ Connecting to database...
  440
+ ~ Compiling routes...
  441
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  442
+ ~ Loaded TEST Environment...
  443
+ ~ loading gem 'merb_activerecord' ...
  444
+ ~ loading gem 'activerecord' ...
  445
+ ~ Connecting to database...
  446
+ ~ Compiling routes...
  447
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  448
+ ~ Loaded TEST Environment...
  449
+ ~ loading gem 'merb_activerecord' ...
  450
+ ~ loading gem 'activerecord' ...
  451
+ ~ Connecting to database...
  452
+ ~ Compiling routes...
  453
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  454
+ ~ Loaded TEST Environment...
  455
+ ~ loading gem 'merb_activerecord' ...
  456
+ ~ loading gem 'activerecord' ...
  457
+ ~ Connecting to database...
  458
+ ~ Compiling routes...
  459
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  460
+ ~ Loaded TEST Environment...
  461
+ ~ loading gem 'merb_activerecord' ...
  462
+ ~ loading gem 'activerecord' ...
  463
+ ~ Connecting to database...
  464
+ ~ Compiling routes...
  465
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  466
+ ~ Loaded TEST Environment...
  467
+ ~ loading gem 'merb_activerecord' ...
  468
+ ~ loading gem 'activerecord' ...
  469
+ ~ Connecting to database...
  470
+ ~ Compiling routes...
  471
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  472
+ ~ Loaded TEST Environment...
  473
+ ~ loading gem 'merb_activerecord' ...
  474
+ ~ loading gem 'activerecord' ...
  475
+ ~ Connecting to database...
  476
+ ~ Compiling routes...
  477
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  478
+ ~ Loaded TEST Environment...
  479
+ ~ loading gem 'merb_activerecord' ...
  480
+ ~ loading gem 'activerecord' ...
  481
+ ~ Connecting to database...
  482
+ ~ Compiling routes...
  483
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  484
+ ~ Loaded TEST Environment...
  485
+ ~ loading gem 'merb_activerecord' ...
  486
+ ~ loading gem 'activerecord' ...
  487
+ ~ Connecting to database...
  488
+ ~ Compiling routes...
  489
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  490
+ ~ Loaded TEST Environment...
  491
+ ~ loading gem 'merb_activerecord' ...
  492
+ ~ loading gem 'activerecord' ...
  493
+ ~ Connecting to database...
  494
+ ~ Compiling routes...
  495
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  496
+ ~ Loaded TEST Environment...
  497
+ ~ loading gem 'merb_activerecord' ...
  498
+ ~ loading gem 'activerecord' ...
  499
+ ~ Connecting to database...
  500
+ ~ Compiling routes...
  501
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  502
+ ~ Loaded TEST Environment...
  503
+ ~ loading gem 'merb_activerecord' ...
  504
+ ~ loading gem 'activerecord' ...
  505
+ ~ Connecting to database...
  506
+ ~ Compiling routes...
  507
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  508
+ ~ Loaded TEST Environment...
  509
+ ~ loading gem 'merb_activerecord' ...
  510
+ ~ loading gem 'activerecord' ...
  511
+ ~ Connecting to database...
  512
+ ~ Compiling routes...
  513
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  514
+ ~ Loaded TEST Environment...
  515
+ ~ loading gem 'merb_activerecord' ...
  516
+ ~ loading gem 'activerecord' ...
  517
+ ~ Connecting to database...
  518
+ ~ Compiling routes...
  519
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  520
+ ~ Loaded TEST Environment...
  521
+ ~ loading gem 'merb_activerecord' ...
  522
+ ~ loading gem 'activerecord' ...
  523
+ ~ Connecting to database...
  524
+ ~ Compiling routes...
  525
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  526
+ ~ Loaded TEST Environment...
  527
+ ~ loading gem 'merb_activerecord' ...
  528
+ ~ loading gem 'activerecord' ...
  529
+ ~ Connecting to database...
  530
+ ~ Compiling routes...
  531
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  532
+ ~ Loaded TEST Environment...
  533
+ ~ loading gem 'merb_activerecord' ...
  534
+ ~ loading gem 'activerecord' ...
  535
+ ~ Connecting to database...
  536
+ ~ Compiling routes...
  537
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  538
+ ~ Loaded TEST Environment...
  539
+ ~ loading gem 'merb_activerecord' ...
  540
+ ~ loading gem 'activerecord' ...
  541
+ ~ Connecting to database...
  542
+ ~ Compiling routes...
  543
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  544
+ ~ Loaded TEST Environment...
  545
+ ~ loading gem 'merb_activerecord' ...
  546
+ ~ loading gem 'activerecord' ...
  547
+ ~ Connecting to database...
  548
+ ~ Compiling routes...
  549
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  550
+ ~ Loaded TEST Environment...
  551
+ ~ loading gem 'merb_activerecord' ...
  552
+ ~ loading gem 'activerecord' ...
  553
+ ~ Connecting to database...
  554
+ ~ Compiling routes...
  555
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  556
+ ~ Loaded TEST Environment...
  557
+ ~ loading gem 'merb_activerecord' ...
  558
+ ~ loading gem 'activerecord' ...
  559
+ ~ Connecting to database...
  560
+ ~ Compiling routes...
  561
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  562
+ ~ Loaded TEST Environment...
  563
+ ~ loading gem 'merb_activerecord' ...
  564
+ ~ loading gem 'activerecord' ...
  565
+ ~ Connecting to database...
  566
+ ~ Compiling routes...
  567
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  568
+ ~ Loaded TEST Environment...
  569
+ ~ loading gem 'merb_activerecord' ...
  570
+ ~ loading gem 'activerecord' ...
  571
+ ~ Connecting to database...
  572
+ ~ Compiling routes...
  573
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  574
+ ~ Loaded TEST Environment...
  575
+ ~ loading gem 'merb_activerecord' ...
  576
+ ~ loading gem 'activerecord' ...
  577
+ ~ Connecting to database...
  578
+ ~ Compiling routes...
  579
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  580
+ ~ Loaded TEST Environment...
  581
+ ~ loading gem 'merb_activerecord' ...
  582
+ ~ loading gem 'activerecord' ...
  583
+ ~ Connecting to database...
  584
+ ~ Compiling routes...
  585
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  586
+ ~ Loaded TEST Environment...
  587
+ ~ loading gem 'merb_activerecord' ...
  588
+ ~ loading gem 'activerecord' ...
  589
+ ~ Connecting to database...
  590
+ ~ Compiling routes...
  591
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  592
+ ~ Loaded TEST Environment...
  593
+ ~ loading gem 'merb_activerecord' ...
  594
+ ~ loading gem 'activerecord' ...
  595
+ ~ Connecting to database...
  596
+ ~ Compiling routes...
  597
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  598
+ ~ Loaded TEST Environment...
  599
+ ~ loading gem 'merb_activerecord' ...
  600
+ ~ loading gem 'activerecord' ...
  601
+ ~ Connecting to database...
  602
+ ~ Compiling routes...
  603
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
  604
+ ~ Loaded TEST Environment...
  605
+ ~ loading gem 'merb_activerecord' ...
  606
+ ~ loading gem 'activerecord' ...
  607
+ ~ Connecting to database...
  608
+ ~ Compiling routes...
  609
+ ~ Using 'share-nothing' cookie sessions (4kb limit per client)
29  spec/models/resource_spec.rb
@@ -11,6 +11,16 @@ def valid_attributes
11 11
       :tag        => "blog" 
12 12
     }
13 13
   end
  14
+  def invalid_attributes
  15
+    {
  16
+      :name       => "",
  17
+      :url        => "http:",
  18
+      :changesURL => "htt.example.com/changes.xml",
  19
+      :rssURL     => "htt.com/feed",
  20
+      :tag        => "blog" 
  21
+    }
  22
+  end
  23
+
14 24
 end  
15 25
 
16 26
 describe Resource do  
@@ -31,24 +41,33 @@ def valid_attributes
31 41
       Resource.count - count_before == 1
32 42
     end
33 43
     
34  
-    it "should update a resource when pinged" do
  44
+    it "should update a pinged resource that was last updated > 30min" do
35 45
       res = Resource.create(valid_attributes)
36 46
       last_updated_at = (Time.now - 1810)      
37 47
       
38  
-      puts "last updated at: #{last_updated_at}" # check last updated at
  48
+      puts "\nlast updated: #{last_updated_at}" # check last updated at
39 49
       
40 50
       Resource.record_timestamps = false # don't forget to reset to true
41 51
 
42 52
       res.update_attributes(:updated_at => last_updated_at)
43  
-      puts "before #{res.updated_at}" # check updated at was correctly set
  53
+      puts "before ping: #{res.updated_at}" # check updated at was correctly set
44 54
       
45 55
       Resource.record_timestamps = true 
46 56
       
47 57
       Resource.check_spam_from_json(valid_attributes)    
48 58
       res = Resource.find_by_url(valid_attributes[:url])
49  
-      res.updated_at > last_updated_at
50  
-      puts "after #{res.updated_at}"  # check the new time stamp has a diff of atleast 30min
  59
+      res.updated_at > (last_updated_at)
  60
+      puts "after ping: #{res.updated_at}"  # check the new time stamp has a diff of atleast 30min 
51 61
     end
  62
+
  63
+    it "should not update a pinged resource that was last updated < 30min ago" do
  64
+      res = Resource.create(valid_attributes)
  65
+      last_updated_at = res.updated_at
  66
+      Resource.check_spam_from_json(valid_attributes)
  67
+      res = Resource.find_by_url(valid_attributes[:url])
  68
+      res.updated_at == (last_updated_at)  
  69
+    end
  70
+    
52 71
   end
53 72
 
54 73
 end

0 notes on commit ab7f9d5

Please sign in to comment.
Something went wrong with that request. Please try again.