Sha256: 7a20660138a94a5256a46e76b456be0dec015efa467a1f74a2242683e67fe635

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 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
      content = <<-END
        class User < ActiveRecord::Base
          has_many :projects
        end
      END
      @excellent.check_content(content)
      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

1 entries across 1 versions & 1 rubygems

Version Path
simplabs-excellent-1.2.1 spec/checks/flog_class_check_spec.rb