Sha256: e35e63b17be41ca2f6f374aa00e8dae24975238dfb936dabe74f93b803e2e48c

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'
require 'komplement'

describe Komplement do
  it "should have a VERSION constant" do
    expect(subject.const_get('VERSION')).to_not be_empty
  end

  describe Base do
    it "should detect common html elements" do
      ret = Komplement::Base
              .new
              .with_ignored(Komplement::HTML_ELEMENTS)
              .in_filetypes(['html'])
              .in_dirs(['./spec/files/'])
              .find_offenses

      expect(ret).to_not be_empty
      expect(ret['./spec/files/bad_html.html']).to eq(['potato'])
    end

    it "should detect everything if no exclusion list is given" do
      ret = Komplement::Base
              .new
              .with_ignored([])
              .in_filetypes(['html'])
              .in_dirs(['./spec/files/'])
              .find_offenses

      expect(ret).to_not be_empty

      expect(ret['./spec/files/bad_html.html']).to eq([
        "html", "text", "head", "text", "text", "text", "text",
        "potato", "text", "h1", "body", "text", "html", "document"])
    end

    it "should ignore custom elements if specified so" do
      ret = Komplement::Base
              .new
              .with_ignored(Komplement::HTML_ELEMENTS)
              .with_ignored(['potato'])
              .in_filetypes(['html'])
              .in_dirs(['./spec/files/'])
              .find_offenses

      expect(ret).to be_empty
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
komplement-0.1.2 spec/komplement_spec.rb
komplement-0.1.1 spec/komplement_spec.rb
komplement-0.1.0 spec/komplement_spec.rb