Sha256: c7c469ade7c24018a6bb866c9cc6613d47d056dbaaa0be3134f3f361bdf6e4b0

Contents?: true

Size: 1.54 KB

Versions: 17

Compression:

Stored size: 1.54 KB

Contents

require 'reek'

describe 'version number' do
  it 'should report the correct value' do
    actual = `ruby -Ilib bin/reek --version`.split
    $?.exitstatus.should == 0
    actual[0].should == 'reek'
    actual[1].should == Reek::VERSION
  end
end

describe 'exit status', 'when reek is used incorrectly' do
  it 'should return non-zero status on bad option' do
    `ruby -Ilib bin/reek --no-such-option`
    $?.exitstatus.should == 1
  end

  it 'should complain about missing file' do
    `ruby -Ilib bin/reek nosuchfile.rb`
    $?.exitstatus.should == 1
  end

  it 'should return non-zero status on missing argument' do
    `ruby -Ilib bin/reek -f 2>/dev/null`
    $?.exitstatus.should == 1
  end
end

describe 'exit status', 'when reek is used correctly' do
  it 'should return non-zero status when smells are reported' do
    `echo "def x() 3; end" | ruby -Ilib bin/reek`
    $?.exitstatus.should == 2
  end

  it 'should return zero status with no smells' do
    `echo "def simple() @fred = 3 end" | ruby -Ilib bin/reek`
    $?.exitstatus.should == 0
  end
end

describe 'report format', 'with one source' do
  it 'should output nothing with empty source' do
    `echo "" | ruby -Ilib bin/reek`.should be_empty
  end

  it 'should output nothing when no smells' do
    `echo "def simple() @fred = 3; end" | ruby -Ilib bin/reek`.should be_empty
  end

  it 'should not adorn the list of warnings' do
    report = `echo  "class Turn; def y() @x = 3; end end" | ruby -Ilib bin/reek`
    report.split(/\n/).length.should == 2
    report.should_not match(/\n\n/)
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
kevinrutherford-reek-0.3.1.4 spec/integration/script_spec.rb
kevinrutherford-reek-0.3.1.5 spec/integration/script_spec.rb
kevinrutherford-reek-0.3.1.6 spec/integration/script_spec.rb
kevinrutherford-reek-1.0.0 spec/integration/script_spec.rb
kevinrutherford-reek-1.0.1 spec/integration/script_spec.rb
kevinrutherford-reek-1.1.1 spec/slow/script_spec.rb
kevinrutherford-reek-1.1.2.1 spec/slow/script_spec.rb
kevinrutherford-reek-1.1.2 spec/slow/script_spec.rb
kevinrutherford-reek-1.1.3.1 spec/slow/script_spec.rb
kevinrutherford-reek-1.1.3.2 spec/slow/script_spec.rb
kevinrutherford-reek-1.1.3.3 spec/slow/script_spec.rb
kevinrutherford-reek-1.1.3.4 spec/slow/script_spec.rb
kevinrutherford-reek-1.1.3 spec/slow/script_spec.rb
teksymmetry-reek-1.1.3.1 spec/slow/script_spec.rb
teksymmetry-reek-1.1.3.2 spec/slow/script_spec.rb
reek-1.1.3 spec/slow/script_spec.rb
reek-1.0.0 spec/integration/script_spec.rb