Sha256: 20087b75d40bcb482626e7e3a961fa2043d72d43fa00ef7023758ebe1fdb1584

Contents?: true

Size: 1.21 KB

Versions: 15

Compression:

Stored size: 1.21 KB

Contents

require_relative '../../lib/reek/smells'
require_relative '../../lib/reek/smells/smell_detector'
require_relative '../../lib/reek/smells/smell_warning'
require_relative '../../lib/reek/cli/options'

FactoryGirl.define do
  factory :context, class: Reek::Context::CodeContext do
    skip_create

    initialize_with do
      new(nil, nil)
    end
  end

  factory :method_context, class: Reek::Context::MethodContext do
    skip_create
    transient do
      source 'def foo; end'
    end

    initialize_with do
      new(nil, Reek::Source::SourceCode.from(source).syntax_tree)
    end
  end

  factory :smell_detector, class: Reek::Smells::SmellDetector do
    skip_create
    transient do
      smell_type 'FeatureEnvy'
    end

    initialize_with do
      ::Reek::Smells.const_get(smell_type).new
    end
  end

  factory :smell_warning, class: Reek::Smells::SmellWarning do
    skip_create
    smell_detector
    context 'self'
    source 'dummy_file'
    lines [42]
    message 'smell warning message'
    parameters { {} }

    initialize_with do
      new(smell_detector,
          source: source,
          context: context,
          lines: lines,
          message: message,
          parameters: parameters)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
reek-4.4.1 spec/factories/factories.rb
reek-4.4.0 spec/factories/factories.rb
reek-4.3.0 spec/factories/factories.rb
reek-4.2.5 spec/factories/factories.rb
reek-4.2.4 spec/factories/factories.rb
reek-4.2.3 spec/factories/factories.rb
reek-4.2.2 spec/factories/factories.rb
reek-4.2.1 spec/factories/factories.rb
reek-4.2.0 spec/factories/factories.rb
reek-4.1.1 spec/factories/factories.rb
reek-4.1.0 spec/factories/factories.rb
reek-4.0.5 spec/factories/factories.rb
reek-4.0.4 spec/factories/factories.rb
reek-4.0.3 spec/factories/factories.rb
reek-4.0.2 spec/factories/factories.rb