Sha256: cc579410650cbec210a76ba1e3b11a59ee0eb4983d3c66b3d0f72d3dda3ec57e

Contents?: true

Size: 749 Bytes

Versions: 7

Compression:

Stored size: 749 Bytes

Contents

require 'spec_helper'

describe Analyst::Entities::ConstantAssignment do

  let(:code) {<<-CODE
      class Carrier
        OBSTACLES = [:rain, :sleet, :snow]
        def deliver(mail)
          delivery = Delivery.new(mail)
          delivery.deliver!
        end
      end
    CODE
  }
  let(:parser)  { Analyst.for_source(code) }
  let(:klass)   { parser.classes.first }
  let(:constant_assignment) { klass.constant_assignments.first }

  describe "#name" do
    it "returns the short name of a constant" do
      expect(constant_assignment.name).to eq("OBSTACLES")
    end
  end

  describe "#full_name" do
    it "returns the full name of a constant" do
      expect(constant_assignment.full_name).to eq("Carrier::OBSTACLES")
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
analyst-1.2.4 spec/entities/constant_assignment_spec.rb
analyst-1.2.3 spec/entities/constant_assignment_spec.rb
analyst-1.2.2 spec/entities/constant_assignment_spec.rb
analyst-1.2.1 spec/entities/constant_assignment_spec.rb
analyst-1.2.0 spec/entities/constant_assignment_spec.rb
analyst-1.0.1 spec/entities/constant_assignment_spec.rb
analyst-1.0.0 spec/entities/constant_assignment_spec.rb