Sha256: 88826495eea44f568f97cfc0e260becd895969de4c3288dfcb21a84d2ade9467

Contents?: true

Size: 1007 Bytes

Versions: 3

Compression:

Stored size: 1007 Bytes

Contents

require 'spec_helper'

describe AnalDiffist::ReekParser do
  context 'a smelly file' do
    before do
      smelly_file_parser = get_parser_for('smelly_file.rb')
      @problems = smelly_file_parser.problems
    end

    it 'has a duplication warning for the duplication method' do
      smells = get_smells_for('SmellyFile#duplication')
      smells[0].type.should == 'DuplicateMethodCall'
    end

    it 'should have some results' do
      @problems.length.should > 0
    end

    it 'creates a diff' do
      smelly_file_parser = get_parser_for('smelly_file.rb')
      other_smelly_file_parser = get_parser_for('other_smelly_file.rb')
      diff = smelly_file_parser.diff(other_smelly_file_parser)
      diff.should be
    end

    def get_smells_for context
      @problems.select {|reek| reek.context == context}
    end
  end

  def get_parser_for(fixture_file)
    file_name = File.join(File.dirname(__FILE__), '../../fixtures/', fixture_file)
    AnalDiffist::ReekParser.new([file_name])
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
analdiffist-0.4.0 spec/lib/analdiffist/reek_parser_spec.rb
analdiffist-0.3.0 spec/lib/analdiffist/reek_parser_spec.rb
analdiffist-0.2.0 spec/lib/analdiffist/reek_parser_spec.rb