require 'scss_lint'
require 'nokogiri'

Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }

RSpec.configure do |config|
  config.before(:each) do
    # If running a linter spec, run the described linter against the CSS code
    # for each example. This significantly DRYs up our linter specs to contain
    # only tests, since all the setup code is now centralized here.
    if described_class < SCSSLint::Linter
      subject.run(SCSSLint::Engine.new(css))
    end
  end
end

require 'scss_lint'
require 'nokogiri'

Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }

RSpec.configure do |config|
  config.before(:each) do
    # If running a linter spec, run the described linter against the CSS code
    # for each example. This significantly DRYs up our linter specs to contain
    # only tests, since all the setup code is now centralized here.
    if described_class < SCSSLint::Linter
      initial_indent = css[/\A(\s*)/, 1]
      normalized_css = css.gsub(/^#{initial_indent}/, '')
      subject.run(SCSSLint::Engine.new(normalized_css))
    end
  end
end

Normalize CSS indentation in specs
Normalize CSS indentation in specs

Due to the use of Heredocs in specs, all CSS has leading indentation.

In order to correctly write tests for an upcoming lint that detects
invalid indentation, automatically normalize all CSS before it is passed
to the engine to be parsed.

Change-Id: I49891e2b4111ee7af066ddd2bf1db891aea5dacf
Reviewed-on: https://gerrit.causes.com/29758
Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
