evergreen 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +13 -5
- data/lib/evergreen.rb +46 -33
- data/lib/evergreen/resources/evergreen.css +62 -0
- data/lib/evergreen/{evergreen.js → resources/evergreen.js} +17 -2
- data/lib/evergreen/runner.rb +2 -5
- data/lib/evergreen/spec.rb +4 -8
- data/lib/evergreen/template.rb +31 -0
- data/lib/evergreen/version.rb +1 -1
- data/lib/evergreen/views/layout.erb +18 -0
- data/lib/evergreen/views/list.erb +9 -67
- data/lib/evergreen/views/spec.erb +28 -70
- data/spec/meta_spec.rb +21 -12
- data/spec/runner_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -3
- data/spec/spec_spec.rb +1 -11
- data/spec/{fixtures → suite1}/public/jquery.js +0 -0
- data/spec/suite1/public/styles.css +3 -0
- data/spec/{fixtures → suite1}/spec/javascripts/bar_spec.js +0 -0
- data/spec/{fixtures → suite1}/spec/javascripts/coffeescript_spec.coffee +0 -0
- data/spec/{fixtures → suite1}/spec/javascripts/failing_spec.js +0 -0
- data/spec/{fixtures → suite1}/spec/javascripts/foo_spec.js +0 -0
- data/spec/suite1/spec/javascripts/slow_spec.coffee +8 -0
- data/spec/{fixtures → suite1}/spec/javascripts/spec_helper.coffee +0 -0
- data/spec/{fixtures → suite1}/spec/javascripts/spec_helper.js +0 -0
- data/spec/suite1/spec/javascripts/templates/another_template.html +1 -0
- data/spec/{fixtures/spec/javascripts/templates_spec.html → suite1/spec/javascripts/templates/one_template.html} +0 -0
- data/spec/suite1/spec/javascripts/templates_spec.js +47 -0
- data/spec/{fixtures → suite1}/spec/javascripts/testing_spec.js +0 -0
- data/spec/{fixtures → suite1}/spec/javascripts/transactions_spec.js +0 -0
- data/spec/{fixtures → suite1}/spec/javascripts/with_helper_spec.js +0 -0
- data/spec/template_spec.rb +28 -0
- metadata +33 -42
- data/spec/fixtures/spec/javascripts/templates_spec.js +0 -23
data/README.rdoc
CHANGED
@@ -33,7 +33,7 @@ You can require files from the public directory inside your spec file:
|
|
33
33
|
|
34
34
|
You can now look at your spec files inside a browser by starting up the Evergreen server:
|
35
35
|
|
36
|
-
evergreen
|
36
|
+
evergreen serve
|
37
37
|
|
38
38
|
Alternatively you can run the specs headlessly by running:
|
39
39
|
|
@@ -69,12 +69,20 @@ One problem often faced when writing unit tests for client side code is that cha
|
|
69
69
|
|
70
70
|
== Templates
|
71
71
|
|
72
|
-
Even more powerful than that, Evergreen allows you to create HTML templates to go along with your specs.
|
72
|
+
Even more powerful than that, Evergreen allows you to create HTML templates to go along with your specs. Put the templates in their own folder like this:
|
73
73
|
|
74
|
-
spec/javascripts/
|
75
|
-
spec/javascripts/
|
74
|
+
spec/javascripts/templates/one_template.html
|
75
|
+
spec/javascripts/templates/another_template.html
|
76
|
+
|
77
|
+
You can then load the template into the test div, by calling the template function in your specs:
|
78
|
+
|
79
|
+
describe('transactions', function() {
|
80
|
+
template('one_template.html')
|
76
81
|
|
77
|
-
|
82
|
+
it("should load the template in this test", function() {
|
83
|
+
...
|
84
|
+
});
|
85
|
+
});
|
78
86
|
|
79
87
|
== Spec Helper
|
80
88
|
|
data/lib/evergreen.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'sinatra/base'
|
3
3
|
require 'capybara'
|
4
|
-
require 'capybara/envjs'
|
5
4
|
require 'capybara/wait_until'
|
6
5
|
require 'launchy'
|
7
6
|
require 'evergreen/version'
|
@@ -12,45 +11,59 @@ module Evergreen
|
|
12
11
|
autoload :Server, 'evergreen/server'
|
13
12
|
autoload :Runner, 'evergreen/runner'
|
14
13
|
autoload :Spec, 'evergreen/spec'
|
14
|
+
autoload :Template, 'evergreen/template'
|
15
15
|
|
16
16
|
class << self
|
17
|
-
def application(root)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
set :public, File.expand_path(File.join(root, 'public'), File.dirname(__FILE__))
|
24
|
-
|
25
|
-
use Rack::Static, :urls => ["/lib"], :root => File.expand_path('jasmine', File.dirname(__FILE__))
|
26
|
-
use Rack::Static, :urls => ["/evergreen"], :root => File.dirname(__FILE__)
|
27
|
-
|
28
|
-
helpers do
|
29
|
-
def url(path)
|
30
|
-
request.env['SCRIPT_NAME'].to_s + path.to_s
|
31
|
-
end
|
32
|
-
end
|
17
|
+
def application(root, driver=:serve)
|
18
|
+
Rack::Builder.new do
|
19
|
+
map "/jasmine" do
|
20
|
+
use Rack::Static, :urls => ["/"], :root => File.expand_path('jasmine/lib', File.dirname(__FILE__))
|
21
|
+
run lambda { |env| [404, {}, "No such file"]}
|
22
|
+
end
|
33
23
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
24
|
+
map "/resources" do
|
25
|
+
use Rack::Static, :urls => ["/"], :root => File.expand_path('evergreen/resources', File.dirname(__FILE__))
|
26
|
+
run lambda { |env| [404, {}, "No such file"]}
|
27
|
+
end
|
38
28
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
29
|
+
map "/" do
|
30
|
+
app = Class.new(Sinatra::Base).tap do |app|
|
31
|
+
app.reset!
|
32
|
+
app.class_eval do
|
33
|
+
set :static, true
|
34
|
+
set :root, File.expand_path('evergreen', File.dirname(__FILE__))
|
35
|
+
set :public, File.expand_path(File.join(root, 'public'), File.dirname(__FILE__))
|
43
36
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
37
|
+
helpers do
|
38
|
+
def url(path)
|
39
|
+
request.env['SCRIPT_NAME'].to_s + path.to_s
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
get '/' do
|
44
|
+
@specs = Spec.all(root)
|
45
|
+
erb :list
|
46
|
+
end
|
47
|
+
|
48
|
+
get '/list' do
|
49
|
+
@specs = Spec.all(root)
|
50
|
+
erb :list
|
51
|
+
end
|
50
52
|
|
51
|
-
|
52
|
-
|
53
|
+
get '/run/*' do |name|
|
54
|
+
@spec = Spec.new(root, name)
|
55
|
+
@js_spec_helper = Spec.new(root, 'spec_helper.js')
|
56
|
+
@coffee_spec_helper = Spec.new(root, 'spec_helper.coffee')
|
57
|
+
@driver = driver
|
58
|
+
erb :spec
|
59
|
+
end
|
60
|
+
|
61
|
+
get '/spec/*' do |name|
|
62
|
+
Spec.new(root, name).read
|
63
|
+
end
|
64
|
+
end
|
53
65
|
end
|
66
|
+
run app
|
54
67
|
end
|
55
68
|
end
|
56
69
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
body {
|
2
|
+
font-family: 'Lucida grande', 'sans-serif';
|
3
|
+
background: #f0f0f0;
|
4
|
+
}
|
5
|
+
|
6
|
+
a {
|
7
|
+
color: #00A500;
|
8
|
+
}
|
9
|
+
|
10
|
+
#page, #test, .jasmine_reporter {
|
11
|
+
width: 800px;
|
12
|
+
background: white;
|
13
|
+
-moz-border-radius: 3px;
|
14
|
+
padding: 20px;
|
15
|
+
margin: 50px auto 30px;
|
16
|
+
border: 1px solid #ddd
|
17
|
+
}
|
18
|
+
|
19
|
+
#test {
|
20
|
+
min-height: 50px;
|
21
|
+
margin: 30px auto 30px;
|
22
|
+
}
|
23
|
+
|
24
|
+
.jasmine_reporter {
|
25
|
+
margin: 30px auto 30px;
|
26
|
+
}
|
27
|
+
|
28
|
+
#page h1 {
|
29
|
+
font-size: 24px;
|
30
|
+
margin: 0 0 15px;
|
31
|
+
}
|
32
|
+
|
33
|
+
#page a.back {
|
34
|
+
font-size: 12px;
|
35
|
+
}
|
36
|
+
|
37
|
+
#page ul {
|
38
|
+
margin: 0;
|
39
|
+
padding: 0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#page ul li {
|
43
|
+
list-style: none;
|
44
|
+
border: 1px solid #ddd;
|
45
|
+
-moz-border-radius: 3px;
|
46
|
+
margin: 10px 0;
|
47
|
+
background: #f5f5f5;
|
48
|
+
}
|
49
|
+
|
50
|
+
#page ul li a {
|
51
|
+
padding: 7px 10px;
|
52
|
+
display: block;
|
53
|
+
text-decoration: none;
|
54
|
+
}
|
55
|
+
|
56
|
+
#footer {
|
57
|
+
margin: 0 auto 30px;
|
58
|
+
width: 600px;
|
59
|
+
text-align: center;
|
60
|
+
font-size: 13px;
|
61
|
+
color: #aaa;
|
62
|
+
}
|
@@ -16,20 +16,35 @@ Evergreen.ReflectiveReporter = function() {
|
|
16
16
|
trace: item.trace
|
17
17
|
});
|
18
18
|
};
|
19
|
+
this.reportRunnerResults = function(runner) {
|
20
|
+
Evergreen.done = true;
|
21
|
+
};
|
19
22
|
};
|
23
|
+
|
24
|
+
Evergreen.templates = {};
|
25
|
+
|
20
26
|
Evergreen.getResults = function() {
|
21
27
|
return JSON.stringify(Evergreen.results);
|
22
28
|
};
|
23
29
|
|
24
30
|
beforeEach(function() {
|
25
|
-
|
26
|
-
test.innerHTML = Evergreen.template;
|
31
|
+
document.getElementById('test').innerHTML = "";
|
27
32
|
});
|
28
33
|
|
34
|
+
var template = function(name) {
|
35
|
+
beforeEach(function() {
|
36
|
+
document.getElementById('test').innerHTML = Evergreen.templates[name]
|
37
|
+
});
|
38
|
+
};
|
39
|
+
|
29
40
|
var require = function(file) {
|
30
41
|
document.write('<script type="text/javascript" src="' + file + '"></script>');
|
31
42
|
};
|
32
43
|
|
44
|
+
var stylesheet = function(file) {
|
45
|
+
document.write('<link rel="stylesheet" type="text/css" href="' + file + '"/>');
|
46
|
+
};
|
47
|
+
|
33
48
|
// === JSON ===
|
34
49
|
|
35
50
|
(function(){function f(n){return n<10?'0'+n:n;}
|
data/lib/evergreen/runner.rb
CHANGED
@@ -49,15 +49,12 @@ module Evergreen
|
|
49
49
|
|
50
50
|
def results
|
51
51
|
@results ||= begin
|
52
|
-
session = Capybara::Session.new(:
|
52
|
+
session = Capybara::Session.new(:selenium, Evergreen.application(spec.root, :selenium))
|
53
53
|
session.visit(spec.url)
|
54
|
+
session.wait_until(180) { session.evaluate_script('Evergreen.done') }
|
54
55
|
JSON.parse(session.evaluate_script('Evergreen.getResults()'))
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
58
59
|
end
|
59
60
|
end
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
data/lib/evergreen/spec.rb
CHANGED
@@ -18,14 +18,6 @@ module Evergreen
|
|
18
18
|
File.join(root, 'spec/javascripts', name)
|
19
19
|
end
|
20
20
|
|
21
|
-
def template_path
|
22
|
-
full_path.sub(/\..+$/, '.html')
|
23
|
-
end
|
24
|
-
|
25
|
-
def template
|
26
|
-
if File.exist?(template_path) then File.read(template_path) else "" end
|
27
|
-
end
|
28
|
-
|
29
21
|
def read
|
30
22
|
if full_path =~ /\.coffee$/
|
31
23
|
%x(coffee -p #{full_path})
|
@@ -43,5 +35,9 @@ module Evergreen
|
|
43
35
|
File.exist?(full_path)
|
44
36
|
end
|
45
37
|
|
38
|
+
def templates
|
39
|
+
Evergreen::Template.all(root)
|
40
|
+
end
|
41
|
+
|
46
42
|
end
|
47
43
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Evergreen
|
2
|
+
class Template
|
3
|
+
|
4
|
+
def self.all(root)
|
5
|
+
Dir.glob(File.join(root, 'spec/javascripts/templates', '*')).map do |path|
|
6
|
+
new(root, File.basename(path))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_reader :name, :root
|
11
|
+
|
12
|
+
def initialize(root, name)
|
13
|
+
@root = root
|
14
|
+
@name = name
|
15
|
+
end
|
16
|
+
|
17
|
+
def full_path
|
18
|
+
File.join(root, 'spec/javascripts/templates', name)
|
19
|
+
end
|
20
|
+
|
21
|
+
def read
|
22
|
+
File.read(full_path)
|
23
|
+
end
|
24
|
+
alias_method :contents, :read
|
25
|
+
|
26
|
+
def exist?
|
27
|
+
File.exist?(full_path)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
data/lib/evergreen/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>Evergreen</title>
|
6
|
+
<link rel="stylesheet" type="text/css" href="<%= url('/jasmine/jasmine.css') %>"/>
|
7
|
+
<link rel="stylesheet" type="text/css" href="<%= url('/resources/evergreen.css') %>"/>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<%= yield %>
|
11
|
+
|
12
|
+
<div id="footer">
|
13
|
+
Powered by <a href="http://github.com/jnicklas/evergreen">Evergreen</a>.
|
14
|
+
Evergreen is sponsored by <a href="http://elabs.se">Elabs</a>.
|
15
|
+
</div>
|
16
|
+
</body>
|
17
|
+
</html>
|
18
|
+
|
@@ -1,67 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
background: #f0f0f0;
|
11
|
-
}
|
12
|
-
a {
|
13
|
-
color: #00A500;
|
14
|
-
}
|
15
|
-
|
16
|
-
#page {
|
17
|
-
width: 800px;
|
18
|
-
background: white;
|
19
|
-
-moz-border-radius: 3px;
|
20
|
-
padding: 20px;
|
21
|
-
margin: 50px auto 30px;
|
22
|
-
border: 1px solid #ddd
|
23
|
-
}
|
24
|
-
|
25
|
-
#page h1 {
|
26
|
-
margin: 0 0 30px;
|
27
|
-
}
|
28
|
-
|
29
|
-
#page ul li {
|
30
|
-
list-style: none;
|
31
|
-
border: 1px solid #ddd;
|
32
|
-
-moz-border-radius: 3px;
|
33
|
-
margin: 10px 0;
|
34
|
-
background: #f5f5f5;
|
35
|
-
}
|
36
|
-
|
37
|
-
#page ul li a {
|
38
|
-
padding: 7px 10px;
|
39
|
-
display: block;
|
40
|
-
text-decoration: none;
|
41
|
-
}
|
42
|
-
|
43
|
-
#footer {
|
44
|
-
margin: 0 auto 30px;
|
45
|
-
width: 600px;
|
46
|
-
text-align: center;
|
47
|
-
font-size: 13px;
|
48
|
-
color: #aaa;
|
49
|
-
}
|
50
|
-
</style>
|
51
|
-
</head>
|
52
|
-
<body>
|
53
|
-
<div id="page">
|
54
|
-
<h1>Evergreen</h1>
|
55
|
-
|
56
|
-
<ul id="specs">
|
57
|
-
<% @specs.each do |spec| %>
|
58
|
-
<li><a href="<%= url(spec.url) %>"><%= spec.name %></a></li>
|
59
|
-
<% end %>
|
60
|
-
</ul>
|
61
|
-
</div>
|
62
|
-
<div id="footer">
|
63
|
-
Powered by <a href="http://github.com/jnicklas/evergreen">Evergreen</a>.
|
64
|
-
Evergreen is sponsored by <a href="http://elabs.se">Elabs</a>.
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
1
|
+
<div id="page">
|
2
|
+
<h1>Evergreen</h1>
|
3
|
+
|
4
|
+
<ul id="specs">
|
5
|
+
<% @specs.each do |spec| %>
|
6
|
+
<li><a href="<%= url(spec.url) %>"><%= spec.name %></a></li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
9
|
+
</div>
|
@@ -1,72 +1,30 @@
|
|
1
|
-
|
1
|
+
<script type="text/javascript" src="<%= url("/jasmine/jasmine.js") %>"></script>
|
2
|
+
<script type="text/javascript" src="<%= url("/jasmine/jasmine-html.js") %>"></script>
|
3
|
+
<script type="text/javascript" src="<%= url("/resources/evergreen.js") %>"></script>
|
4
|
+
<% if @js_spec_helper.exist? %>
|
5
|
+
<script type="text/javascript" src="<%= url("/spec/#{@js_spec_helper.name}") %>"></script>
|
6
|
+
<% end %>
|
7
|
+
<% if @coffee_spec_helper.exist? %>
|
8
|
+
<script type="text/javascript" src="<%= url("/spec/#{@coffee_spec_helper.name}") %>"></script>
|
9
|
+
<% end %>
|
10
|
+
<script type="text/javascript" src="<%= url("/spec/#{@spec.name}") %>"></script>
|
2
11
|
|
3
|
-
<
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
<script type="text/javascript" src="<%= url("/lib/jasmine-html.js") %>"></script>
|
8
|
-
<script type="text/javascript" src="<%= url("/evergreen/evergreen.js") %>"></script>
|
9
|
-
<script type="text/javascript" src="<%= url("/spec/#{@spec.name}") %>"></script>
|
10
|
-
<% if @js_spec_helper.exist? %>
|
11
|
-
<script type="text/javascript" src="<%= url("/spec/#{@js_spec_helper.name}") %>"></script>
|
12
|
-
<% end %>
|
13
|
-
<% if @coffee_spec_helper.exist? %>
|
14
|
-
<script type="text/javascript" src="<%= url("/spec/#{@coffee_spec_helper.name}") %>"></script>
|
15
|
-
<% end %>
|
16
|
-
<style>
|
17
|
-
body {
|
18
|
-
font-family: 'Lucida grande', 'sans-serif';
|
19
|
-
background: #f0f0f0;
|
20
|
-
margin: 0;
|
21
|
-
padding: 0;
|
22
|
-
}
|
23
|
-
a {
|
24
|
-
color: #00A500;
|
25
|
-
}
|
12
|
+
<div id="page">
|
13
|
+
<h1>Evergreen</h1>
|
14
|
+
<a class="back" href="<%= url("/list") %>">Back to list</a>
|
15
|
+
</div>
|
26
16
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
padding: 20px;
|
42
|
-
min-height: 50px;
|
43
|
-
margin: 50px auto 30px;
|
44
|
-
border: 1px solid #ddd
|
45
|
-
}
|
46
|
-
#footer {
|
47
|
-
margin: 0 auto 30px;
|
48
|
-
width: 600px;
|
49
|
-
text-align: center;
|
50
|
-
font-size: 13px;
|
51
|
-
color: #aaa;
|
52
|
-
}
|
53
|
-
</style>
|
54
|
-
</head>
|
55
|
-
<body>
|
56
|
-
<div id="test">
|
57
|
-
</div>
|
58
|
-
<script type="text/javascript">
|
59
|
-
(function() {
|
60
|
-
Evergreen.template = <%= @spec.template.to_json %>;
|
61
|
-
var jasmineEnv = jasmine.getEnv();
|
62
|
-
jasmineEnv.addReporter(new jasmine.TrivialReporter());
|
63
|
-
jasmineEnv.addReporter(new Evergreen.ReflectiveReporter());
|
64
|
-
jasmineEnv.execute();
|
65
|
-
})();
|
66
|
-
</script>
|
67
|
-
<div id="footer">
|
68
|
-
Powered by <a href="http://github.com/jnicklas/evergreen">Evergreen</a>.
|
69
|
-
Evergreen is sponsored by <a href="http://elabs.se">Elabs</a>.
|
70
|
-
</div>
|
71
|
-
</body>
|
72
|
-
</html>
|
17
|
+
<div id="test"></div>
|
18
|
+
|
19
|
+
<script type="text/javascript">
|
20
|
+
(function() {
|
21
|
+
Evergreen.driver = <%= @driver.to_json %>;
|
22
|
+
<% @spec.templates.each do |template| %>
|
23
|
+
Evergreen.templates[<%= template.name.to_json %>] = <%= template.read.to_json %>;
|
24
|
+
<% end %>
|
25
|
+
var jasmineEnv = jasmine.getEnv();
|
26
|
+
jasmineEnv.addReporter(new jasmine.TrivialReporter());
|
27
|
+
jasmineEnv.addReporter(new Evergreen.ReflectiveReporter());
|
28
|
+
jasmineEnv.execute();
|
29
|
+
})();
|
30
|
+
</script>
|
data/spec/meta_spec.rb
CHANGED
@@ -2,21 +2,30 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Evergreen::Runner do
|
4
4
|
subject { Evergreen::Runner.new(spec) }
|
5
|
-
let(:
|
5
|
+
let(:spec) { Evergreen::Spec.new(root, template) }
|
6
6
|
|
7
|
-
context "with
|
8
|
-
let(:
|
9
|
-
it { should pass }
|
10
|
-
end
|
7
|
+
context "with standard setup" do
|
8
|
+
let(:root) { File.expand_path('suite1', File.dirname(__FILE__)) }
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
context "with transactions spec" do
|
11
|
+
let(:template) { 'transactions_spec.js' }
|
12
|
+
it { should pass }
|
13
|
+
end
|
14
|
+
|
15
|
+
context "with spec helper" do
|
16
|
+
let(:template) { 'with_helper_spec.js' }
|
17
|
+
it { should pass }
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with template spec" do
|
21
|
+
let(:template) { 'templates_spec.js' }
|
22
|
+
it { should pass }
|
23
|
+
end
|
16
24
|
|
17
|
-
|
18
|
-
|
19
|
-
|
25
|
+
context "with slow failing spec" do
|
26
|
+
let(:template) { 'slow_spec.coffee' }
|
27
|
+
it { should_not pass }
|
28
|
+
end
|
20
29
|
end
|
21
30
|
end
|
22
31
|
|
data/spec/runner_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Evergreen::Runner do
|
4
|
-
let(:root) { File.expand_path('
|
4
|
+
let(:root) { File.expand_path('suite1', File.dirname(__FILE__)) }
|
5
5
|
|
6
6
|
context "with passing spec" do
|
7
7
|
let(:spec) { Evergreen::Spec.new(root, 'testing_spec.js') }
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
1
4
|
require 'evergreen'
|
2
5
|
require 'rspec'
|
3
6
|
|
4
7
|
require 'capybara/dsl'
|
5
|
-
require 'capybara/envjs'
|
6
8
|
|
7
|
-
Capybara.app = Evergreen.application(File.expand_path('
|
8
|
-
Capybara.default_driver = :
|
9
|
+
Capybara.app = Evergreen.application(File.expand_path('suite1', File.dirname(__FILE__)))
|
10
|
+
Capybara.default_driver = :selenium
|
9
11
|
|
10
12
|
module EvergreenMatchers
|
11
13
|
class PassSpec # :nodoc:
|
data/spec/spec_spec.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Evergreen::Spec do
|
4
|
-
let(:root) { File.expand_path('
|
4
|
+
let(:root) { File.expand_path('suite1', File.dirname(__FILE__)) }
|
5
5
|
subject { Evergreen::Spec.new(root, 'testing_spec.js') }
|
6
6
|
|
7
7
|
its(:name) { should == 'testing_spec.js' }
|
8
8
|
its(:root) { should == root }
|
9
9
|
its(:full_path) { should == "#{root}/spec/javascripts/testing_spec.js" }
|
10
|
-
its(:template_path) { should == "#{root}/spec/javascripts/testing_spec.html" }
|
11
10
|
its(:url) { should == "/run/testing_spec.js" }
|
12
11
|
its(:contents) { should =~ /describe\('testing'/ }
|
13
12
|
|
@@ -19,20 +18,11 @@ describe Evergreen::Spec do
|
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
|
-
context "with a template" do
|
23
|
-
subject { Evergreen::Spec.new(root, 'templates_spec.js') }
|
24
|
-
its(:template) { should == %(<h1 id="from-template">This is from the template</h1>\n) }
|
25
|
-
end
|
26
|
-
|
27
21
|
context "with coffeescript" do
|
28
22
|
subject { Evergreen::Spec.new(root, 'coffeescript_spec.coffee') }
|
29
23
|
its(:contents) { should =~ /describe\('coffeescript', function/ }
|
30
24
|
end
|
31
25
|
|
32
|
-
context "without a template" do
|
33
|
-
its(:template) { should == '' }
|
34
|
-
end
|
35
|
-
|
36
26
|
context "with existing spec file" do
|
37
27
|
it { should exist }
|
38
28
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1 id="another-template">This is from another template</h1>
|
File without changes
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require('/jquery.js');
|
2
|
+
stylesheet('/styles.css')
|
3
|
+
|
4
|
+
describe('templates', function() {
|
5
|
+
|
6
|
+
describe('with template', function() {
|
7
|
+
template('one_template.html')
|
8
|
+
|
9
|
+
it("should append the template to the test div", function() {
|
10
|
+
expect($('#test h1#from-template').length).toEqual(1);
|
11
|
+
});
|
12
|
+
|
13
|
+
it("should change stuff in one test...", function() {
|
14
|
+
expect($('#test h1#from-template').length).toEqual(1);
|
15
|
+
|
16
|
+
$('#test h1#from-template').attr('id', 'changed');
|
17
|
+
|
18
|
+
expect($('#test h1#changed').length).toEqual(1);
|
19
|
+
expect($('#test h1#from-template').length).toEqual(0);
|
20
|
+
});
|
21
|
+
|
22
|
+
it("... should have been removed before the next starts", function() {
|
23
|
+
expect($('#test h1#changed').length).toEqual(0);
|
24
|
+
expect($('#test h1#from-template').length).toEqual(1);
|
25
|
+
});
|
26
|
+
});
|
27
|
+
|
28
|
+
describe('with another template', function() {
|
29
|
+
template('another_template.html')
|
30
|
+
|
31
|
+
it("should append the template to the test div", function() {
|
32
|
+
expect($('#test h1#another-template').length).toEqual(1);
|
33
|
+
});
|
34
|
+
});
|
35
|
+
|
36
|
+
});
|
37
|
+
|
38
|
+
describe('stylesheet', function() {
|
39
|
+
template('one_template.html')
|
40
|
+
|
41
|
+
it("should style the template", function() {
|
42
|
+
// Env-js does not have support for stylesheets
|
43
|
+
if (Evergreen.driver != "envjs") {
|
44
|
+
expect(document.getElementById('from-template').offsetWidth).toEqual(300)
|
45
|
+
}
|
46
|
+
});
|
47
|
+
});
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Evergreen::Template do
|
4
|
+
let(:root) { File.expand_path('suite1', File.dirname(__FILE__)) }
|
5
|
+
subject { Evergreen::Template.new(root, 'one_template.html') }
|
6
|
+
|
7
|
+
its(:name) { should == 'one_template.html' }
|
8
|
+
its(:root) { should == root }
|
9
|
+
its(:full_path) { should == "#{root}/spec/javascripts/templates/one_template.html" }
|
10
|
+
its(:contents) { should =~ %r(<h1 id="from\-template">This is from the template</h1>) }
|
11
|
+
describe '.all' do
|
12
|
+
subject { Evergreen::Template.all(root) }
|
13
|
+
|
14
|
+
it "should find all specs in the given root directory" do
|
15
|
+
subject.map(&:name).should include('one_template.html', 'another_template.html')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "with existing spec file" do
|
20
|
+
it { should exist }
|
21
|
+
end
|
22
|
+
|
23
|
+
context "with missing spec file" do
|
24
|
+
subject { Evergreen::Template.new(root, 'does_not_exist.html') }
|
25
|
+
it { should_not exist }
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonas Nicklas
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-16 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -34,26 +34,10 @@ dependencies:
|
|
34
34
|
version: 0.3.9
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: capybara-envjs
|
39
|
-
prerelease: false
|
40
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 17
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
- 1
|
49
|
-
- 5
|
50
|
-
version: 0.1.5
|
51
|
-
type: :runtime
|
52
|
-
version_requirements: *id002
|
53
37
|
- !ruby/object:Gem::Dependency
|
54
38
|
name: launchy
|
55
39
|
prerelease: false
|
56
|
-
requirement: &
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
57
41
|
none: false
|
58
42
|
requirements:
|
59
43
|
- - ">="
|
@@ -65,11 +49,11 @@ dependencies:
|
|
65
49
|
- 5
|
66
50
|
version: 0.3.5
|
67
51
|
type: :runtime
|
68
|
-
version_requirements: *
|
52
|
+
version_requirements: *id002
|
69
53
|
- !ruby/object:Gem::Dependency
|
70
54
|
name: sinatra
|
71
55
|
prerelease: false
|
72
|
-
requirement: &
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
73
57
|
none: false
|
74
58
|
requirements:
|
75
59
|
- - ">="
|
@@ -80,11 +64,11 @@ dependencies:
|
|
80
64
|
- 0
|
81
65
|
version: "1.0"
|
82
66
|
type: :runtime
|
83
|
-
version_requirements: *
|
67
|
+
version_requirements: *id003
|
84
68
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
69
|
+
name: json_pure
|
86
70
|
prerelease: false
|
87
|
-
requirement: &
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
88
72
|
none: false
|
89
73
|
requirements:
|
90
74
|
- - ">="
|
@@ -96,11 +80,11 @@ dependencies:
|
|
96
80
|
- 0
|
97
81
|
version: 1.0.0
|
98
82
|
type: :runtime
|
99
|
-
version_requirements: *
|
83
|
+
version_requirements: *id004
|
100
84
|
- !ruby/object:Gem::Dependency
|
101
85
|
name: rspec
|
102
86
|
prerelease: false
|
103
|
-
requirement: &
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
104
88
|
none: false
|
105
89
|
requirements:
|
106
90
|
- - ">="
|
@@ -114,7 +98,7 @@ dependencies:
|
|
114
98
|
- 15
|
115
99
|
version: 2.0.0.beta.15
|
116
100
|
type: :development
|
117
|
-
version_requirements: *
|
101
|
+
version_requirements: *id005
|
118
102
|
description: Run Jasmine JavaScript unit tests, integrate them into Ruby applications.
|
119
103
|
email:
|
120
104
|
- jonas.nicklas@gmail.com
|
@@ -126,12 +110,15 @@ extra_rdoc_files:
|
|
126
110
|
- README.rdoc
|
127
111
|
files:
|
128
112
|
- lib/evergreen/cli.rb
|
129
|
-
- lib/evergreen/evergreen.js
|
130
113
|
- lib/evergreen/rails.rb
|
114
|
+
- lib/evergreen/resources/evergreen.css
|
115
|
+
- lib/evergreen/resources/evergreen.js
|
131
116
|
- lib/evergreen/runner.rb
|
132
117
|
- lib/evergreen/server.rb
|
133
118
|
- lib/evergreen/spec.rb
|
119
|
+
- lib/evergreen/template.rb
|
134
120
|
- lib/evergreen/version.rb
|
121
|
+
- lib/evergreen/views/layout.erb
|
135
122
|
- lib/evergreen/views/list.erb
|
136
123
|
- lib/evergreen/views/spec.erb
|
137
124
|
- lib/evergreen.rb
|
@@ -201,22 +188,26 @@ files:
|
|
201
188
|
- lib/jasmine/src/WaitsForBlock.js
|
202
189
|
- lib/tasks/evergreen.rake
|
203
190
|
- spec/evergreen_spec.rb
|
204
|
-
- spec/fixtures/public/jquery.js
|
205
|
-
- spec/fixtures/spec/javascripts/bar_spec.js
|
206
|
-
- spec/fixtures/spec/javascripts/coffeescript_spec.coffee
|
207
|
-
- spec/fixtures/spec/javascripts/failing_spec.js
|
208
|
-
- spec/fixtures/spec/javascripts/foo_spec.js
|
209
|
-
- spec/fixtures/spec/javascripts/spec_helper.coffee
|
210
|
-
- spec/fixtures/spec/javascripts/spec_helper.js
|
211
|
-
- spec/fixtures/spec/javascripts/templates_spec.html
|
212
|
-
- spec/fixtures/spec/javascripts/templates_spec.js
|
213
|
-
- spec/fixtures/spec/javascripts/testing_spec.js
|
214
|
-
- spec/fixtures/spec/javascripts/transactions_spec.js
|
215
|
-
- spec/fixtures/spec/javascripts/with_helper_spec.js
|
216
191
|
- spec/meta_spec.rb
|
217
192
|
- spec/runner_spec.rb
|
218
193
|
- spec/spec_helper.rb
|
219
194
|
- spec/spec_spec.rb
|
195
|
+
- spec/suite1/public/jquery.js
|
196
|
+
- spec/suite1/public/styles.css
|
197
|
+
- spec/suite1/spec/javascripts/bar_spec.js
|
198
|
+
- spec/suite1/spec/javascripts/coffeescript_spec.coffee
|
199
|
+
- spec/suite1/spec/javascripts/failing_spec.js
|
200
|
+
- spec/suite1/spec/javascripts/foo_spec.js
|
201
|
+
- spec/suite1/spec/javascripts/slow_spec.coffee
|
202
|
+
- spec/suite1/spec/javascripts/spec_helper.coffee
|
203
|
+
- spec/suite1/spec/javascripts/spec_helper.js
|
204
|
+
- spec/suite1/spec/javascripts/templates/another_template.html
|
205
|
+
- spec/suite1/spec/javascripts/templates/one_template.html
|
206
|
+
- spec/suite1/spec/javascripts/templates_spec.js
|
207
|
+
- spec/suite1/spec/javascripts/testing_spec.js
|
208
|
+
- spec/suite1/spec/javascripts/transactions_spec.js
|
209
|
+
- spec/suite1/spec/javascripts/with_helper_spec.js
|
210
|
+
- spec/template_spec.rb
|
220
211
|
- config/routes.rb
|
221
212
|
- README.rdoc
|
222
213
|
- bin/evergreen
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require('/jquery.js');
|
2
|
-
|
3
|
-
describe('templates', function() {
|
4
|
-
|
5
|
-
it("should append the template to the test div", function() {
|
6
|
-
expect($('#test h1#from-template').length).toEqual(1);
|
7
|
-
});
|
8
|
-
|
9
|
-
it("should change stuff in one test...", function() {
|
10
|
-
expect($('#test h1#from-template').length).toEqual(1);
|
11
|
-
|
12
|
-
$('#test h1#from-template').attr('id', 'changed');
|
13
|
-
|
14
|
-
expect($('#test h1#changed').length).toEqual(1);
|
15
|
-
expect($('#test h1#from-template').length).toEqual(0);
|
16
|
-
});
|
17
|
-
|
18
|
-
it("... should have been removed before the next starts", function() {
|
19
|
-
expect($('#test h1#changed').length).toEqual(0);
|
20
|
-
expect($('#test h1#from-template').length).toEqual(1);
|
21
|
-
});
|
22
|
-
|
23
|
-
});
|