Class: TestsController

Inherits:
ApplicationController show all
Defined in:
lib/rails/specter/application/app/controllers/tests_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
# File 'lib/rails/specter/application/app/controllers/tests_controller.rb', line 4

def index
  @directories = Specter::Engine.paths['test/javascript'].existent.map do |dir|
    Pathname.new(dir)
  end.select do |dir|
    test = Specter::Test.new(Pathname.new(dir))
    test.valid?
  end
end

#runObject



21
22
23
24
25
26
27
28
# File 'lib/rails/specter/application/app/controllers/tests_controller.rb', line 21

def run
  directory = Specter::Engine.paths['test/javascript'].existent.select do |dir|
    Pathname.new(dir).basename.to_s === params[:id]
  end.first

  @test = Specter::Test.new(Pathname.new(directory))

end

#showObject



13
14
15
16
17
18
19
# File 'lib/rails/specter/application/app/controllers/tests_controller.rb', line 13

def show
  directory = Specter::Engine.paths['test/javascript'].existent.select do |dir|
    Pathname.new(dir).basename.to_s === params[:id]
  end.first

  @test = Specter::Test.new(Pathname.new(directory))
end