Sha256: 2f3d657a0b3a84709a4afcf0f98c2c8c60af6230ab35148577ea40308f371c09

Contents?: true

Size: 935 Bytes

Versions: 4

Compression:

Stored size: 935 Bytes

Contents

require File.expand_path('../spec_helper', __FILE__)
require_relative '../ext/swiftlint/swiftlint'

describe Swiftlint do
  it 'is_installed? works based on bin/swiftlint file' do
    expect(File).to receive(:exist?).with(/bin\/swiftlint/).and_return(true)
    expect(Swiftlint.is_installed?).to be_truthy

    expect(File).to receive(:exist?).with(/bin\/swiftlint/).and_return(false)
    expect(Swiftlint.is_installed?).to be_falsy
  end

  it 'runs lint by default with options being optional' do
    expect(Swiftlint).to receive(:`).with(including('swiftlint lint'))
    Swiftlint.run()
  end

  it 'runs accepting symbolized options' do
    cmd = 'swiftlint lint --no-use-stdin  --cache-path /path --enable-all-rules'
    expect(Swiftlint).to receive(:`).with(including(cmd))

    Swiftlint.run('lint',
                  use_stdin: false,
                  cache_path: '/path',
                  enable_all_rules: true)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
danger-swiftlint-0.5.1 spec/swiftlint_spec.rb
danger-swiftlint-0.5.0 spec/swiftlint_spec.rb
danger-swiftlint-0.4.1 spec/swiftlint_spec.rb
danger-swiftlint-0.4.0 spec/swiftlint_spec.rb