Class: RSpecRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/rspec/rspec_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir, ruby_filter, spec_filter) ⇒ RSpecRunner

Returns a new instance of RSpecRunner.



3
4
5
6
7
# File 'lib/tasks/rspec/rspec_runner.rb', line 3

def initialize(dir, ruby_filter, spec_filter)
  @dir = dir
  @ruby_filter = ruby_filter
  @spec_filter = spec_filter
end

Instance Method Details

#executeObject



13
14
15
# File 'lib/tasks/rspec/rspec_runner.rb', line 13

def execute
  return `spec . 2>&1`
end

#is_configured?(all_files) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/tasks/rspec/rspec_runner.rb', line 17

def is_configured?(all_files)
  return !(all_files.detect { |file| @spec_filter.filter(file) }).nil?
end

#nameObject



9
10
11
# File 'lib/tasks/rspec/rspec_runner.rb', line 9

def name
  return 'RSpec'
end

#should_run?(modified_files) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/tasks/rspec/rspec_runner.rb', line 21

def should_run?(modified_files)
  return !(modified_files.detect { |file| @ruby_filter.filter(file) }).nil?
end