jaspec 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -1
- data/Rakefile +2 -7
- data/jaspec.gemspec +1 -1
- data/lib/jaspec/runner.rb +8 -4
- data/lib/jaspec/runner/phantom.js +6 -3
- data/lib/jaspec/tasks.rb +16 -0
- data/lib/jaspec/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8181ad3162eea211696b34d6c0762dace66e14cc
|
4
|
+
data.tar.gz: 54f34de2c216035da2bf435d92ea192329c8a3b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb1c8a11a3dc5cd82c641f5a87eb80362a891d9dc242872a0b0e9cae1e62b11a0e9baa79b6c0ef564fb5bd8e60276d36e8a4552117a97eed6ffc80b4f60d3a0a
|
7
|
+
data.tar.gz: f8c0925b7261137acefa7a4be1919fa0ef9a720765fb7d47e8f26795bf4db7fcc1e5dddde91fff27c46b8e2bc35edd4ae13f28fe2e5c77b1921ea51dc657c77b
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Jaspec
|
1
|
+
# Jaspec [![Build Status](https://travis-ci.org/gisikw/jaspec.svg?branch=master)](https://travis-ci.org/gisikw/jaspec) [![Gem Version](https://badge.fury.io/rb/jaspec.png)](http://badge.fury.io/rb/jaspec)
|
2
2
|
|
3
3
|
Jaspec is a dirt-simple Jasmine spec runner. It runs off of [Jasmine](http://jasmine.github.io/) standalone, [RequireJS](http://requirejs.org/), and [PhantomJS](http://phantomjs.org/). It doesn't care about sprockets; it doesn't start a web server; it does something really really simple:
|
4
4
|
|
@@ -34,6 +34,20 @@ Finally, if you want to run across an entire directory:
|
|
34
34
|
|
35
35
|
This will execute against all \*Spec.js, and \*Spec.coffee files within that directory.
|
36
36
|
|
37
|
+
## Add Jaspec to your Rakefile
|
38
|
+
|
39
|
+
Jaspec is unopinionated as to where you keep your specs. To add a Rake task, put the following in your Rakefile:
|
40
|
+
|
41
|
+
```rake
|
42
|
+
require 'jaspec/tasks'
|
43
|
+
|
44
|
+
Jaspec::Tasks.new('spec/javascripts') # select your own spec directory to taste.
|
45
|
+
```
|
46
|
+
|
47
|
+
Now, you can run the following to invoke Jaspec on your specs:
|
48
|
+
|
49
|
+
$ rake spec:jaspec
|
50
|
+
|
37
51
|
## Writing Your Specs
|
38
52
|
|
39
53
|
You can format your specs normally:
|
data/Rakefile
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/lib")
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
-
require "jaspec"
|
4
|
+
require "jaspec/tasks"
|
5
5
|
|
6
|
-
|
7
|
-
desc "Run all the jaspect tests"
|
8
|
-
task :jaspec do
|
9
|
-
Jaspec::Runner.run_all(File.join(File.dirname(__FILE__),'spec','javascripts')) || exit(1)
|
10
|
-
end
|
11
|
-
end
|
6
|
+
Jaspec::Tasks.new('spec/javascripts')
|
12
7
|
|
13
8
|
task :default => 'spec:jaspec'
|
data/jaspec.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Kevin Gisi"]
|
10
10
|
spec.email = ["kevin@kevingisi.com"]
|
11
11
|
spec.summary = %q{A stupid simple Jasmine spec-runner for AMD modules}
|
12
|
-
spec.homepage = ""
|
12
|
+
spec.homepage = "https://github.com/gisikw/jaspec"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0")
|
data/lib/jaspec/runner.rb
CHANGED
@@ -6,17 +6,21 @@ module Jaspec
|
|
6
6
|
class << self
|
7
7
|
|
8
8
|
def run(spec)
|
9
|
-
if File.directory?(spec)
|
9
|
+
if spec.kind_of?(Array) || File.directory?(spec)
|
10
10
|
run_all(spec)
|
11
11
|
else
|
12
12
|
system("phantomjs #{PHANTOM_RUNNER} #{HTML_RUNNER} #{spec}")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def run_all(
|
16
|
+
def run_all(specs)
|
17
17
|
failures = []
|
18
18
|
|
19
|
-
|
19
|
+
unless specs.kind_of?(Array)
|
20
|
+
specs = Dir.glob(File.join(specs,'**','*Spec.{js,coffee}'))
|
21
|
+
end
|
22
|
+
|
23
|
+
specs.each do |spec|
|
20
24
|
failures << spec if !run(spec)
|
21
25
|
end
|
22
26
|
|
@@ -25,7 +29,7 @@ module Jaspec
|
|
25
29
|
return true
|
26
30
|
else
|
27
31
|
puts "\n#{failures.length} failing spec file#{'s' if failures.length > 1}:"
|
28
|
-
puts failures.join("\n")
|
32
|
+
puts failures.map{|f|"\033[31m- #{f}\033[0m"}.join("\n")
|
29
33
|
return false
|
30
34
|
end
|
31
35
|
end
|
@@ -41,11 +41,14 @@ report = function () {
|
|
41
41
|
}
|
42
42
|
specs.forEach(function (spec) {
|
43
43
|
if (spec.status === 'passed') {
|
44
|
-
console.log(green('
|
44
|
+
console.log(green('* ' + spec.fullName));
|
45
45
|
} else if (spec.status === 'pending') {
|
46
|
-
console.log(yellow('
|
46
|
+
console.log(yellow('* ' + spec.fullName));
|
47
47
|
} else {
|
48
|
-
console.log(red('
|
48
|
+
console.log(red('* ' + spec.fullName));
|
49
|
+
spec.failedExpectations.forEach(function (expect) {
|
50
|
+
console.log(red(' - ' + expect.message));
|
51
|
+
})
|
49
52
|
}
|
50
53
|
});
|
51
54
|
page.close();
|
data/lib/jaspec/tasks.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'jaspec'
|
2
|
+
|
3
|
+
module Jaspec
|
4
|
+
class Tasks
|
5
|
+
include Rake::DSL
|
6
|
+
|
7
|
+
def initialize(spec_dir)
|
8
|
+
namespace :spec do
|
9
|
+
desc 'Execute all Jaspec specs'
|
10
|
+
task :jaspec do
|
11
|
+
Jaspec::Runner.run_all(File.join(Dir.pwd, spec_dir)) || exit(1)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/jaspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jaspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gisi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/jaspec/runner.rb
|
74
74
|
- lib/jaspec/runner/phantom.js
|
75
75
|
- lib/jaspec/runner/runner.html
|
76
|
+
- lib/jaspec/tasks.rb
|
76
77
|
- lib/jaspec/version.rb
|
77
78
|
- spec/javascripts/barSpec.coffee
|
78
79
|
- spec/javascripts/fooSpec.js
|
@@ -98,7 +99,7 @@ files:
|
|
98
99
|
- vendor/jasmine-2.1.3/src/Player.js
|
99
100
|
- vendor/jasmine-2.1.3/src/Song.js
|
100
101
|
- vendor/requirejs-2.1.15.min.js
|
101
|
-
homepage:
|
102
|
+
homepage: https://github.com/gisikw/jaspec
|
102
103
|
licenses:
|
103
104
|
- MIT
|
104
105
|
metadata: {}
|