Signed-off-by: Jesse Wolfe <[email protected]>
---
Local-branch: ticket/next/5174-part2
 app/models/report.rb       |    1 +
 spec/models/report_spec.rb |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/app/models/report.rb b/app/models/report.rb
index 2c38fbb..7c3b77e 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -20,6 +20,7 @@ class Report < ActiveRecord::Base
 
   named_scope :inspections, :conditions => {:kind => "inspect"}
   named_scope :applies,     :conditions => {:kind => "apply"  }
+  named_scope :baselines,   :include => :node, :conditions => 
['nodes.baseline_report_id = reports.id']
 
   def self.find_last_for(node)
     self.first(:conditions => {:node_id => node.id}, :order => 'time DESC', 
:limit => 1)
diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb
index 09767e7..5c0c86b 100644
--- a/spec/models/report_spec.rb
+++ b/spec/models/report_spec.rb
@@ -259,6 +259,8 @@ HEREDOC
 
         @report.reload
         @report.should be_baseline
+
+        Report.baselines.should == [...@report]
       end
 
       it "should unset other reports' baseline?" do
@@ -275,6 +277,8 @@ HEREDOC
 
         @report.reload
         @report.should_not be_baseline
+
+        Report.baselines.should == [...@report2]
       end
     end
 
-- 
1.7.0.4

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to