Sha256: 2ac7aacb097645f75fab90506dd578b2fb6f060f9c2f38ce8dc970ee8f38c336

Contents?: true

Size: 866 Bytes

Versions: 13

Compression:

Stored size: 866 Bytes

Contents

require 'spec_helper'
require 'scss_lint/rake_task'
require 'tempfile'

describe SCSSLint::RakeTask do
  before(:all) do
    SCSSLint::RakeTask.new
  end

  before do
    STDOUT.stub(:write) # Silence console output
  end

  let(:file) do
    Tempfile.new(%w[scss-file .scss]).tap do |f|
      f.write(scss)
      f.close
    end
  end

  def run_task
    Rake::Task[:scss_lint].tap do |t|
      t.reenable # Allows us to execute task multiple times
      t.invoke(file.path)
    end
  end

  context 'when SCSS document is valid with no lints' do
    let(:scss) { '' }

    it 'does not call Kernel.exit' do
      expect { run_task }.not_to raise_error
    end
  end

  context 'when SCSS document is invalid' do
    let(:scss) { '.class {' }

    it 'calls Kernel.exit with the status code' do
      expect { run_task }.to raise_error SystemExit
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
scss_lint-0.41.0 spec/scss_lint/rake_task_spec.rb
scss_lint-0.40.1 spec/scss_lint/rake_task_spec.rb
scss_lint-0.40.0 spec/scss_lint/rake_task_spec.rb
scss_lint-0.39.0 spec/scss_lint/rake_task_spec.rb
scss_lint-0.38.0 spec/scss_lint/rake_task_spec.rb
scss-lint-0.38.0 spec/scss_lint/rake_task_spec.rb
scss-lint-bliss-1.0.0 spec/scss_lint/rake_task_spec.rb
scss-lint-0.37.0 spec/scss_lint/rake_task_spec.rb
scss-lint-0.36.1 spec/scss_lint/rake_task_spec.rb
scss-lint-0.36.0 spec/scss_lint/rake_task_spec.rb
scss-lint-0.35.0 spec/scss_lint/rake_task_spec.rb
scss-lint-0.34.0 spec/scss_lint/rake_task_spec.rb
scss-lint-0.33.0 spec/scss_lint/rake_task_spec.rb