Class: SmartTest::SpecRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_test/spec_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(root, options = {}) ⇒ SpecRunner

Returns a new instance of SpecRunner.



6
7
8
9
10
11
12
13
# File 'lib/smart_test/spec_runner.rb', line 6

def initialize(root, options={})
  @project = Project.new root
  @filter = Filter.new @project
  @options = {
    type: :mtime,
    param: 1
  }.merge! options
end

Instance Method Details

#cmdObject



23
24
25
# File 'lib/smart_test/spec_runner.rb', line 23

def cmd
  @cmd ||= "bundle exec rspec #{files.join(' ')}"
end

#filesObject



15
16
17
# File 'lib/smart_test/spec_runner.rb', line 15

def files
  @files ||= @filter.send @options[:type], @options[:param]
end

#runObject



19
20
21
# File 'lib/smart_test/spec_runner.rb', line 19

def run
  system cmd
end