Sha256: 3951b6f26825c47453f3ee0dfe998393c3a81a9ea02051fc2f95ebdb0b38e0da

Contents?: true

Size: 981 Bytes

Versions: 3

Compression:

Stored size: 981 Bytes

Contents

require 'spec_helper'

describe ParsedMethod do

  let(:parsed_method) { ParsedMethod.new }
  let(:analyzer)    { Analyzer.new("class Foo; end") }

  describe "#complexity" do
    it "retrieves complexity from its analyzer" do
      allow(parsed_method).to receive(:analyzer) { analyzer }
      allow(analyzer).to receive(:complexity) { 23 }
      expect(parsed_method.complexity).to eq 23
    end
  end

  describe "#analyzer" do
    it "instantiates an Analyzer instance with content" do
      allow(parsed_method).to receive("content") { "stuff" }
      expect(parsed_method.analyzer.class.name).to eq "Analyzer"
    end
  end

  describe "#prefix" do
    it "returns '.' if its type is class" do
      allow(parsed_method).to receive("type") { :class }
      expect(parsed_method.prefix).to eq "."
    end
    it "returns '#' if its type is instance" do
      allow(parsed_method).to receive("type") { :instance }
      expect(parsed_method.prefix).to eq "#"
    end
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
analyst-0.13.1 spec/parsed_method_spec.rb
fukuzatsu-1.0.6 spec/parsed_method_spec.rb
fukuzatsu-1.0.5 spec/parsed_method_spec.rb