Sha256: 02ba609b306720ec94eed2b096bb4084dd24c058effb284b4a7e343d3f549dc3

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 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
    src = 'def Outermost::fred() true; end'
    src.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

8 entries across 8 versions & 1 rubygems

Version Path
reek-1.3.1 spec/reek/core/code_parser_spec.rb
reek-1.3 spec/reek/core/code_parser_spec.rb
reek-1.2.13 spec/reek/core/code_parser_spec.rb
reek-1.2.12 spec/reek/core/code_parser_spec.rb
reek-1.2.11 spec/reek/core/code_parser_spec.rb
reek-1.2.10 spec/reek/core/code_parser_spec.rb
reek-1.2.9 spec/reek/core/code_parser_spec.rb
reek-1.2.8 spec/reek/core/code_parser_spec.rb