Module: Konacha

Defined in:
lib/konacha.rb,
lib/konacha/engine.rb,
lib/konacha/runner.rb,
lib/konacha/server.rb,
app/models/konacha/spec.rb,
app/helpers/konacha/specs_helper.rb,
app/controllers/konacha/specs_controller.rb

Defined Under Namespace

Modules: SpecsHelper Classes: Engine, Error, Example, Runner, Server, Spec, SpecRunner, SpecsController

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.modeObject

Returns the value of attribute mode.



8
9
10
# File 'lib/konacha.rb', line 8

def mode
  @mode
end

Class Method Details

.configObject



22
23
24
# File 'lib/konacha.rb', line 22

def config
  Konacha::Engine.config.konacha
end

.configure {|config| ... } ⇒ Object

Yields:



26
27
28
# File 'lib/konacha.rb', line 26

def configure
  yield config
end

.runObject



17
18
19
20
# File 'lib/konacha.rb', line 17

def run
  self.mode = :runner
  Konacha::Runner.start
end

.serveObject



10
11
12
13
14
15
# File 'lib/konacha.rb', line 10

def serve
  puts "Your tests are here:"
  puts "  http://localhost:#{port}/"
  self.mode = :server
  Konacha::Server.start
end

.spec_pathsObject



36
37
38
39
40
41
42
43
44
# File 'lib/konacha.rb', line 36

def spec_paths
  Rails.application.assets.each_entry(spec_root).find_all { |pathname|
    pathname.basename.to_s =~ /_spec\.|_test\./ &&
    (pathname.extname == '.js' || Tilt[pathname]) &&
    Rails.application.assets.content_type_of(pathname) == 'application/javascript'
  }.map { |pathname|
    pathname.to_s.gsub(File.join(spec_root, ''), '')
  }.sort
end

.spec_rootObject



32
33
34
# File 'lib/konacha.rb', line 32

def spec_root
  File.join(Rails.root, config.spec_dir)
end