Class: PolishGeeks::DevTools::Commands::Rspec

Inherits:
Base
  • Object
show all
Defined in:
lib/polish_geeks/dev_tools/commands/rspec.rb

Overview

Command wrapper for Rspec validation It informs us if our specs are working in a proper way

Constant Summary collapse

EXAMPLES_REGEXP =

Regexp used to match Rspec examples count

/(\d+) examples/
FAILURES_REGEXP =

Regexp used to match Rspec failures

/(\d+) failure/
PENDING_REGEXP =

Regexp used to match Rspec pendings

/(\d+) pending/

Constants inherited from Base

Base::TYPES

Instance Attribute Summary

Attributes inherited from Base

#output, #stored_output

Instance Method Summary collapse

Methods inherited from Base

#ensure_executable!, #error_message

Instance Method Details

#executeString

Executes this command

Returns:

  • (String)

    command output



18
19
20
# File 'lib/polish_geeks/dev_tools/commands/rspec.rb', line 18

def execute
  @output = Shell.new.execute('bundle exec rspec spec')
end

#labelString

Returns default label for this command.

Returns:

  • (String)

    default label for this command



28
29
30
# File 'lib/polish_geeks/dev_tools/commands/rspec.rb', line 28

def label
  "Rspec (#{examples_count} ex, #{failures_count} fa, #{pending_count} pe)"
end

#valid?Boolean

Returns true if there were no Rspec failures, false otherwise.

Returns:

  • (Boolean)

    true if there were no Rspec failures, false otherwise



23
24
25
# File 'lib/polish_geeks/dev_tools/commands/rspec.rb', line 23

def valid?
  failures_count.zero? && disallow_pending_valid?
end