Sha256: 42293edc5f5d3a4b79970474542d6b62a6787588a3d030f997c47867c368f212

Contents?: true

Size: 983 Bytes

Versions: 9

Compression:

Stored size: 983 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

9 entries across 9 versions & 1 rubygems

Version Path
fukuzatsu-1.0.4 spec/parsed_method_spec.rb
fukuzatsu-1.0.3 spec/parsed_method_spec.rb
fukuzatsu-1.0.2 spec/parsed_method_spec.rb
fukuzatsu-1.0.1 spec/parsed_method_spec.rb
fukuzatsu-1.0.0 spec/parsed_method_spec.rb
fukuzatsu-0.10.1 spec/parsed_method_spec.rb
fukuzatsu-0.9.16 spec/parsed_method_spec.rb
fukuzatsu-0.9.15 spec/parsed_method_spec.rb
fukuzatsu-0.9.14 spec/parsed_method_spec.rb