Sha256: cb969d2c9893a7f9fce5d3030216b05254591add2aef43a21581a72440c27da7

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Saikuro do
    
  before :all do
    MetricFu::Configuration.run {}
    File.stub!(:directory?).and_return(true)
    saikuro = MetricFu::Saikuro.new
    saikuro.stub!(:metric_directory).and_return(File.join(File.dirname(__FILE__), "..", "resources", "saikuro"))
    saikuro.analyze
    @output = saikuro.to_h
  end
  
  it "should find the filename of a file" do
    @output[:saikuro][:files].first[:filename].should == 'users_controller.rb'
  end
  
  it "should find the name of the classes" do
    @output[:saikuro][:classes].first[:name].should == "UsersController"
    @output[:saikuro][:classes][1][:name].should == "SessionsController"
  end
  
  it "should put the most complex method first" do
    @output[:saikuro][:methods].first[:name].should == "UsersController#create"
    @output[:saikuro][:methods].first[:complexity].should == 4
  end
  
  it "should find the complexity of a method" do
    @output[:saikuro][:methods].first[:complexity].should == 4
  end
  
  it "should find the lines of a method" do
    @output[:saikuro][:methods].first[:lines].should == 15
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jscruggs-metric_fu-1.0.0 spec/generators/saikuro_spec.rb
jscruggs-metric_fu-1.0.1 spec/generators/saikuro_spec.rb