Sha256: 1b6b17b393873f08829ee3c81275010abfe8690604abd0f6d19e2a73d0538eb1

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

# encoding: utf-8
require "policy/cli"

describe Policy::CLI::Attribute do

  subject { described_class.new "FooBar{bar/baz}" }

  describe "#name" do

    context "when the name is present in the source" do

      it "returns a name for a method" do
        expect(subject.name).to eq "foo_bar"
      end

    end # context

    context "when the name is absent in the source" do

      subject { described_class.new "{bar/baz}" }

      it "returns @todo" do
        expect(subject.name).to eq "@todo"
      end

    end # context

  end # describe #name

  describe "#type" do

    context "when the type is present in the source" do

      it "returns a name for a constant" do
        expect(subject.type).to eq "Bar::Baz"
      end

    end # context

    context "when the type is absent in the source" do

      subject { described_class.new "FooBar" }

      it "returns @todo" do
        expect(subject.type).to eq "@todo"
      end

    end # context

  end # describe #type
  
end # describe Policy::CLI::Attribute

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
policy-2.0.0 spec/tests/lib/policy/cli/attribute_spec.rb