test_rails_js 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,16 +9,13 @@ class JsTestsController < ActionController::Base
9
9
 
10
10
  private
11
11
  def tests
12
- @tests ||= Rails.application.config.assets.paths.inject([]){ |tests, path|
12
+ @tests ||= TestRailsJs.tests do |tests, path|
13
13
  asset_path = Pathname(path)
14
- tests + (
15
- Dir[path + "/*_tests.js"] +
16
- Dir[path + "/tests/**/*.js"]
17
- ).map{ |test|
14
+ tests.map do |test|
18
15
  { :asset => Pathname(test).relative_path_from(asset_path).sub_ext('').to_s,
19
16
  :path => Pathname(test).relative_path_from(Rails.root) }
20
- }
21
- }
17
+ end
18
+ end
22
19
  end
23
20
 
24
21
  def test
@@ -1,3 +1,3 @@
1
1
  module TestRailsJs
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/test_rails_js.rb CHANGED
@@ -1,4 +1,13 @@
1
1
  module TestRailsJs
2
+ def self.tests(&block)
3
+ Rails.application.config.assets.paths.inject([]) do |all_tests, path|
4
+ tests = Dir[path + "/*_tests.js"] + Dir[path + "/tests/**/*.js"]
5
+
6
+ tests = block.call(tests, path) if block_given?
7
+ all_tests + tests
8
+ end
9
+ end
10
+
2
11
  class Engine < Rails::Engine
3
12
  engine_name "test_rails_js"
4
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_rails_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-12 00:00:00.000000000 -05:00
12
+ date: 2011-09-13 00:00:00.000000000 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &84479880 !ruby/object:Gem::Requirement
17
+ requirement: &72237200 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *84479880
25
+ version_requirements: *72237200
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: sqlite3
28
- requirement: &84479650 !ruby/object:Gem::Requirement
28
+ requirement: &72236930 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *84479650
36
+ version_requirements: *72236930
37
37
  description: Test your rails JS in-browser.
38
38
  email:
39
39
  - Douglas.Meyer@Centro.net