Sha256: be732a384dc7e8750a8f2052b4ac027a0fa1358477b880d8d99de440515f948e

Contents?: true

Size: 793 Bytes

Versions: 4

Compression:

Stored size: 793 Bytes

Contents

require 'spec_helper'
require 'reek/core/tree_walker'

include Reek::Core

describe 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 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 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

4 entries across 4 versions & 1 rubygems

Version Path
reek-2.0.4 spec/reek/core/tree_walker_spec.rb
reek-2.0.3 spec/reek/core/tree_walker_spec.rb
reek-2.0.2 spec/reek/core/tree_walker_spec.rb
reek-2.0.1 spec/reek/core/tree_walker_spec.rb