Sha256: 670bda58b766e5a271688f6fdc79a82e90e34f5ec263dd86211354c971082524

Contents?: true

Size: 806 Bytes

Versions: 3

Compression:

Stored size: 806 Bytes

Contents

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

describe Roodi::Checks::ControlCouplingCheck do

  before(:each) do
    @roodi = Roodi::Core::ParseTreeRunner.new(Roodi::Checks::ControlCouplingCheck.new)
  end

  describe '#evaluate' do

    it 'should reject methods with if checks using a parameter' do
      content = <<-END
        def write(quoted, foo)
          if quoted
            write_quoted(@value)
          else
            puts @value
          end
        end
      END
      @roodi.check_content(content)
      errors = @roodi.errors

      errors.should_not be_empty
      errors[0].info.should        == { :method => :write, :argument => :quoted }
      errors[0].filename.should    == 'dummy-file.rb'
      errors[0].line_number.should == 2
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
marcoow-roodi-1.3.2 spec/roodi/checks/control_coupling_check_spec.rb
marcoow-roodi-1.3.4 spec/roodi/checks/control_coupling_check_spec.rb
marcoow-roodi-1.3.5 spec/roodi/checks/control_coupling_check_spec.rb