Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Starting on index

  • Loading branch information...
commit 3ac10cb0696a5360707d562495235dcb4d1e64c6 1 parent e3c9bbf
Nick Quaranto qrush authored
11 lib/report_card.rb
View
@@ -1,8 +1,10 @@
+$:.unshift(File.dirname(__FILE__))
+
require 'integrity'
require 'metric_fu'
require 'tinder'
-$:.unshift(File.dirname(__FILE__))
+require 'report_card/index'
require 'report_card/grader'
module ReportCard
@@ -12,9 +14,14 @@ def self.grade
Integrity.new(config['integrity_config'])
ignore = config['ignore'] ? Regexp.new(config['ignore']) : /[^\w\d\s]+/
+ projects = []
Integrity::Project.all.each do |project|
- ReportCard::Grader.new(project, config).grade if project.name !~ ignore
+ if project.name !~ ignore
+ grader = Grader.new(project, config)
+ grader.grade
+ projects << project if grader.success?
+ end
end
end
6 lib/report_card/index.rb
View
@@ -0,0 +1,6 @@
+module ReportCard
+ class Index
+ def self.create(projects, site)
+ end
+ end
+end
18 test/index_test.rb
View
@@ -0,0 +1,18 @@
+require 'test_helper'
+
+class IndexTest < Test::Unit::TestCase
+ context "with a few projects" do
+ setup do
+ @public_project1 = Integrity::Project.new(:name => "awesome")
+ @public_project2 = Integrity::Project.new(:name => "wicked")
+ @private_project = Integrity::Project.new(:name => "secret", :public => false)
+
+ @site = "/path/to/file"
+ @projects = [@public_project1, @public_project2, @private_project]
+ end
+
+ should "create index" do
+ ReportCard::Index.create(@projects, @site)
+ end
+ end
+end
6 test/report_card_test.rb
View
@@ -14,7 +14,11 @@ class ReportCardTest < Test::Unit::TestCase
mock(Integrity).new(@config['integrity_config'])
mock(Integrity::Project).all.mock!.each.yields(@project)
- mock(ReportCard::Grader).new(@project, @config).mock!.grade
+
+ grader = "grader"
+ mock(grader).grade
+ mock(grader).success? { true }
+ mock(ReportCard::Grader).new(@project, @config) { grader }
ReportCard.grade
end
Please sign in to comment.
Something went wrong with that request. Please try again.