Sha256: 82b3a3da19c7a0201ab0ea7c4e4498d69733d07a883697a2e026aaddece8d732

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

require "spec_helper"

describe Docks::Languages::Stylus do
  subject { Docks::Languages::Stylus.instance }

  describe ".extensions" do
    let(:extensions) { [subject.class.extensions].flatten }

    it "includes .less as an extension" do
      expect(extensions).to include "styl"
    end
  end

  describe "#signature_for" do
    let(:name) { "foo" }

    let(:mixin_no_params) { Docks::Containers::Mixin.new(name: name) }
    let(:mixin_with_params) { Docks::Containers::Mixin.new(name: name, params: [OpenStruct.new(name: "bar"), OpenStruct.new(name: "baz", default: "'qux'")]) }

    let(:something_else) { Docks::Containers::Component.new(name: name) }

    it "gives a signature to mixins with no params" do
      expect(subject.signature_for(mixin_no_params)).to eq "#{name}() // ..."
    end

    it "gives a signature to mixins with params, including default values" do
      expect(subject.signature_for(mixin_with_params)).to eq "#{name}(bar, baz = 'qux') // ..."
    end

    it "returns nil if the symbol is not a function/ mixin" do
      expect(subject.signature_for(something_else)).to be nil
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
docks_app-0.0.3 spec/lib/languages/stylus_language_spec.rb
docks_app-0.0.2 spec/lib/languages/stylus_language_spec.rb
docks_app-0.0.1 spec/lib/languages/stylus_language_spec.rb