Sha256: 17148d22130fa54fd5b1a2a85178235b56249b84ae27400b2de5ced248dd1244

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

require "spec_helper"

RSpec.describe "suspenders:stylelint", type: :generator do
  context "generate" do
    it "creates .stylelintrc.json" do
      with_app { generate("suspenders:stylelint") }

      expect(".stylelintrc.json")
        .to match_contents(%r{"extends": "@thoughtbot/stylelint-config"})
    end

    it "adds stylelint and @thoughtbot/stylelint-config to the package.json" do
      with_app { generate("suspenders:stylelint") }

      expect("package.json").to match_contents(/devDependencies/)
      expect("package.json").to match_contents(/stylelint/)
      expect("package.json").to match_contents(%r{@thoughtbot/stylelint-config})
    end

    it "uncomments the hound config_file option" do
      with_app { generate("suspenders:stylelint") }

      expect(".hound.yml").to(
        match_contents(/^  config_file: \.stylelintrc\.json/)
      )
    end
  end

  context "destroy" do
    it "removes .stylelintrc.json" do
      with_app do
        generate("suspenders:stylelint")
        destroy("suspenders:stylelint")
      end

      expect(".stylelintrc.json").not_to exist_as_a_file
    end

    it "removes stylelint and @thoughtbot/stylelint-config from package.json" do
      with_app do
        generate("suspenders:stylelint")
        destroy("suspenders:stylelint")
      end

      expect("package.json").not_to match_contents(/stylelint/)
      expect("package.json")
        .not_to match_contents(%r{@thoughtbot/stylelint-config})
    end

    it "comments in the hound config_file option" do
      with_app do
        generate("suspenders:stylelint")
        destroy("suspenders:stylelint")
      end

      expect(".hound.yml")
        .to match_contents(/^  # config_file: \.stylelintrc\.json/)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
suspenders-1.55.1 spec/features/stylelint_spec.rb
suspenders-1.55.0 spec/features/stylelint_spec.rb