Sha256: 49a6649f4ce595263f27ff7d15b6f2c53366a380616460d29736a0a81787f962

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

require "tilt"
require "konacha/engine"
require "konacha/runner"
require "konacha/server"
require "konacha/reporter"
require "konacha/formatter"

module Konacha
  class << self
    attr_accessor :mode

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

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

    def config
      Konacha::Engine.config.konacha
    end

    def configure
      yield config
    end

    delegate :port, :spec_dir, :spec_matcher, :application, :driver, :runner_port, :formatters, :to => :config

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

    def spec_paths
      Rails.application.assets.each_entry(spec_root).find_all { |pathname|
        config.spec_matcher === pathname.basename.to_s &&
        (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
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
konacha-3.2.5 lib/konacha.rb
konacha-3.2.4 lib/konacha.rb
konacha-3.2.3 lib/konacha.rb
konacha-3.2.2 lib/konacha.rb
konacha-3.2.1 lib/konacha.rb
konacha-3.2.0 lib/konacha.rb
konacha-3.1.0 lib/konacha.rb
konacha-3.0.0 lib/konacha.rb