Sha256: c34e638b0889933ade83616c14bde718f070bea972daea0704e8a03495be6050

Contents?: true

Size: 777 Bytes

Versions: 4

Compression:

Stored size: 777 Bytes

Contents

require 'spec_helper'
require '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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reek-1.3.8 spec/reek/core/code_parser_spec.rb
reek-1.3.7 spec/reek/core/code_parser_spec.rb
reek-1.3.6 spec/reek/core/code_parser_spec.rb
reek-1.3.5 spec/reek/core/code_parser_spec.rb