shenandoah 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.braids +8 -0
- data/.document +5 -0
- data/.gitignore +6 -0
- data/ChangeLog.markdown +6 -0
- data/LICENSE +20 -0
- data/LICENSE-Blue-Ridge +20 -0
- data/LICENSE-Screw.Unit +22 -0
- data/LICENSE-Smoke +22 -0
- data/README.markdown +260 -0
- data/Rakefile +70 -0
- data/VERSION.yml +4 -0
- data/lib/shenandoah/buildr.rb +9 -0
- data/lib/shenandoah/buildr/locator.rb +17 -0
- data/lib/shenandoah/buildr/shenandoah_tasks.rb +18 -0
- data/lib/shenandoah/buildr/test_framework.rb +28 -0
- data/lib/shenandoah/css/screw.css +90 -0
- data/lib/shenandoah/javascript/browser/runner.js +34 -0
- data/lib/shenandoah/javascript/common/jquery-1.3.2.js +4376 -0
- data/lib/shenandoah/javascript/common/jquery.fn.js +29 -0
- data/lib/shenandoah/javascript/common/jquery.print.js +109 -0
- data/lib/shenandoah/javascript/common/screw.behaviors.js +129 -0
- data/lib/shenandoah/javascript/common/screw.builder.js +104 -0
- data/lib/shenandoah/javascript/common/screw.events.js +45 -0
- data/lib/shenandoah/javascript/common/screw.matchers.js +254 -0
- data/lib/shenandoah/javascript/common/screw.mocking.js +22 -0
- data/lib/shenandoah/javascript/common/smoke.core.js +6 -0
- data/lib/shenandoah/javascript/common/smoke.mock.js +130 -0
- data/lib/shenandoah/javascript/common/smoke.stub.js +29 -0
- data/lib/shenandoah/javascript/console/consoleReportForRake.js +32 -0
- data/lib/shenandoah/javascript/console/env.rhino.js +8841 -0
- data/lib/shenandoah/javascript/console/js.jar +0 -0
- data/lib/shenandoah/javascript/console/runner.js +43 -0
- data/lib/shenandoah/javascript/console/shell.js.erb +23 -0
- data/lib/shenandoah/locator.rb +17 -0
- data/lib/shenandoah/runner.rb +69 -0
- data/lib/shenandoah/server.rb +88 -0
- data/lib/shenandoah/server/views/index.haml +12 -0
- data/lib/shenandoah/tasks.rb +58 -0
- data/shenandoah.gemspec +133 -0
- data/spec/shenandoah/buildr/locator_spec.rb +33 -0
- data/spec/shenandoah/buildr/shenandoah_tasks_spec.rb +27 -0
- data/spec/shenandoah/buildr/spec_helper.rb +2 -0
- data/spec/shenandoah/buildr/test_framework_spec.rb +77 -0
- data/spec/shenandoah/locator_spec.rb +74 -0
- data/spec/shenandoah/runner_spec.rb +110 -0
- data/spec/shenandoah/server_spec.rb +216 -0
- data/spec/shenandoah/tasks_spec.rb +76 -0
- data/spec/spec_helper.rb +36 -0
- metadata +232 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
require 'shenandoah/buildr/locator'
|
5
|
+
|
6
|
+
describe Shenandoah::Buildr::Locator do
|
7
|
+
include Shenandoah::Spec::Tmpfile
|
8
|
+
|
9
|
+
before do
|
10
|
+
@project = define('sample', :base_dir => tmpdir)
|
11
|
+
@loc = Shenandoah::Buildr::Locator.new(@project)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "resolves the specs from the base dir" do
|
15
|
+
@loc.spec_path.should == "#{tmpdir}/src/spec/javascript"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "resolves the main source from src main" do
|
19
|
+
@loc.main_path.should == "#{tmpdir}/src/main/javascript"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "uses a path under target for tmp" do
|
23
|
+
@loc.tmp_path.should == "#{tmpdir}/target/shenandoah"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "allows main to be overriden with test.using" do |variable|
|
27
|
+
p = define('another', :base_dir => tmpdir) do
|
28
|
+
test.using :main_path => "foo"
|
29
|
+
end
|
30
|
+
|
31
|
+
Shenandoah::Buildr::Locator.new(p).main_path.should == "foo"
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
require 'shenandoah/buildr'
|
4
|
+
|
5
|
+
describe Buildr::JavaScript::ShenandoahTasks do
|
6
|
+
before do
|
7
|
+
define("js") do
|
8
|
+
test.using :shenandoah
|
9
|
+
end
|
10
|
+
|
11
|
+
define("java") do
|
12
|
+
test.using :junit
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it "leaves non-shenandoah projects alone" do
|
17
|
+
Rake::Task.task_defined?("java:shen:serve").should be_false
|
18
|
+
end
|
19
|
+
|
20
|
+
it "adds a server task" do
|
21
|
+
Rake::Task.task_defined?("js:shen:serve").should be_true
|
22
|
+
end
|
23
|
+
|
24
|
+
it "adds a shell task" do
|
25
|
+
Rake::Task.task_defined?("js:shen:shell").should be_true
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
require 'shenandoah/buildr'
|
4
|
+
|
5
|
+
describe Buildr::JavaScript::Shenandoah do
|
6
|
+
include Shenandoah::Spec::Tmpfile
|
7
|
+
|
8
|
+
def js_proj(&block)
|
9
|
+
define('js-proj', :base_dir => "#{self.tmpdir}/js-proj") do
|
10
|
+
test.using :quiet => true
|
11
|
+
if block
|
12
|
+
instance_eval(&block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
project('js-proj')
|
16
|
+
end
|
17
|
+
|
18
|
+
before do
|
19
|
+
@other_proj = define('other-proj', :base_dir => "#{tmpdir}/other-proj")
|
20
|
+
@good = tmpfile "js-proj/src/spec/javascript/good_spec.js", <<-JS
|
21
|
+
Screw.Unit(function () {
|
22
|
+
describe("success", function () {
|
23
|
+
it("passes", function () {
|
24
|
+
expect(true).to(be_true);
|
25
|
+
});
|
26
|
+
});
|
27
|
+
});
|
28
|
+
JS
|
29
|
+
tmpfile "js-proj/src/spec/javascript/good.html", <<-HTML
|
30
|
+
<html><body></body></html>
|
31
|
+
HTML
|
32
|
+
end
|
33
|
+
|
34
|
+
it "applies to a project with js specs" do
|
35
|
+
Buildr::JavaScript::Shenandoah.applies_to?(js_proj).should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "does not apply to a project without specs" do
|
39
|
+
Buildr::JavaScript::Shenandoah.applies_to?(@other_proj).should be_false
|
40
|
+
end
|
41
|
+
|
42
|
+
it "is automatically used for a project with js specs" do
|
43
|
+
js_proj do
|
44
|
+
test.framework.should == :shenandoah
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it "executes passing specs" do
|
49
|
+
good = @good
|
50
|
+
js_proj do
|
51
|
+
test.invoke
|
52
|
+
test.passed_tests.should == [good]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it "executes failing specs" do
|
57
|
+
bad = tmpfile "js-proj/src/spec/javascript/bad_spec.js", <<-JS
|
58
|
+
Screw.Unit(function () {
|
59
|
+
describe("failure", function () {
|
60
|
+
it("fails", function () {
|
61
|
+
expect(1).to(equal, 0)
|
62
|
+
});
|
63
|
+
});
|
64
|
+
});
|
65
|
+
JS
|
66
|
+
tmpfile "js-proj/src/spec/javascript/bad.html", <<-HTML
|
67
|
+
<html><body></body></html>
|
68
|
+
HTML
|
69
|
+
good = @good
|
70
|
+
js_proj do
|
71
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
72
|
+
test.passed_tests.should == [good]
|
73
|
+
test.failed_tests.should == [bad]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
require 'shenandoah/locator'
|
4
|
+
|
5
|
+
describe Shenandoah::DefaultLocator do
|
6
|
+
include Shenandoah::Spec::Tmpfile
|
7
|
+
|
8
|
+
describe "default attributes" do
|
9
|
+
before do
|
10
|
+
ENV['TMPDIR'] = nil
|
11
|
+
@loc = Shenandoah::DefaultLocator.new
|
12
|
+
end
|
13
|
+
|
14
|
+
it "has main_path = lib" do
|
15
|
+
@loc.main_path.should == "lib"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "has spec_path = spec" do
|
19
|
+
@loc.spec_path.should == "spec"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "uses the TMPDIR env var for tmp" do
|
23
|
+
ENV['TMPDIR'] = "/var/tmp"
|
24
|
+
Shenandoah::DefaultLocator.new.tmp_path.should == "/var/tmp"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "has tmp_path = tmp" do
|
28
|
+
@loc.tmp_path.should == "tmp"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "initializing from options" do
|
33
|
+
it "uses an explicit main path" do
|
34
|
+
Shenandoah::DefaultLocator.new(:main_path => 'main').main_path.should == 'main'
|
35
|
+
end
|
36
|
+
|
37
|
+
it "uses an explicit spec path" do
|
38
|
+
Shenandoah::DefaultLocator.new(:spec_path => 'foo').spec_path.should == 'foo'
|
39
|
+
end
|
40
|
+
|
41
|
+
it "uses an explicit tmp path" do
|
42
|
+
Shenandoah::DefaultLocator.new(:tmp_path => 'foo').tmp_path.should == 'foo'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "finding specs" do
|
47
|
+
before do
|
48
|
+
@loc = Shenandoah::DefaultLocator.new :spec_path => "#{tmpdir}/spec"
|
49
|
+
end
|
50
|
+
|
51
|
+
it "finds specs directly in spec_path" do
|
52
|
+
tmpfile "spec/common_spec.js"
|
53
|
+
@loc.spec_files.should == ["#{tmpdir}/spec/common_spec.js"]
|
54
|
+
end
|
55
|
+
|
56
|
+
it "finds specs in subdirs" do
|
57
|
+
tmpfile "spec/foo/bar_spec.js"
|
58
|
+
@loc.spec_files.should == ["#{tmpdir}/spec/foo/bar_spec.js"]
|
59
|
+
end
|
60
|
+
|
61
|
+
it "only finds specs" do
|
62
|
+
tmpfile "spec/quux.js"
|
63
|
+
tmpfile "spec/foo/bar_spec.js"
|
64
|
+
@loc.spec_files.should == ["#{tmpdir}/spec/foo/bar_spec.js"]
|
65
|
+
end
|
66
|
+
|
67
|
+
it "doesn't cache results" do
|
68
|
+
tmpfile "spec/bar/etc_spec.js"
|
69
|
+
@loc.should have(1).spec_files
|
70
|
+
tmpfile "spec/bar/quux_spec.js"
|
71
|
+
@loc.should have(2).spec_files
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
require 'erb'
|
3
|
+
require 'open3'
|
4
|
+
|
5
|
+
require 'shenandoah/locator'
|
6
|
+
require 'shenandoah/runner'
|
7
|
+
|
8
|
+
describe Shenandoah::Runner do
|
9
|
+
include Shenandoah::Spec::Tmpfile
|
10
|
+
|
11
|
+
before do
|
12
|
+
@locator = Shenandoah::DefaultLocator.new(
|
13
|
+
:spec_path => "#{tmpdir}/spec",
|
14
|
+
:main_path => "#{tmpdir}/main",
|
15
|
+
:tmp_path => "#{tmpdir}/tmp"
|
16
|
+
)
|
17
|
+
%w(spec main).each { |d| FileUtils.mkdir_p "#{tmpdir}/#{d}" }
|
18
|
+
@runner = Shenandoah::Runner.new(@locator, :quiet => true)
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_good_spec
|
22
|
+
@good = tmpfile "spec/good_spec.js", <<-JS
|
23
|
+
Screw.Unit(function () {
|
24
|
+
describe("good", function () {
|
25
|
+
it("passes", function () {
|
26
|
+
expect("good").to(equal, "good");
|
27
|
+
});
|
28
|
+
});
|
29
|
+
})
|
30
|
+
JS
|
31
|
+
tmpfile "spec/good.html", <<-HTML
|
32
|
+
<html><body></body></html>
|
33
|
+
HTML
|
34
|
+
end
|
35
|
+
|
36
|
+
def add_bad_spec
|
37
|
+
@bad = tmpfile "spec/bad_spec.js", <<-JS
|
38
|
+
Screw.Unit(function () {
|
39
|
+
describe("bad", function () {
|
40
|
+
it("fails", function () {
|
41
|
+
expect("bad").to(equal, "good");
|
42
|
+
});
|
43
|
+
});
|
44
|
+
});
|
45
|
+
JS
|
46
|
+
tmpfile "spec/bad.html", <<-HTML
|
47
|
+
<html><body></body></html>
|
48
|
+
HTML
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "#run_console" do
|
52
|
+
it "runs passing specs" do
|
53
|
+
add_good_spec
|
54
|
+
@runner.run_console([@good]).should == [@good]
|
55
|
+
end
|
56
|
+
|
57
|
+
it "fails on bad specs" do
|
58
|
+
add_bad_spec
|
59
|
+
@runner.run_console([@bad]).should == []
|
60
|
+
end
|
61
|
+
|
62
|
+
it "runs all specs" do
|
63
|
+
add_good_spec
|
64
|
+
add_bad_spec
|
65
|
+
@runner.run_console([@bad, @good]).should == [@good]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "#run_shell" do
|
70
|
+
before do
|
71
|
+
script_contents = ERB.new(<<-RUBY).result(binding)
|
72
|
+
# This is a small script to invoke Runner#run_shell so that it's
|
73
|
+
# input and output can be controlled for testing
|
74
|
+
<% $LOAD_PATH.select { |p| p =~ /shenandoah/ }.each do |p| %>
|
75
|
+
$LOAD_PATH.unshift(<%= p.inspect %>)
|
76
|
+
<% end %>
|
77
|
+
require 'rubygems'
|
78
|
+
require 'shenandoah/runner'
|
79
|
+
require 'shenandoah/locator'
|
80
|
+
|
81
|
+
loc = Shenandoah::DefaultLocator.new(
|
82
|
+
:main_path => <%= @locator.main_path.inspect %>,
|
83
|
+
:spec_path => <%= @locator.spec_path.inspect %>,
|
84
|
+
:tmp_path => <%= @locator.tmp_path.inspect %>
|
85
|
+
)
|
86
|
+
|
87
|
+
Shenandoah::Runner.new(loc).run_shell
|
88
|
+
RUBY
|
89
|
+
tmpfile "spec_shell.rb", script_contents
|
90
|
+
end
|
91
|
+
|
92
|
+
def run_shell(jslines)
|
93
|
+
Open3.popen3("ruby #{tmpdir}/spec_shell.rb") do |stdin, stdout, stderr|
|
94
|
+
stdin.write jslines
|
95
|
+
stdin.close
|
96
|
+
return stdout.read, stderr.read
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
it "runs an interactive shell" do
|
101
|
+
out, err = run_shell("1 + 1 + ' foo';\n")
|
102
|
+
err.should =~ /2 foo/
|
103
|
+
end
|
104
|
+
|
105
|
+
it "prints a banner" do
|
106
|
+
out, err = run_shell("quit();\n")
|
107
|
+
out.should =~ / Rhino JavaScript Shell/
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,216 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require 'spec/interop/test'
|
3
|
+
require 'rspec_hpricot_matchers'
|
4
|
+
require 'rack/test'
|
5
|
+
require 'time'
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
require 'shenandoah/server'
|
9
|
+
require 'shenandoah/locator'
|
10
|
+
|
11
|
+
describe Shenandoah::Server do
|
12
|
+
include Rack::Test::Methods
|
13
|
+
include FileUtils
|
14
|
+
include Shenandoah::Spec::Tmpfile
|
15
|
+
|
16
|
+
def app
|
17
|
+
Shenandoah::Server
|
18
|
+
end
|
19
|
+
|
20
|
+
before do
|
21
|
+
app.set :environment, :test
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "/shenandoah/browser-runner.js" do
|
25
|
+
before do
|
26
|
+
get '/shenandoah/browser-runner.js'
|
27
|
+
end
|
28
|
+
|
29
|
+
it "is accessible" do
|
30
|
+
last_response.should be_ok
|
31
|
+
end
|
32
|
+
|
33
|
+
it "is javascript" do
|
34
|
+
last_response.headers['Content-Type'].should == 'text/javascript'
|
35
|
+
end
|
36
|
+
|
37
|
+
it "includes jQuery" do
|
38
|
+
last_response.body.should =~ %r{\* jQuery JavaScript Library v1\.3\.2}
|
39
|
+
end
|
40
|
+
|
41
|
+
it "includes jQuery.fn" do
|
42
|
+
last_response.body.should =~ %r{\$.fn.fn = function}
|
43
|
+
end
|
44
|
+
|
45
|
+
it "includes jQuery.print" do
|
46
|
+
last_response.body.should =~ %r{\$.print = function}
|
47
|
+
end
|
48
|
+
|
49
|
+
it "includes Screw.Unit" do
|
50
|
+
last_response.body.should =~ %r{var Screw = \(function\(\$\)}
|
51
|
+
end
|
52
|
+
|
53
|
+
it "includes Smoke" do
|
54
|
+
last_response.body.should =~ %r{Smoke = \{}
|
55
|
+
end
|
56
|
+
|
57
|
+
it "includes the Shenandoah test API" do
|
58
|
+
last_response.body.should =~ %r{function require_spec\(}
|
59
|
+
last_response.body.should =~ %r{function require_main\(}
|
60
|
+
end
|
61
|
+
|
62
|
+
it "was last modified at the latest date of the combined files" do
|
63
|
+
maxTime = Dir["#{File.dirname(__FILE__)}/../../lib/shenandoah/javascript/{browser,common}/*.js"].
|
64
|
+
collect { |filename| File.stat(filename).mtime }.max
|
65
|
+
Time.httpdate(last_response.headers['Last-Modified']).should == maxTime
|
66
|
+
end
|
67
|
+
|
68
|
+
it "includes the source filenames" do
|
69
|
+
last_response.body.should =~ %r{////// javascript/common/jquery-1.3.2.js}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
%w(main spec).each do |kind|
|
74
|
+
describe "/#{kind}/*" do
|
75
|
+
before do
|
76
|
+
app.set :locator,
|
77
|
+
Shenandoah::DefaultLocator.new(
|
78
|
+
:"#{kind}_path" => "#{self.tmpdir}/#{kind.hash}")
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "for an existing file" do
|
82
|
+
before do
|
83
|
+
tmpfile("#{kind.hash}/good.js", "var any = function () { };\n")
|
84
|
+
get "/#{kind}/good.js"
|
85
|
+
end
|
86
|
+
|
87
|
+
it "succeeds" do
|
88
|
+
last_response.should be_ok
|
89
|
+
end
|
90
|
+
|
91
|
+
it "responds with the content" do
|
92
|
+
last_response.body.should == "var any = function () { };\n"
|
93
|
+
end
|
94
|
+
|
95
|
+
it "indicates that the file shouldn't be cached" do
|
96
|
+
last_response.headers["Cache-Control"].should == "no-cache"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe "for a non-existent file" do
|
101
|
+
before do
|
102
|
+
get "/#{kind}/bad.js"
|
103
|
+
end
|
104
|
+
|
105
|
+
it "404s" do
|
106
|
+
last_response.status.should == 404
|
107
|
+
end
|
108
|
+
|
109
|
+
it "has a reasonable error message" do
|
110
|
+
last_response.body.should ==
|
111
|
+
"#{kind.capitalize} file not found: #{self.tmpdir}/#{kind.hash}/bad.js"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "/screw.css" do
|
118
|
+
describe "by default" do
|
119
|
+
before do
|
120
|
+
get '/screw.css'
|
121
|
+
@included = "#{File.dirname(__FILE__)}/../../lib/shenandoah/css/screw.css"
|
122
|
+
end
|
123
|
+
|
124
|
+
it "is available" do
|
125
|
+
last_response.should be_ok
|
126
|
+
end
|
127
|
+
|
128
|
+
it "is the included version" do
|
129
|
+
last_response.body.should == File.read(@included)
|
130
|
+
end
|
131
|
+
|
132
|
+
it "has the correct last modified version" do
|
133
|
+
Time.httpdate(last_response.headers['Last-Modified']).should ==
|
134
|
+
File.stat(@included).mtime
|
135
|
+
end
|
136
|
+
|
137
|
+
it "is CSS" do
|
138
|
+
last_response.headers['Content-Type'].should == 'text/css'
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe "when overridden" do
|
143
|
+
before do
|
144
|
+
app.set :locator,
|
145
|
+
Shenandoah::DefaultLocator.new(:spec_path => self.tmpdir)
|
146
|
+
tmpfile "screw.css", ".passed { color: blue }"
|
147
|
+
get '/screw.css'
|
148
|
+
end
|
149
|
+
|
150
|
+
it "is available" do
|
151
|
+
last_response.should be_ok
|
152
|
+
end
|
153
|
+
|
154
|
+
it "is the version from the spec dir" do
|
155
|
+
last_response.body.should == ".passed { color: blue }"
|
156
|
+
end
|
157
|
+
|
158
|
+
it "has the correct last modified version" do
|
159
|
+
Time.httpdate(last_response.headers['Last-Modified']).should ==
|
160
|
+
File.stat("#{self.tmpdir}/screw.css").mtime
|
161
|
+
end
|
162
|
+
|
163
|
+
it "is CSS" do
|
164
|
+
last_response.headers['Content-Type'].should == 'text/css'
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe "/" do
|
170
|
+
include RspecHpricotMatchers
|
171
|
+
|
172
|
+
before do
|
173
|
+
app.set :locator,
|
174
|
+
Shenandoah::DefaultLocator.new(:spec_path => File.join(self.tmpdir, 'spec'))
|
175
|
+
tmpfile "spec/common_spec.js", "DC"
|
176
|
+
tmpfile "spec/some/thing_spec.js", "DC"
|
177
|
+
get "/"
|
178
|
+
end
|
179
|
+
|
180
|
+
it "is available" do
|
181
|
+
last_response.should be_ok
|
182
|
+
end
|
183
|
+
|
184
|
+
it "includes an overall heading" do
|
185
|
+
app.set :project_name, "Some Proj"
|
186
|
+
get "/"
|
187
|
+
last_response.body.should have_tag("h1", "Specs for Some Proj")
|
188
|
+
end
|
189
|
+
|
190
|
+
it "does not include an overall heading without the project name" do
|
191
|
+
app.set :project_name, nil
|
192
|
+
get "/"
|
193
|
+
last_response.body.should_not have_tag("h1")
|
194
|
+
end
|
195
|
+
|
196
|
+
it "includes a section heading for the root set" do
|
197
|
+
last_response.body.should have_tag("h2", "[root]")
|
198
|
+
end
|
199
|
+
|
200
|
+
it "includes a section heading for each subdirectory" do
|
201
|
+
last_response.body.should have_tag("h2", "some")
|
202
|
+
end
|
203
|
+
|
204
|
+
it "includes lists of links" do
|
205
|
+
last_response.body.should have_tag("ul a", :count => 2)
|
206
|
+
end
|
207
|
+
|
208
|
+
it "includes a link to a spec in the root" do
|
209
|
+
last_response.body.should have_tag("a[@href='spec/common.html']", "common")
|
210
|
+
end
|
211
|
+
|
212
|
+
it "includes link to a spec in a subdirectory" do
|
213
|
+
last_response.body.should have_tag("a[@href='spec/some/thing.html']", "thing")
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|