Sha256: e2551e5af00dbe1dcc1b43797b7c66c6634f9b86ecf993a53f145da2b64263b9

Contents?: true

Size: 634 Bytes

Versions: 3

Compression:

Stored size: 634 Bytes

Contents

module SandboxAssets
  class TestAsset
    class << self
      def find_tests(params)
        return all unless path = params[:path]
        all.find_all {|fn| fn.start_with? path }
      end

      def all
        config = Engine.config.sandbox_assets
        files = []
        config.tests_roots.each do |root|
          config.tests_patterns.each do |pattern|
            test_dir = Rails.root.join root
            files.concat Dir[test_dir.join pattern].sort.map { |fn|
              fn.sub(test_dir.to_s, '').sub(/(\.js|\.coffee).*/, '')[1..-1]
            }
          end
        end
        files
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails-sandbox-assets-0.0.3 lib/sandbox_assets/test_asset.rb
rails-sandbox-assets-0.0.2 lib/sandbox_assets/test_asset.rb
rails-sandbox-assets-0.0.1 lib/sandbox_assets/test_asset.rb