devver-metric_fu 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY +182 -0
 - data/MIT-LICENSE +22 -0
 - data/Manifest.txt +25 -0
 - data/README.textile +27 -0
 - data/Rakefile +15 -0
 - data/TODO +9 -0
 - data/lib/base/base_template.rb +145 -0
 - data/lib/base/configuration.rb +182 -0
 - data/lib/base/generator.rb +167 -0
 - data/lib/base/graph.rb +39 -0
 - data/lib/base/md5_tracker.rb +52 -0
 - data/lib/base/report.rb +100 -0
 - data/lib/generators/churn.rb +34 -0
 - data/lib/generators/flay.rb +35 -0
 - data/lib/generators/flog.rb +167 -0
 - data/lib/generators/rails_best_practices.rb +31 -0
 - data/lib/generators/rcov.rb +82 -0
 - data/lib/generators/reek.rb +64 -0
 - data/lib/generators/roodi.rb +33 -0
 - data/lib/generators/saikuro.rb +221 -0
 - data/lib/generators/stats.rb +59 -0
 - data/lib/graphs/engines/bluff.rb +99 -0
 - data/lib/graphs/engines/gchart.rb +118 -0
 - data/lib/graphs/flay_grapher.rb +20 -0
 - data/lib/graphs/flog_grapher.rb +40 -0
 - data/lib/graphs/grapher.rb +11 -0
 - data/lib/graphs/rails_best_practices_grapher.rb +20 -0
 - data/lib/graphs/rcov_grapher.rb +20 -0
 - data/lib/graphs/reek_grapher.rb +32 -0
 - data/lib/graphs/roodi_grapher.rb +20 -0
 - data/lib/metric_fu.rb +31 -0
 - data/lib/templates/awesome/awesome_template.rb +37 -0
 - data/lib/templates/awesome/churn.html.erb +58 -0
 - data/lib/templates/awesome/css/buttons.css +82 -0
 - data/lib/templates/awesome/css/default.css +91 -0
 - data/lib/templates/awesome/css/integrity.css +335 -0
 - data/lib/templates/awesome/css/reset.css +7 -0
 - data/lib/templates/awesome/flay.html.erb +34 -0
 - data/lib/templates/awesome/flog.html.erb +53 -0
 - data/lib/templates/awesome/index.html.erb +31 -0
 - data/lib/templates/awesome/layout.html.erb +30 -0
 - data/lib/templates/awesome/rails_best_practices.html.erb +27 -0
 - data/lib/templates/awesome/rcov.html.erb +42 -0
 - data/lib/templates/awesome/reek.html.erb +40 -0
 - data/lib/templates/awesome/roodi.html.erb +27 -0
 - data/lib/templates/awesome/saikuro.html.erb +71 -0
 - data/lib/templates/awesome/stats.html.erb +41 -0
 - data/lib/templates/javascripts/bluff-min.js +1 -0
 - data/lib/templates/javascripts/excanvas.js +35 -0
 - data/lib/templates/javascripts/js-class.js +1 -0
 - data/lib/templates/standard/churn.html.erb +31 -0
 - data/lib/templates/standard/default.css +64 -0
 - data/lib/templates/standard/flay.html.erb +34 -0
 - data/lib/templates/standard/flog.html.erb +53 -0
 - data/lib/templates/standard/index.html.erb +41 -0
 - data/lib/templates/standard/rails_best_practices.html.erb +29 -0
 - data/lib/templates/standard/rcov.html.erb +43 -0
 - data/lib/templates/standard/reek.html.erb +42 -0
 - data/lib/templates/standard/roodi.html.erb +29 -0
 - data/lib/templates/standard/saikuro.html.erb +84 -0
 - data/lib/templates/standard/standard_template.rb +26 -0
 - data/lib/templates/standard/stats.html.erb +55 -0
 - data/spec/base/base_template_spec.rb +161 -0
 - data/spec/base/configuration_spec.rb +270 -0
 - data/spec/base/generator_spec.rb +244 -0
 - data/spec/base/graph_spec.rb +24 -0
 - data/spec/base/md5_tracker_spec.rb +57 -0
 - data/spec/base/report_spec.rb +139 -0
 - data/spec/generators/churn_spec.rb +43 -0
 - data/spec/generators/flay_spec.rb +110 -0
 - data/spec/generators/flog_spec.rb +238 -0
 - data/spec/generators/reek_spec.rb +125 -0
 - data/spec/generators/saikuro_spec.rb +58 -0
 - data/spec/generators/stats_spec.rb +74 -0
 - data/spec/graphs/engines/bluff_spec.rb +18 -0
 - data/spec/graphs/engines/gchart_spec.rb +108 -0
 - data/spec/graphs/flay_grapher_spec.rb +37 -0
 - data/spec/graphs/flog_grapher_spec.rb +45 -0
 - data/spec/graphs/rcov_grapher_spec.rb +37 -0
 - data/spec/graphs/reek_grapher_spec.rb +46 -0
 - data/spec/graphs/roodi_grapher_spec.rb +37 -0
 - data/spec/resources/saikuro/app/controllers/sessions_controller.rb_cyclo.html +10 -0
 - data/spec/resources/saikuro/app/controllers/users_controller.rb_cyclo.html +16 -0
 - data/spec/resources/saikuro/index_cyclo.html +155 -0
 - data/spec/resources/saikuro_sfiles/thing.rb_cyclo.html +11 -0
 - data/spec/resources/yml/20090630.yml +7844 -0
 - data/spec/spec.opts +6 -0
 - data/spec/spec_helper.rb +7 -0
 - data/tasks/metric_fu.rake +22 -0
 - metadata +253 -0
 
| 
         @@ -0,0 +1,58 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
         
     | 
| 
      
 2 
     | 
    
         
            +
             
         
     | 
| 
      
 3 
     | 
    
         
            +
            describe Saikuro do
         
     | 
| 
      
 4 
     | 
    
         
            +
              describe "to_h method" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                before :all do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  MetricFu::Configuration.run {}
         
     | 
| 
      
 7 
     | 
    
         
            +
                  File.stub!(:directory?).and_return(true)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  saikuro = MetricFu::Saikuro.new
         
     | 
| 
      
 9 
     | 
    
         
            +
                  saikuro.stub!(:metric_directory).and_return(File.join(File.dirname(__FILE__), "..", "resources", "saikuro"))
         
     | 
| 
      
 10 
     | 
    
         
            +
                  saikuro.analyze
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @output = saikuro.to_h
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                it "should find the filename of a file" do
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @output[:saikuro][:files].first[:filename].should == 'users_controller.rb'
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
         
     | 
| 
      
 18 
     | 
    
         
            +
                it "should find the name of the classes" do
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @output[:saikuro][:classes].first[:name].should == "UsersController"
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @output[:saikuro][:classes][1][:name].should == "SessionsController"
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                it "should put the most complex method first" do
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @output[:saikuro][:methods].first[:name].should == "UsersController#create"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @output[:saikuro][:methods].first[:complexity].should == 4
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
         
     | 
| 
      
 28 
     | 
    
         
            +
                it "should find the complexity of a method" do
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @output[:saikuro][:methods].first[:complexity].should == 4
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
         
     | 
| 
      
 32 
     | 
    
         
            +
                it "should find the lines of a method" do
         
     | 
| 
      
 33 
     | 
    
         
            +
                  @output[:saikuro][:methods].first[:lines].should == 15
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
              describe "format_directories method" do
         
     | 
| 
      
 38 
     | 
    
         
            +
                it "should format the directories" do
         
     | 
| 
      
 39 
     | 
    
         
            +
                  MetricFu::Configuration.run {}
         
     | 
| 
      
 40 
     | 
    
         
            +
                  File.stub!(:directory?).and_return(true)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  saikuro = MetricFu::Saikuro.new
         
     | 
| 
      
 42 
     | 
    
         
            +
             
         
     | 
| 
      
 43 
     | 
    
         
            +
                  MetricFu.saikuro[:input_directory] = ["app", "lib"]
         
     | 
| 
      
 44 
     | 
    
         
            +
              
         
     | 
| 
      
 45 
     | 
    
         
            +
                  saikuro.format_directories.should == "\"app | lib\""
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
         
     | 
| 
      
 49 
     | 
    
         
            +
              describe Saikuro::SFile do
         
     | 
| 
      
 50 
     | 
    
         
            +
                describe "getting elements from a Saikuro result file" do
         
     | 
| 
      
 51 
     | 
    
         
            +
                 it "should parse nested START/END sections" do
         
     | 
| 
      
 52 
     | 
    
         
            +
                   path = File.join(File.dirname(__FILE__), "..", "resources", "saikuro_sfiles", "thing.rb_cyclo.html")
         
     | 
| 
      
 53 
     | 
    
         
            +
                    sfile = Saikuro::SFile.new path
         
     | 
| 
      
 54 
     | 
    
         
            +
                   sfile.elements.map { |e| e.complexity }.sort.should eql(["0","0","2"])
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,74 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Stats do
         
     | 
| 
      
 4 
     | 
    
         
            +
              describe "emit method" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                it "should gather the raw data" do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  MetricFu::Configuration.run {}
         
     | 
| 
      
 7 
     | 
    
         
            +
                  File.stub!(:directory?).and_return(true)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  stats = MetricFu::Stats.new
         
     | 
| 
      
 9 
     | 
    
         
            +
                  stats.should_receive(:`).with("rake stats > tmp/metric_fu/scratch/stats/stats.txt")
         
     | 
| 
      
 10 
     | 
    
         
            +
                  stats.emit
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
      
 14 
     | 
    
         
            +
              describe "analyze method" do
         
     | 
| 
      
 15 
     | 
    
         
            +
                before :each do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @lines =  <<-HERE.gsub(/^\s*/, "")
         
     | 
| 
      
 17 
     | 
    
         
            +
                  +----------------------+-------+-------+---------+---------+-----+-------+
         
     | 
| 
      
 18 
     | 
    
         
            +
                  | Name                 | Lines |   LOC | Classes | Methods | M/C | LOC/M |
         
     | 
| 
      
 19 
     | 
    
         
            +
                  +----------------------+-------+-------+---------+---------+-----+-------+
         
     | 
| 
      
 20 
     | 
    
         
            +
                  | Controllers          |   470 |   382 |       7 |      53 |   7 |     5 |
         
     | 
| 
      
 21 
     | 
    
         
            +
                  | Helpers              |   128 |    65 |       0 |       6 |   0 |     8 |
         
     | 
| 
      
 22 
     | 
    
         
            +
                  | Models               |   351 |   285 |       9 |      31 |   3 |     7 |
         
     | 
| 
      
 23 
     | 
    
         
            +
                  | Libraries            |   305 |   183 |       2 |      30 |  15 |     4 |
         
     | 
| 
      
 24 
     | 
    
         
            +
                  | Model specs          |   860 |   719 |       0 |       2 |   0 |   357 |
         
     | 
| 
      
 25 
     | 
    
         
            +
                  | View specs           |     0 |     0 |       0 |       0 |   0 |     0 |
         
     | 
| 
      
 26 
     | 
    
         
            +
                  | Controller specs     |  1570 |  1308 |       1 |      10 |  10 |   128 |
         
     | 
| 
      
 27 
     | 
    
         
            +
                  | Helper specs         |   191 |   172 |       0 |       0 |   0 |     0 |
         
     | 
| 
      
 28 
     | 
    
         
            +
                  | Library specs        |    31 |    27 |       0 |       0 |   0 |     0 |
         
     | 
| 
      
 29 
     | 
    
         
            +
                  +----------------------+-------+-------+---------+---------+-----+-------+
         
     | 
| 
      
 30 
     | 
    
         
            +
                  | Total                |  3906 |  3141 |      19 |     132 |   6 |    21 |
         
     | 
| 
      
 31 
     | 
    
         
            +
                  +----------------------+-------+-------+---------+---------+-----+-------+
         
     | 
| 
      
 32 
     | 
    
         
            +
                    Code LOC: 915     Test LOC: 2226     Code to Test Ratio: 1:2.4
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  HERE
         
     | 
| 
      
 35 
     | 
    
         
            +
                  MetricFu::Configuration.run {}
         
     | 
| 
      
 36 
     | 
    
         
            +
                  File.stub!(:directory?).and_return(true)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  stats = MetricFu::Stats.new
         
     | 
| 
      
 38 
     | 
    
         
            +
                  File.should_receive(:open).and_return(mock("file", :read => @lines))
         
     | 
| 
      
 39 
     | 
    
         
            +
                  @results = stats.analyze
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
                
         
     | 
| 
      
 42 
     | 
    
         
            +
                it "should get code Lines Of Code" do
         
     | 
| 
      
 43 
     | 
    
         
            +
                  @results[:codeLOC].should == 915
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
                
         
     | 
| 
      
 46 
     | 
    
         
            +
                it "should get test Lines Of Code" do
         
     | 
| 
      
 47 
     | 
    
         
            +
                  @results[:testLOC].should == 2226
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
                
         
     | 
| 
      
 50 
     | 
    
         
            +
                it "should get code to test ratio" do
         
     | 
| 
      
 51 
     | 
    
         
            +
                  @results[:code_to_test_ratio].should == 2.4
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
                
         
     | 
| 
      
 54 
     | 
    
         
            +
                it "should get data on models" do
         
     | 
| 
      
 55 
     | 
    
         
            +
                  model_data = @results[:lines].find {|line| line[:name] == "Models"}
         
     | 
| 
      
 56 
     | 
    
         
            +
                  model_data[:classes].should == 9
         
     | 
| 
      
 57 
     | 
    
         
            +
                  model_data[:methods].should == 31
         
     | 
| 
      
 58 
     | 
    
         
            +
                  model_data[:loc].should == 285
         
     | 
| 
      
 59 
     | 
    
         
            +
                  model_data[:lines].should == 351
         
     | 
| 
      
 60 
     | 
    
         
            +
                  model_data[:methods_per_class].should == 3
         
     | 
| 
      
 61 
     | 
    
         
            +
                  model_data[:loc_per_method].should == 7
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
              end
         
     | 
| 
      
 64 
     | 
    
         
            +
              
         
     | 
| 
      
 65 
     | 
    
         
            +
              describe "to_h method" do
         
     | 
| 
      
 66 
     | 
    
         
            +
                it "should put things into a hash" do
         
     | 
| 
      
 67 
     | 
    
         
            +
                  MetricFu::Configuration.run {}
         
     | 
| 
      
 68 
     | 
    
         
            +
                  File.stub!(:directory?).and_return(true)
         
     | 
| 
      
 69 
     | 
    
         
            +
                  stats = MetricFu::Stats.new
         
     | 
| 
      
 70 
     | 
    
         
            +
                  stats.instance_variable_set(:@stats, "the_stats")
         
     | 
| 
      
 71 
     | 
    
         
            +
                  stats.to_h[:stats].should == "the_stats"
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
              end
         
     | 
| 
      
 74 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe "Bluff graphers responding to #graph!" do
         
     | 
| 
      
 4 
     | 
    
         
            +
              it "should write chart file" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                MetricFu.configuration
         
     | 
| 
      
 6 
     | 
    
         
            +
                graphs = {}
         
     | 
| 
      
 7 
     | 
    
         
            +
                MetricFu::AVAILABLE_GRAPHS.each do |graph|
         
     | 
| 
      
 8 
     | 
    
         
            +
                  grapher_name = graph.to_s.gsub("MetricFu::",'').gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
         
     | 
| 
      
 9 
     | 
    
         
            +
                  grapher_name =  grapher_name+"BluffGrapher"
         
     | 
| 
      
 10 
     | 
    
         
            +
                  graphs[graph] = MetricFu.const_get(grapher_name).new
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
                graphs.each do |key, val|
         
     | 
| 
      
 13 
     | 
    
         
            +
                  val.graph!
         
     | 
| 
      
 14 
     | 
    
         
            +
                  output_dir = File.expand_path(File.join(MetricFu.output_directory))
         
     | 
| 
      
 15 
     | 
    
         
            +
                  lambda{ File.open(File.join(output_dir, "#{key.to_s.downcase}.js")) }.should_not raise_error
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,108 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
         
     | 
| 
      
 2 
     | 
    
         
            +
            describe MetricFu::GchartGrapher do
         
     | 
| 
      
 3 
     | 
    
         
            +
              describe "determine_y_axis_scale" do
         
     | 
| 
      
 4 
     | 
    
         
            +
                it "should set defaults when empty array" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                  grapher = Object.new.extend(MetricFu::GchartGrapher)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  grapher.determine_y_axis_scale([])
         
     | 
| 
      
 7 
     | 
    
         
            +
                  grapher.instance_variable_get(:@max_value).should == 10
         
     | 
| 
      
 8 
     | 
    
         
            +
                  grapher.instance_variable_get(:@yaxis).should == [0, 2, 4, 6, 8, 10]
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
                
         
     | 
| 
      
 11 
     | 
    
         
            +
                it "should set max value of the graph above largest value" do
         
     | 
| 
      
 12 
     | 
    
         
            +
                  grapher = Object.new.extend(MetricFu::GchartGrapher)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  grapher.determine_y_axis_scale([19])
         
     | 
| 
      
 14 
     | 
    
         
            +
                  grapher.instance_variable_get(:@max_value).should == 20
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                  grapher.determine_y_axis_scale([20])
         
     | 
| 
      
 17 
     | 
    
         
            +
                  grapher.instance_variable_get(:@max_value).should == 25
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            describe "Gchart graphers" do
         
     | 
| 
      
 23 
     | 
    
         
            +
              before :each do
         
     | 
| 
      
 24 
     | 
    
         
            +
                MetricFu.configuration
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
              
         
     | 
| 
      
 27 
     | 
    
         
            +
              describe "FlayGchartGrapher graph! method" do
         
     | 
| 
      
 28 
     | 
    
         
            +
                it "should set static values for graph" do
         
     | 
| 
      
 29 
     | 
    
         
            +
                  grapher = FlayGchartGrapher.new
         
     | 
| 
      
 30 
     | 
    
         
            +
                  expected = {
         
     | 
| 
      
 31 
     | 
    
         
            +
                    :size => MetricFu::GchartGrapher::GCHART_GRAPH_SIZE,
         
     | 
| 
      
 32 
     | 
    
         
            +
                    :title => URI.escape("Flay: duplication"),
         
     | 
| 
      
 33 
     | 
    
         
            +
                    :axis_with_labels => 'x,y',
         
     | 
| 
      
 34 
     | 
    
         
            +
                    :format => 'file',
         
     | 
| 
      
 35 
     | 
    
         
            +
                    :filename => File.join(MetricFu.output_directory, 'flay.png'),
         
     | 
| 
      
 36 
     | 
    
         
            +
                  }
         
     | 
| 
      
 37 
     | 
    
         
            +
                  Gchart.should_receive(:line).with(hash_including(expected))
         
     | 
| 
      
 38 
     | 
    
         
            +
                  grapher.graph!
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
              
         
     | 
| 
      
 42 
     | 
    
         
            +
              describe "FlogGchartGrapher graph! method" do
         
     | 
| 
      
 43 
     | 
    
         
            +
                it "should set static values for graph" do
         
     | 
| 
      
 44 
     | 
    
         
            +
                  grapher = FlogGchartGrapher.new
         
     | 
| 
      
 45 
     | 
    
         
            +
                  expected = {
         
     | 
| 
      
 46 
     | 
    
         
            +
                    :size => MetricFu::GchartGrapher::GCHART_GRAPH_SIZE,
         
     | 
| 
      
 47 
     | 
    
         
            +
                    :title => URI.escape("Flog: code complexity"),
         
     | 
| 
      
 48 
     | 
    
         
            +
                    :stacked => false,
         
     | 
| 
      
 49 
     | 
    
         
            +
                    :bar_colors => MetricFu::GchartGrapher::COLORS[0..1],
         
     | 
| 
      
 50 
     | 
    
         
            +
                    :legend => ['average', 'top 5%25 average'],
         
     | 
| 
      
 51 
     | 
    
         
            +
                    :axis_with_labels => 'x,y',
         
     | 
| 
      
 52 
     | 
    
         
            +
                    :format => 'file',
         
     | 
| 
      
 53 
     | 
    
         
            +
                    :filename => File.join(MetricFu.output_directory, 'flog.png'),
         
     | 
| 
      
 54 
     | 
    
         
            +
                  }
         
     | 
| 
      
 55 
     | 
    
         
            +
                  Gchart.should_receive(:line).with(hash_including(expected))
         
     | 
| 
      
 56 
     | 
    
         
            +
                  grapher.graph!
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
              
         
     | 
| 
      
 60 
     | 
    
         
            +
              describe "RcovGchartGrapher graph! method" do
         
     | 
| 
      
 61 
     | 
    
         
            +
                it "should set static values for graph" do
         
     | 
| 
      
 62 
     | 
    
         
            +
                  grapher = RcovGchartGrapher.new
         
     | 
| 
      
 63 
     | 
    
         
            +
                  expected = {
         
     | 
| 
      
 64 
     | 
    
         
            +
                    :size => MetricFu::GchartGrapher::GCHART_GRAPH_SIZE,
         
     | 
| 
      
 65 
     | 
    
         
            +
                    :title => URI.escape("Rcov: code coverage"),
         
     | 
| 
      
 66 
     | 
    
         
            +
                    :max_value => 101,
         
     | 
| 
      
 67 
     | 
    
         
            +
                    :axis_with_labels => 'x,y',
         
     | 
| 
      
 68 
     | 
    
         
            +
                    :axis_labels => [grapher.labels.values, [0,20,40,60,80,100]],
         
     | 
| 
      
 69 
     | 
    
         
            +
                    :format => 'file',
         
     | 
| 
      
 70 
     | 
    
         
            +
                    :filename => File.join(MetricFu.output_directory, 'rcov.png'),
         
     | 
| 
      
 71 
     | 
    
         
            +
                  }
         
     | 
| 
      
 72 
     | 
    
         
            +
                  Gchart.should_receive(:line).with(hash_including(expected))
         
     | 
| 
      
 73 
     | 
    
         
            +
                  grapher.graph!
         
     | 
| 
      
 74 
     | 
    
         
            +
                end
         
     | 
| 
      
 75 
     | 
    
         
            +
              end
         
     | 
| 
      
 76 
     | 
    
         
            +
              
         
     | 
| 
      
 77 
     | 
    
         
            +
              describe "ReekGchartGrapher graph! method" do
         
     | 
| 
      
 78 
     | 
    
         
            +
                it "should set static values for graph" do
         
     | 
| 
      
 79 
     | 
    
         
            +
                  grapher = ReekGchartGrapher.new
         
     | 
| 
      
 80 
     | 
    
         
            +
                  expected = {
         
     | 
| 
      
 81 
     | 
    
         
            +
                    :size => MetricFu::GchartGrapher::GCHART_GRAPH_SIZE,
         
     | 
| 
      
 82 
     | 
    
         
            +
                    :title => URI.escape("Reek: code smells"),
         
     | 
| 
      
 83 
     | 
    
         
            +
                    :stacked => false,
         
     | 
| 
      
 84 
     | 
    
         
            +
                    :bar_colors => MetricFu::GchartGrapher::COLORS,
         
     | 
| 
      
 85 
     | 
    
         
            +
                    :axis_with_labels => 'x,y',
         
     | 
| 
      
 86 
     | 
    
         
            +
                    :format => 'file',
         
     | 
| 
      
 87 
     | 
    
         
            +
                    :filename => File.join(MetricFu.output_directory, 'reek.png'),
         
     | 
| 
      
 88 
     | 
    
         
            +
                  }
         
     | 
| 
      
 89 
     | 
    
         
            +
                  Gchart.should_receive(:line).with(hash_including(expected))
         
     | 
| 
      
 90 
     | 
    
         
            +
                  grapher.graph!
         
     | 
| 
      
 91 
     | 
    
         
            +
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
              end
         
     | 
| 
      
 93 
     | 
    
         
            +
              
         
     | 
| 
      
 94 
     | 
    
         
            +
              describe "RoodiGchartGrapher graph! method" do
         
     | 
| 
      
 95 
     | 
    
         
            +
                it "should set static values for graph" do
         
     | 
| 
      
 96 
     | 
    
         
            +
                  grapher = RoodiGchartGrapher.new
         
     | 
| 
      
 97 
     | 
    
         
            +
                  expected = {
         
     | 
| 
      
 98 
     | 
    
         
            +
                    :size => MetricFu::GchartGrapher::GCHART_GRAPH_SIZE,
         
     | 
| 
      
 99 
     | 
    
         
            +
                    :title => URI.escape("Roodi: potential design problems"),
         
     | 
| 
      
 100 
     | 
    
         
            +
                    :axis_with_labels => 'x,y',
         
     | 
| 
      
 101 
     | 
    
         
            +
                    :format => 'file',
         
     | 
| 
      
 102 
     | 
    
         
            +
                    :filename => File.join(MetricFu.output_directory, 'roodi.png'),
         
     | 
| 
      
 103 
     | 
    
         
            +
                  }
         
     | 
| 
      
 104 
     | 
    
         
            +
                  Gchart.should_receive(:line).with(hash_including(expected))
         
     | 
| 
      
 105 
     | 
    
         
            +
                  grapher.graph!
         
     | 
| 
      
 106 
     | 
    
         
            +
                end
         
     | 
| 
      
 107 
     | 
    
         
            +
              end
         
     | 
| 
      
 108 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe FlayGrapher do 
         
     | 
| 
      
 4 
     | 
    
         
            +
              before :each do
         
     | 
| 
      
 5 
     | 
    
         
            +
                @flay_grapher = MetricFu::FlayGrapher.new
         
     | 
| 
      
 6 
     | 
    
         
            +
                MetricFu.configuration
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              it "should respond to flay_score and labels" do
         
     | 
| 
      
 10 
     | 
    
         
            +
                @flay_grapher.should respond_to(:flay_score)
         
     | 
| 
      
 11 
     | 
    
         
            +
                @flay_grapher.should respond_to(:labels)
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
      
 14 
     | 
    
         
            +
              describe "responding to #initialize" do
         
     | 
| 
      
 15 
     | 
    
         
            +
                it "should initialise flay_score and labels" do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @flay_grapher.flay_score.should == []
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @flay_grapher.labels.should == {}
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
              
         
     | 
| 
      
 21 
     | 
    
         
            +
              describe "responding to #get_metrics" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @date = "1/2"
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                it "should push 476 to flay_score" do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @flay_grapher.flay_score.should_receive(:push).with(476)      
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @flay_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                it "should update labels with the date" do
         
     | 
| 
      
 33 
     | 
    
         
            +
                  @flay_grapher.labels.should_receive(:update).with({ 0 => "1/2" })
         
     | 
| 
      
 34 
     | 
    
         
            +
                  @flay_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe MetricFu::FlogGrapher do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before :each do
         
     | 
| 
      
 5 
     | 
    
         
            +
                @flog_grapher = MetricFu::FlogGrapher.new
         
     | 
| 
      
 6 
     | 
    
         
            +
                MetricFu.configuration
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              it "should respond to flog_total, flog_average and labels" do
         
     | 
| 
      
 10 
     | 
    
         
            +
                @flog_grapher.should respond_to(:flog_average)
         
     | 
| 
      
 11 
     | 
    
         
            +
                @flog_grapher.should respond_to(:labels)
         
     | 
| 
      
 12 
     | 
    
         
            +
                @flog_grapher.should respond_to(:top_five_percent_average)
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
              
         
     | 
| 
      
 15 
     | 
    
         
            +
              describe "responding to #initialize" do
         
     | 
| 
      
 16 
     | 
    
         
            +
                it "should initialize top_five_percent_average, flog_average and labels" do
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @flog_grapher.flog_average.should == []
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @flog_grapher.labels.should == {}
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @flog_grapher.top_five_percent_average.should == []
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
              
         
     | 
| 
      
 23 
     | 
    
         
            +
              describe "responding to #get_metrics" do
         
     | 
| 
      
 24 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
         
     | 
| 
      
 26 
     | 
    
         
            +
                  @date = "1/2"
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
                
         
     | 
| 
      
 29 
     | 
    
         
            +
                it "should push to top_five_percent_average" do
         
     | 
| 
      
 30 
     | 
    
         
            +
                  average = (73.6 + 68.5 + 66.1 + 46.6 + 44.8 + 44.1 + 41.2 + 36.0) / 8.0
         
     | 
| 
      
 31 
     | 
    
         
            +
                  @flog_grapher.top_five_percent_average.should_receive(:push).with(average)      
         
     | 
| 
      
 32 
     | 
    
         
            +
                  @flog_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
                
         
     | 
| 
      
 35 
     | 
    
         
            +
                it "should push 9.9 to flog_average" do
         
     | 
| 
      
 36 
     | 
    
         
            +
                  @flog_grapher.flog_average.should_receive(:push).with(9.9)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  @flog_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
                
         
     | 
| 
      
 40 
     | 
    
         
            +
                it "should update labels with the date" do
         
     | 
| 
      
 41 
     | 
    
         
            +
                  @flog_grapher.labels.should_receive(:update).with({ 0 => "1/2" })
         
     | 
| 
      
 42 
     | 
    
         
            +
                  @flog_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe RcovGrapher do 
         
     | 
| 
      
 4 
     | 
    
         
            +
              before :each do
         
     | 
| 
      
 5 
     | 
    
         
            +
                @rcov_grapher = MetricFu::RcovGrapher.new
         
     | 
| 
      
 6 
     | 
    
         
            +
                MetricFu.configuration
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              it "should respond to rcov_percent and labels" do
         
     | 
| 
      
 10 
     | 
    
         
            +
                @rcov_grapher.should respond_to(:rcov_percent)
         
     | 
| 
      
 11 
     | 
    
         
            +
                @rcov_grapher.should respond_to(:labels)
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
      
 14 
     | 
    
         
            +
              describe "responding to #initialize" do
         
     | 
| 
      
 15 
     | 
    
         
            +
                it "should initialise rcov_percent and labels" do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @rcov_grapher.rcov_percent.should == []
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @rcov_grapher.labels.should == {}
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
              
         
     | 
| 
      
 21 
     | 
    
         
            +
              describe "responding to #get_metrics" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @date = "1/2"
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                it "should push 49.6 to rcov_percent" do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @rcov_grapher.rcov_percent.should_receive(:push).with(49.6)      
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @rcov_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                it "should update labels with the date" do
         
     | 
| 
      
 33 
     | 
    
         
            +
                  @rcov_grapher.labels.should_receive(:update).with({ 0 => "1/2" })
         
     | 
| 
      
 34 
     | 
    
         
            +
                  @rcov_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe ReekGrapher do 
         
     | 
| 
      
 4 
     | 
    
         
            +
              before :each do
         
     | 
| 
      
 5 
     | 
    
         
            +
                @reek_grapher = MetricFu::ReekGrapher.new
         
     | 
| 
      
 6 
     | 
    
         
            +
                MetricFu.configuration
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              it "should respond to reek_count and labels" do
         
     | 
| 
      
 10 
     | 
    
         
            +
                @reek_grapher.should respond_to(:reek_count)
         
     | 
| 
      
 11 
     | 
    
         
            +
                @reek_grapher.should respond_to(:labels)
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
      
 14 
     | 
    
         
            +
              describe "responding to #initialize" do
         
     | 
| 
      
 15 
     | 
    
         
            +
                it "should initialise reek_count and labels" do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @reek_grapher.reek_count.should == {}
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @reek_grapher.labels.should == {}
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
              
         
     | 
| 
      
 21 
     | 
    
         
            +
              describe "responding to #get_metrics" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @date = "1/2"
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                it "should set a hash of code smells to reek_count" do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @reek_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @reek_grapher.reek_count.should == {
         
     | 
| 
      
 30 
     | 
    
         
            +
                    "Uncommunicative Name" => [27],
         
     | 
| 
      
 31 
     | 
    
         
            +
                    "Feature Envy" => [20],
         
     | 
| 
      
 32 
     | 
    
         
            +
                    "Utility Function" => [15],
         
     | 
| 
      
 33 
     | 
    
         
            +
                    "Long Method" => [26],
         
     | 
| 
      
 34 
     | 
    
         
            +
                    "Nested Iterators" => [12],
         
     | 
| 
      
 35 
     | 
    
         
            +
                    "Control Couple" => [4],
         
     | 
| 
      
 36 
     | 
    
         
            +
                    "Duplication" => [48],
         
     | 
| 
      
 37 
     | 
    
         
            +
                    "Large Class" => [1] 
         
     | 
| 
      
 38 
     | 
    
         
            +
                  }
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
                
         
     | 
| 
      
 41 
     | 
    
         
            +
                it "should update labels with the date" do
         
     | 
| 
      
 42 
     | 
    
         
            +
                  @reek_grapher.labels.should_receive(:update).with({ 0 => "1/2" })
         
     | 
| 
      
 43 
     | 
    
         
            +
                  @reek_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe RoodiGrapher do 
         
     | 
| 
      
 4 
     | 
    
         
            +
              before :each do
         
     | 
| 
      
 5 
     | 
    
         
            +
                @roodi_grapher = MetricFu::RoodiGrapher.new
         
     | 
| 
      
 6 
     | 
    
         
            +
                MetricFu.configuration
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              it "should respond to roodi_count and labels" do
         
     | 
| 
      
 10 
     | 
    
         
            +
                @roodi_grapher.should respond_to(:roodi_count)
         
     | 
| 
      
 11 
     | 
    
         
            +
                @roodi_grapher.should respond_to(:labels)
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
      
 14 
     | 
    
         
            +
              describe "responding to #initialize" do
         
     | 
| 
      
 15 
     | 
    
         
            +
                it "should initialise roodi_count and labels" do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @roodi_grapher.roodi_count.should == []
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @roodi_grapher.labels.should == {}
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
              
         
     | 
| 
      
 21 
     | 
    
         
            +
              describe "responding to #get_metrics" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @date = "1/2"
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                it "should push 13 to roodi_count" do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @roodi_grapher.roodi_count.should_receive(:push).with(13)      
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @roodi_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                it "should update labels with the date" do
         
     | 
| 
      
 33 
     | 
    
         
            +
                  @roodi_grapher.labels.should_receive(:update).with({ 0 => "1/2" })
         
     | 
| 
      
 34 
     | 
    
         
            +
                  @roodi_grapher.get_metrics(@metrics, @date)
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     |