Sha256: 9d58ede3b96e36f15ce6f149490481e9d6845ecb388f79009cb8b9b5b0816e8b

Contents?: true

Size: 942 Bytes

Versions: 8

Compression:

Stored size: 942 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper.rb'

require 'reek/code_parser'

include Reek

describe CodeParser, "with no method definitions" do
  it 'should report no problems for empty source code' do
    ''.should_not reek
  end
  it 'should report no problems for empty class' do
    'class Fred; end'.should_not reek
  end
end

describe CodeParser, 'with a global method definition' do
  it 'should report 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 'should report no problems' do
    source = 'def values(*args)
  @to_sql += case
    when block_given? then " #{yield.to_sql}"
    else " values (#{args.to_sql})"
  end
  self
end'
    source.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 & 2 rubygems

Version Path
kevinrutherford-reek-1.1.3.11 spec/reek/code_parser_spec.rb
kevinrutherford-reek-1.1.3.12 spec/reek/code_parser_spec.rb
kevinrutherford-reek-1.1.3.13 spec/reek/code_parser_spec.rb
kevinrutherford-reek-1.1.3.14 spec/reek/code_parser_spec.rb
kevinrutherford-reek-1.1.3.15 spec/reek/code_parser_spec.rb
kevinrutherford-reek-1.1.3.16 spec/reek/code_parser_spec.rb
kevinrutherford-reek-1.2.0 spec/reek/code_parser_spec.rb
reek-1.2.0 spec/reek/code_parser_spec.rb