Sha256: f0961a2ef5f0d6429f20988301ff4576dd3271ae8ee72f32f5765b0a96e0a0a9

Contents?: true

Size: 835 Bytes

Versions: 5

Compression:

Stored size: 835 Bytes

Contents

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

RSpec.describe Reek::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

RSpec.describe Reek::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

RSpec.describe Reek::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

5 entries across 5 versions & 1 rubygems

Version Path
reek-3.0.4 spec/reek/tree_walker_spec.rb
reek-3.0.3 spec/reek/tree_walker_spec.rb
reek-3.0.2 spec/reek/tree_walker_spec.rb
reek-3.0.1 spec/reek/tree_walker_spec.rb
reek-3.0.0 spec/reek/tree_walker_spec.rb