Sha256: 729c548f61bab79adc33e6a82b43d18fce57f4ba9ad65cd1fb423a296d1d14bf

Contents?: true

Size: 680 Bytes

Versions: 5

Compression:

Stored size: 680 Bytes

Contents

class OpalSpecController < ActionController::Base
  helper_method :spec_files

  def run
  end


  private

  def spec_files
    @spec_files ||= some_spec_files || all_spec_files
  end

  def specs_param
    params[:pattern]
  end

  def some_spec_files
    return if specs_param.blank?
    specs_param.split(':').map { |path| spec_files_for_glob(path) }.flatten
  end

  def all_spec_files
    spec_files_for_glob '**'
  end

  def spec_files_for_glob glob = '**'
    Dir[Rails.root.join("{app,lib}/assets/javascripts/spec/#{glob}{,_spec{.js,}.{rb,opal}}")].map do |path|
      path.split('assets/javascripts/spec/').flatten.last.gsub(/(\.rb|\.opal)/, '')
    end.uniq
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opal-rails-0.6.2 app/controllers/opal_spec_controller.rb
opal-rails-0.6.1 app/controllers/opal_spec_controller.rb
opal-rails-0.6.0 app/controllers/opal_spec_controller.rb
opal-rails-0.5.2 app/controllers/opal_spec_controller.rb
opal-rails-0.5.1 app/controllers/opal_spec_controller.rb