Sha256: 79def45ffd5557d04464b0a7370202f658ee7bff5acb4c582cc11e680a2ce520

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

require "test_helper"
require "rubycritic/core/analysed_file"

describe Rubycritic::AnalysedFile do
  describe "attribute readers" do
    before do
      @pathname = Pathname.new("./foo")
      @smells = []
      @churn = 1
      @complexity = 2
      @smell = Rubycritic::AnalysedFile.new(
        :pathname   => @pathname,
        :smells     => @smells,
        :churn      => @churn,
        :complexity => @complexity
      )
    end

    it "has a pathname reader" do
      @smell.pathname.must_equal @pathname
    end

    it "has a smells reader" do
      @smell.smells.must_equal @smells
    end

    it "has a churn reader" do
      @smell.churn.must_equal @churn
    end

    it "has a complexity reader" do
      @smell.complexity.must_equal @complexity
    end
  end

  describe "#name" do
    it "returns the name of the file" do
      analysed_file = Rubycritic::AnalysedFile.new(:pathname => Pathname.new("foo/bar.rb"))
      analysed_file.name.must_equal "bar"
    end
  end

  describe "#has_smells?" do
    it "returns true if the analysed_file has at least one smell" do
      analysed_file = Rubycritic::AnalysedFile.new(:smells => [SmellDouble.new])
      analysed_file.has_smells?.must_equal true
    end
  end
end

class SmellDouble; end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubycritic-0.0.14 test/lib/rubycritic/core/analysed_file_test.rb
rubycritic-0.0.13 test/lib/rubycritic/core/analysed_file_test.rb