Sha256: 2572bd19bc497ba01409c1ec5bce4afaf1ead7fb5691069e433ec45c6bfa047b

Contents?: true

Size: 926 Bytes

Versions: 1

Compression:

Stored size: 926 Bytes

Contents

require 'spec_helper'

describe Fukuzatsu::Formatters::Text do

  let (:summary) { Fukuzatsu::Summary.new(
      :source => "foo.rb",
      :entity => "Foo",
      :container => "Foo",
      :summaries => []
    )
  }

  let (:formatter) { Fukuzatsu::Formatters::Text.new(summary: summary) }

  describe "#header" do
    it "returns a header array" do
      expect(formatter.header).to eq ["Class/Module", "Method", "Complexity"]
    end
  end

  describe "#rows" do

    before do
      allow(summary).to receive(:container_name).and_return("Foo")
      allow(summary).to receive(:entity_name).and_return("*")
      allow(summary).to receive(:complexity).and_return(13)
      allow(summary).to receive(:averge_complexity).and_return(11)
    end

    it "returns formatted rows" do
      expect(formatter.rows).to eq(
        [
          ["\e[31mFoo\e[0m", "\e[31m*\e[0m", "\e[31m13\e[0m"]
        ]
      )
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fukuzatsu-2.1.1 spec/formatters/text_spec.rb