Sha256: 5909bb5e8859c353eeb46022b50a94463d9a5d50bc4c38f0ad7a267b5c6b92c4

Contents?: true

Size: 763 Bytes

Versions: 15

Compression:

Stored size: 763 Bytes

Contents

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

describe Simplabs::Excellent::Checks::FlogClassCheck do

  before do
    @excellent = Simplabs::Excellent::Runner.new(Simplabs::Excellent::Checks::FlogClassCheck.new({ :threshold => 0 }))
  end

  describe '#evaluate' do

    it 'should calculate the score correctly' do
      code = <<-END
        class User < ActiveRecord::Base
          has_many :projects
        end
      END
      @excellent.check_code(code)
      warnings = @excellent.warnings

      warnings.should_not be_empty
      warnings[0].info.should        == { :class => 'User', :score => 1 }
      warnings[0].line_number.should == 1
      warnings[0].message.should     == "User has flog score of 1."
    end

  end

end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
simplabs-excellent-1.2.2 spec/checks/flog_class_check_spec.rb
simplabs-excellent-1.3.0 spec/checks/flog_class_check_spec.rb
simplabs-excellent-1.3.1 spec/checks/flog_class_check_spec.rb
simplabs-excellent-1.4.0 spec/checks/flog_class_check_spec.rb
simplabs-excellent-1.4.1 spec/checks/flog_class_check_spec.rb
simplabs-excellent-1.4.2 spec/checks/flog_class_check_spec.rb
simplabs-excellent-1.5.0 spec/checks/flog_class_check_spec.rb
simplabs-excellent-1.5.1 spec/checks/flog_class_check_spec.rb
simplabs-excellent-1.5.2 spec/checks/flog_class_check_spec.rb
simplabs-excellent-1.5.3 spec/checks/flog_class_check_spec.rb
excellent-1.7.2 spec/checks/flog_class_check_spec.rb
excellent-1.7.1 spec/checks/flog_class_check_spec.rb
excellent-1.7.0 spec/checks/flog_class_check_spec.rb
excellent-1.6.0 spec/checks/flog_class_check_spec.rb
excellent-1.5.4 spec/checks/flog_class_check_spec.rb