Sha256: 632d2ec1e5a673776341e5b056c65515ec5657f9d4c67ab129cd413ea1e3f933

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

describe Docks::Tags::Pattern do
  subject { Docks::Tags::Pattern.instance }

  it "does not allow multiline content" do
    expect(subject.multiline?).to be false
  end

  it "only allows one tag per block" do
    expect(subject.multiple_allowed?).to be false
  end

  describe "#process" do
    it "does not perform any processing" do
      content = "foo"
      expect(subject.process(content)).to eq content
    end
  end

  describe "post processing" do
    let(:symbols) do
      [
        Docks::Containers::Klass.new(name: "Foo"),
        Docks::Containers::Factory.new(name: "Bar"),
        Docks::Containers::Function.new(name: "fooBar"),
        Docks::Containers::Variable.new(name: "baz")
      ]
    end

    let(:pattern) do
      pattern = Docks::Containers::Pattern.new(name: "foo")
      pattern.add(:script, symbols)
      pattern
    end

    before(:each) do
      Docks::Tags.register(described_class)
    end

    it "adds the pattern name to all contained symbols" do
      Docks::Process.process(pattern)

      pattern.symbols.each do |symbol|
        expect(symbol[subject]).to eq pattern.name
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
docks_app-0.0.3 spec/lib/tags/pattern_tag_spec.rb
docks_app-0.0.2 spec/lib/tags/pattern_tag_spec.rb
docks_app-0.0.1 spec/lib/tags/pattern_tag_spec.rb