Sha256: adb3492fb32c781a56b764d3e6673710586df7efc11ab2540f12009cee3f9afd

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

require File.join(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__)))), 'spec_helper')
require File.join(File.dirname(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))), 'lib', 'reek', 'core', 'code_parser')

include Reek::Core

describe CodeParser, "with no method definitions" do
  it 'reports no problems for empty source code' do
    ''.should_not reek
  end
  it 'reports no problems for empty class' do
    '# clean class for testing purposes
class Fred; end'.should_not reek
  end
end

describe CodeParser, 'with a global method definition' do
  it 'reports no problems for simple method' do
    'def Outermost::fred() true; end'.should_not reek
  end
end

describe CodeParser, '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
    src.should_not reek
  end
end

describe CodeParser do
  it 'copes with a yield to an ivar' do
    'def options() ozz.on { |@list| @prompt = !@list } end'.should_not reek
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reek-1.2.7.3 spec/reek/core/code_parser_spec.rb
reek-1.2.7.2 spec/reek/core/code_parser_spec.rb
reek-1.2.7.1 spec/reek/core/code_parser_spec.rb
reek-1.2.7 spec/reek/core/code_parser_spec.rb