Class: Kicker::Recipes::Rails

Inherits:
Base
  • Object
show all
Defined in:
lib/kicker/recipes/rails.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#files, #kicker

Instance Method Summary collapse

Methods inherited from Base

call, #initialize, #relative_path

Constructor Details

This class inherits a constructor from Kicker::Recipes::Base

Instance Attribute Details

#test_filesObject (readonly)

Returns the value of attribute test_files.



4
5
6
# File 'lib/kicker/recipes/rails.rb', line 4

def test_files
  @test_files
end

Instance Method Details

#after_initializeObject



6
7
8
# File 'lib/kicker/recipes/rails.rb', line 6

def after_initialize
  @test_files = []
end

#handle!Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/kicker/recipes/rails.rb', line 10

def handle!
  @files.delete_if do |full_path|
    path = relative_path(full_path)
    
    # Match any ruby test file and run it
    if path =~ /^test\/.+_test\.rb$/
      @test_files << path
    end
  end
  
  run_tests
end

#run_testsObject



23
24
25
# File 'lib/kicker/recipes/rails.rb', line 23

def run_tests
  @kicker.execute_command("ruby -r #{@test_files.join(' -r ')} -e ''")
end