jstdutil 0.3.10 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.3.11 / 2012-01-26
2
+ * Recognize camelized file names (i.e. some.js -> someTest.js)
3
+
1
4
  == 0.3.7 / 2011-05-17
2
5
  * Proper exit code from jstestdriver (Vladimir Dobriakov)
3
6
 
data/GPATH ADDED
Binary file
data/GRTAGS ADDED
Binary file
data/GSYMS ADDED
Binary file
data/GTAGS ADDED
Binary file
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.10
1
+ 0.3.11
@@ -16,7 +16,11 @@ module Jstdutil
16
16
  @test_files = [@file]
17
17
  else
18
18
  name = File.basename(@file).gsub(/([-_]test)|(test[-_])|(\.js)/, "")
19
- @test_files = FileList["**/#{name}_test.js", "**/test_#{name}.js", "**/#{name}-test.js", "**/test-#{name}.js"].uniq
19
+ @test_files = FileList["**/#{name}_test.js",
20
+ "**/test_#{name}.js",
21
+ "**/#{name}-test.js",
22
+ "**/test-#{name}.js",
23
+ "**/#{camelize(name)}Test.js"].uniq
20
24
  end
21
25
  end
22
26
 
@@ -29,5 +33,11 @@ module Jstdutil
29
33
 
30
34
  @cases.flatten!
31
35
  end
36
+
37
+ private
38
+ def camelize(str)
39
+ pieces = str.split(/[^a-z0-9]/i)
40
+ pieces.shift + pieces.map { |w| w.capitalize }.join
41
+ end
32
42
  end
33
43
  end
@@ -14,10 +14,21 @@ class TestFileTest < Test::Unit::TestCase
14
14
  should "find files like _test.js" do
15
15
  file = "some.js"
16
16
  test_file = Jstdutil::TestFile.new(file)
17
- FileList.expects(:new).with("**/some_test.js", "**/test_some.js", "**/some-test.js", "**/test-some.js").returns([])
17
+ FileList.expects(:new).with("**/some_test.js", "**/test_some.js",
18
+ "**/some-test.js", "**/test-some.js",
19
+ "**/someTest.js").returns([])
18
20
 
19
21
  assert test_file.test_files
20
22
  end
23
+
24
+ should "find camelized file names" do
25
+ file = "some_thing.js"
26
+ test_file = Jstdutil::TestFile.new(file)
27
+ FileList.expects(:new).with("**/some_thing_test.js", "**/test_some_thing.js",
28
+ "**/some_thing-test.js", "**/test-some_thing.js",
29
+ "**/someThingTest.js").returns([])
30
+ assert test_file.test_files
31
+ end
21
32
  end
22
33
 
23
34
  context "test cases" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jstdutil
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 10
10
- version: 0.3.10
9
+ - 11
10
+ version: 0.3.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christian Johansen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-10 00:00:00 +02:00
18
+ date: 2012-01-26 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -72,6 +72,10 @@ extra_rdoc_files:
72
72
  - README.rdoc
73
73
  files:
74
74
  - Changelog
75
+ - GPATH
76
+ - GRTAGS
77
+ - GSYMS
78
+ - GTAGS
75
79
  - LICENSE
76
80
  - README.rdoc
77
81
  - Rakefile
@@ -133,13 +137,5 @@ rubygems_version: 1.3.7
133
137
  signing_key:
134
138
  specification_version: 3
135
139
  summary: Thin wrapper over Google's JsTestDriver that adds colors and autotest
136
- test_files:
137
- - test/cli_test.rb
138
- - test/colorful_html_test.rb
139
- - test/formatter_test.rb
140
- - test/jstdutil_test.rb
141
- - test/jstestdriver_config_test.rb
142
- - test/jstestdriver_test.rb
143
- - test/redgreen_test.rb
144
- - test/test_file_test.rb
145
- - test/test_helper.rb
140
+ test_files: []
141
+