Sha256: 6125cdb6e3b10d3ad644d2c0dc845861ed18a0aec64600dd89604aadb569fa52

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

Feature: Using Reek programmatically
  In order to use Reek from inside my program
  As a developer
  I want to be able to use its classes

  Scenario: Accessing smells found by an examiner
    Given a smelly file called 'smelly.rb'
    And a file named "examine.rb" with:
      """
      require 'reek'
      examiner = Reek::Examiner.new(File.new('smelly.rb'))
      examiner.smells.each do |smell|
        puts smell.message
      end
      """
    When I run `ruby examine.rb`
    Then it reports no errors
    And it reports:
      """
      calls @foo.bar 2 times
      calls puts(@foo.bar) 2 times
      has the name 'm'
      """

  Scenario: Using Reek's built-in report classes
    Given a smelly file called 'smelly.rb'
    And a file named "examine.rb" with:
      """
      require 'reek'
      examiner = Reek::Examiner.new(File.new('smelly.rb'))
      report = Reek::Report::TextReport.new
      report.add_examiner examiner
      report.show
      """
    When I run `ruby examine.rb`
    Then it reports no errors
    And it reports:
      """
      smelly.rb -- 3 warnings:
        Smelly#m calls @foo.bar 2 times (DuplicateMethodCall)
        Smelly#m calls puts(@foo.bar) 2 times (DuplicateMethodCall)
        Smelly#m has the name 'm' (UncommunicativeMethodName)
      """

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reek-3.6.1 features/programmatic_access.feature
reek-3.6.0 features/programmatic_access.feature