Class: Cerberus::Builder::RSpec

Inherits:
RubyBase
  • Object
show all
Defined in:
lib/cerberus/builder/rspec.rb

Instance Attribute Summary

Attributes inherited from RubyBase

#output

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ RSpec

Returns a new instance of RSpec.



4
5
6
# File 'lib/cerberus/builder/rspec.rb', line 4

def initialize(config)
  super(config, "rspec", "spec")
end

Instance Method Details

#brokenessObject



17
18
19
20
21
# File 'lib/cerberus/builder/rspec.rb', line 17

def brokeness
  if @output =~ /\d+ examples, (\d+) failures?/
    $1.to_i
  end
end

#runObject



8
9
10
11
12
13
14
15
# File 'lib/cerberus/builder/rspec.rb', line 8

def run
  @output = if @config[:builder, @name.to_sym, :task]
    `#{@config[:bin_path]}rake #{@config[:builder, @name.to_sym, :task]} 2>&1`
  else
    `#{@config[:bin_path]}rake #{choose_exec()} 2>&1`
  end
  successful?
end

#successful?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/cerberus/builder/rspec.rb', line 23

def successful?
  $?.exitstatus == 0 and not @output.include?("#{@cmd} aborted!") and @output.include?("0 failures")
end