Sha256: bf349246e56a23d89ec6f44371ff16087191d484d917c3676c9fa5682d6d79e0

Contents?: true

Size: 846 Bytes

Versions: 1

Compression:

Stored size: 846 Bytes

Contents

require_relative '../../spec_helper'
require_relative '../../../lib/reek/core/tree_walker'

describe Reek::Core::TreeWalker, 'with no method definitions' do
  it 'reports no problems for empty source code' do
    expect('').not_to reek
  end
  it 'reports no problems for empty class' do
    expect('# clean class for testing purposes
class Fred; end').not_to reek
  end
end

describe Reek::Core::TreeWalker, 'with a global method definition' do
  it 'reports no problems for simple method' do
    src = 'def Outermost::fred() true; end'
    expect(src).not_to reek
  end
end

describe Reek::Core::TreeWalker, 'when a yield is the receiver' do
  it 'reports no problems' do
    src = <<EOS
def values(*args)
  @to_sql += case
    when block_given? then yield.to_sql
    else args.to_sql
  end
  self
end
EOS
    expect(src).not_to reek
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reek-2.1.0 spec/reek/core/tree_walker_spec.rb