rsutphin-shenandoah 0.1.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.
Files changed (64) hide show
  1. data/.braids +8 -0
  2. data/.document +5 -0
  3. data/.gitignore +6 -0
  4. data/ChangeLog.markdown +13 -0
  5. data/LICENSE +20 -0
  6. data/LICENSE-Blue-Ridge +20 -0
  7. data/LICENSE-Screw.Unit +22 -0
  8. data/LICENSE-Smoke +22 -0
  9. data/README.markdown +280 -0
  10. data/Rakefile +71 -0
  11. data/VERSION.yml +4 -0
  12. data/lib/shenandoah/buildr.rb +9 -0
  13. data/lib/shenandoah/buildr/locator.rb +17 -0
  14. data/lib/shenandoah/buildr/shenandoah_tasks.rb +18 -0
  15. data/lib/shenandoah/buildr/test_framework.rb +28 -0
  16. data/lib/shenandoah/css/screw.css +90 -0
  17. data/lib/shenandoah/javascript/browser/runner.js +34 -0
  18. data/lib/shenandoah/javascript/common/jquery-1.3.2.js +4376 -0
  19. data/lib/shenandoah/javascript/common/jquery.fn.js +29 -0
  20. data/lib/shenandoah/javascript/common/jquery.print.js +109 -0
  21. data/lib/shenandoah/javascript/common/screw.behaviors.js +129 -0
  22. data/lib/shenandoah/javascript/common/screw.builder.js +104 -0
  23. data/lib/shenandoah/javascript/common/screw.events.js +45 -0
  24. data/lib/shenandoah/javascript/common/screw.matchers.js +254 -0
  25. data/lib/shenandoah/javascript/common/screw.mocking.js +22 -0
  26. data/lib/shenandoah/javascript/common/smoke.core.js +6 -0
  27. data/lib/shenandoah/javascript/common/smoke.mock.js +130 -0
  28. data/lib/shenandoah/javascript/common/smoke.stub.js +29 -0
  29. data/lib/shenandoah/javascript/console/consoleReportForRake.js +32 -0
  30. data/lib/shenandoah/javascript/console/env.rhino.js +8841 -0
  31. data/lib/shenandoah/javascript/console/js.jar +0 -0
  32. data/lib/shenandoah/javascript/console/runner.js +43 -0
  33. data/lib/shenandoah/javascript/console/shell.js.erb +23 -0
  34. data/lib/shenandoah/locator.rb +17 -0
  35. data/lib/shenandoah/rails/locator.rb +27 -0
  36. data/lib/shenandoah/rails/tasks.rb +16 -0
  37. data/lib/shenandoah/runner.rb +69 -0
  38. data/lib/shenandoah/server.rb +88 -0
  39. data/lib/shenandoah/server/views/index.haml +12 -0
  40. data/lib/shenandoah/tasks.rb +62 -0
  41. data/rails_generators/shen_spec/shen_spec_generator.rb +27 -0
  42. data/rails_generators/shen_spec/templates/fixture.html.erb +13 -0
  43. data/rails_generators/shen_spec/templates/javascript_spec.js.erb +8 -0
  44. data/rails_generators/shenandoah/shenandoah_generator.rb +21 -0
  45. data/rails_generators/shenandoah/templates/application.html +16 -0
  46. data/rails_generators/shenandoah/templates/application_spec.js +14 -0
  47. data/rails_generators/shenandoah/templates/shenandoah.rake +2 -0
  48. data/rails_generators/shenandoah/templates/spec_helper.js +1 -0
  49. data/shenandoah.gemspec +155 -0
  50. data/spec/rails_generators/shen_spec_generator_spec.rb +81 -0
  51. data/spec/rails_generators/shenandoah_generator_spec.rb +80 -0
  52. data/spec/rails_generators/spec_helper.rb +21 -0
  53. data/spec/shenandoah/buildr/locator_spec.rb +33 -0
  54. data/spec/shenandoah/buildr/shenandoah_tasks_spec.rb +27 -0
  55. data/spec/shenandoah/buildr/spec_helper.rb +2 -0
  56. data/spec/shenandoah/buildr/test_framework_spec.rb +77 -0
  57. data/spec/shenandoah/locator_spec.rb +74 -0
  58. data/spec/shenandoah/rails/locator_spec.rb +57 -0
  59. data/spec/shenandoah/rails/tasks_spec.rb +32 -0
  60. data/spec/shenandoah/runner_spec.rb +110 -0
  61. data/spec/shenandoah/server_spec.rb +216 -0
  62. data/spec/shenandoah/tasks_spec.rb +85 -0
  63. data/spec/spec_helper.rb +61 -0
  64. metadata +262 -0
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+
4
+ <head>
5
+ <title>Application | JavaScript Testing Results</title>
6
+ <link rel="stylesheet" href="/screw.css" type="text/css" charset="utf-8" />
7
+ <script type="text/javascript" src="/shenandoah/browser-runner.js"></script>
8
+ </head>
9
+
10
+ <body>
11
+ <!-- Put any HTML fixture elements here. -->
12
+ <div class="select_me"/>
13
+ <span class="select_me"/>
14
+ <div class="dont_select_me"/>
15
+ </body>
16
+ </html>
@@ -0,0 +1,14 @@
1
+ require_spec('spec_helper.js');
2
+ require_main('application.js');
3
+
4
+ Screw.Unit(function () {
5
+ describe("Your application javascript", function () {
6
+ it("does something", function () {
7
+ expect("hello").to(equal, "hello");
8
+ });
9
+
10
+ it("accesses the DOM from fixtures/application.html", function () {
11
+ expect($('.select_me').length).to(equal, 2);
12
+ });
13
+ });
14
+ });
@@ -0,0 +1,2 @@
1
+ require 'shenandoah/rails/tasks'
2
+ Shenandoah::Rails::Tasks.new
@@ -0,0 +1 @@
1
+ // Use this file to require common dependencies or to setup useful test functions.
@@ -0,0 +1,155 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{shenandoah}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Rhett Sutphin"]
9
+ s.date = %q{2009-06-16}
10
+ s.email = %q{rhett@detailedbalance.net}
11
+ s.extra_rdoc_files = [
12
+ "ChangeLog.markdown",
13
+ "LICENSE",
14
+ "LICENSE-Blue-Ridge",
15
+ "LICENSE-Screw.Unit",
16
+ "LICENSE-Smoke",
17
+ "README.markdown"
18
+ ]
19
+ s.files = [
20
+ ".braids",
21
+ ".document",
22
+ ".gitignore",
23
+ "ChangeLog.markdown",
24
+ "LICENSE",
25
+ "LICENSE-Blue-Ridge",
26
+ "LICENSE-Screw.Unit",
27
+ "LICENSE-Smoke",
28
+ "README.markdown",
29
+ "Rakefile",
30
+ "VERSION.yml",
31
+ "lib/shenandoah/buildr.rb",
32
+ "lib/shenandoah/buildr/locator.rb",
33
+ "lib/shenandoah/buildr/shenandoah_tasks.rb",
34
+ "lib/shenandoah/buildr/test_framework.rb",
35
+ "lib/shenandoah/css/screw.css",
36
+ "lib/shenandoah/javascript/browser/runner.js",
37
+ "lib/shenandoah/javascript/common/jquery-1.3.2.js",
38
+ "lib/shenandoah/javascript/common/jquery.fn.js",
39
+ "lib/shenandoah/javascript/common/jquery.print.js",
40
+ "lib/shenandoah/javascript/common/screw.behaviors.js",
41
+ "lib/shenandoah/javascript/common/screw.builder.js",
42
+ "lib/shenandoah/javascript/common/screw.events.js",
43
+ "lib/shenandoah/javascript/common/screw.matchers.js",
44
+ "lib/shenandoah/javascript/common/screw.mocking.js",
45
+ "lib/shenandoah/javascript/common/smoke.core.js",
46
+ "lib/shenandoah/javascript/common/smoke.mock.js",
47
+ "lib/shenandoah/javascript/common/smoke.stub.js",
48
+ "lib/shenandoah/javascript/console/consoleReportForRake.js",
49
+ "lib/shenandoah/javascript/console/env.rhino.js",
50
+ "lib/shenandoah/javascript/console/js.jar",
51
+ "lib/shenandoah/javascript/console/runner.js",
52
+ "lib/shenandoah/javascript/console/shell.js.erb",
53
+ "lib/shenandoah/locator.rb",
54
+ "lib/shenandoah/rails/locator.rb",
55
+ "lib/shenandoah/rails/tasks.rb",
56
+ "lib/shenandoah/runner.rb",
57
+ "lib/shenandoah/server.rb",
58
+ "lib/shenandoah/server/views/index.haml",
59
+ "lib/shenandoah/tasks.rb",
60
+ "rails_generators/shen_spec/shen_spec_generator.rb",
61
+ "rails_generators/shen_spec/templates/fixture.html.erb",
62
+ "rails_generators/shen_spec/templates/javascript_spec.js.erb",
63
+ "rails_generators/shenandoah/shenandoah_generator.rb",
64
+ "rails_generators/shenandoah/templates/application.html",
65
+ "rails_generators/shenandoah/templates/application_spec.js",
66
+ "rails_generators/shenandoah/templates/shenandoah.rake",
67
+ "rails_generators/shenandoah/templates/spec_helper.js",
68
+ "shenandoah.gemspec",
69
+ "spec/rails_generators/shen_spec_generator_spec.rb",
70
+ "spec/rails_generators/shenandoah_generator_spec.rb",
71
+ "spec/rails_generators/spec_helper.rb",
72
+ "spec/shenandoah/buildr/locator_spec.rb",
73
+ "spec/shenandoah/buildr/shenandoah_tasks_spec.rb",
74
+ "spec/shenandoah/buildr/spec_helper.rb",
75
+ "spec/shenandoah/buildr/test_framework_spec.rb",
76
+ "spec/shenandoah/locator_spec.rb",
77
+ "spec/shenandoah/rails/locator_spec.rb",
78
+ "spec/shenandoah/rails/tasks_spec.rb",
79
+ "spec/shenandoah/runner_spec.rb",
80
+ "spec/shenandoah/server_spec.rb",
81
+ "spec/shenandoah/tasks_spec.rb",
82
+ "spec/spec_helper.rb"
83
+ ]
84
+ s.homepage = %q{http://github.com/rsutphin/shenandoah}
85
+ s.rdoc_options = ["--charset=UTF-8"]
86
+ s.require_paths = ["lib"]
87
+ s.rubyforge_project = %q{detailedbalance}
88
+ s.rubygems_version = %q{1.3.4}
89
+ s.summary = %q{A javascript test framework for buildr, rails, and other ruby-built projects}
90
+ s.test_files = [
91
+ "spec/rails_generators/shen_spec_generator_spec.rb",
92
+ "spec/rails_generators/shenandoah_generator_spec.rb",
93
+ "spec/rails_generators/spec_helper.rb",
94
+ "spec/shenandoah/buildr/locator_spec.rb",
95
+ "spec/shenandoah/buildr/shenandoah_tasks_spec.rb",
96
+ "spec/shenandoah/buildr/spec_helper.rb",
97
+ "spec/shenandoah/buildr/test_framework_spec.rb",
98
+ "spec/shenandoah/locator_spec.rb",
99
+ "spec/shenandoah/rails/locator_spec.rb",
100
+ "spec/shenandoah/rails/tasks_spec.rb",
101
+ "spec/shenandoah/runner_spec.rb",
102
+ "spec/shenandoah/server_spec.rb",
103
+ "spec/shenandoah/tasks_spec.rb",
104
+ "spec/spec_helper.rb"
105
+ ]
106
+
107
+ if s.respond_to? :specification_version then
108
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
109
+ s.specification_version = 3
110
+
111
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
112
+ s.add_runtime_dependency(%q<sinatra>, [">= 0.9.2"])
113
+ s.add_runtime_dependency(%q<haml>, [">= 2.0.9"])
114
+ s.add_runtime_dependency(%q<rake>, [">= 0"])
115
+ s.add_runtime_dependency(%q<rails>, [">= 2.1.0"])
116
+ s.add_development_dependency(%q<rspec>, ["= 1.2.4"])
117
+ s.add_development_dependency(%q<rack-test>, [">= 0.3.0"])
118
+ s.add_development_dependency(%q<rspec_hpricot_matchers>, [">= 1.0.0"])
119
+ s.add_development_dependency(%q<braid>, [">= 0.5.0"])
120
+ s.add_development_dependency(%q<rake>, ["= 0.8.4"])
121
+ s.add_development_dependency(%q<net-ssh>, ["= 2.0.11"])
122
+ s.add_development_dependency(%q<net-sftp>, ["= 2.0.2"])
123
+ s.add_development_dependency(%q<highline>, ["= 1.5.0"])
124
+ s.add_development_dependency(%q<hoe>, ["= 1.12.2"])
125
+ else
126
+ s.add_dependency(%q<sinatra>, [">= 0.9.2"])
127
+ s.add_dependency(%q<haml>, [">= 2.0.9"])
128
+ s.add_dependency(%q<rake>, [">= 0"])
129
+ s.add_dependency(%q<rails>, [">= 2.1.0"])
130
+ s.add_dependency(%q<rspec>, ["= 1.2.4"])
131
+ s.add_dependency(%q<rack-test>, [">= 0.3.0"])
132
+ s.add_dependency(%q<rspec_hpricot_matchers>, [">= 1.0.0"])
133
+ s.add_dependency(%q<braid>, [">= 0.5.0"])
134
+ s.add_dependency(%q<rake>, ["= 0.8.4"])
135
+ s.add_dependency(%q<net-ssh>, ["= 2.0.11"])
136
+ s.add_dependency(%q<net-sftp>, ["= 2.0.2"])
137
+ s.add_dependency(%q<highline>, ["= 1.5.0"])
138
+ s.add_dependency(%q<hoe>, ["= 1.12.2"])
139
+ end
140
+ else
141
+ s.add_dependency(%q<sinatra>, [">= 0.9.2"])
142
+ s.add_dependency(%q<haml>, [">= 2.0.9"])
143
+ s.add_dependency(%q<rake>, [">= 0"])
144
+ s.add_dependency(%q<rails>, [">= 2.1.0"])
145
+ s.add_dependency(%q<rspec>, ["= 1.2.4"])
146
+ s.add_dependency(%q<rack-test>, [">= 0.3.0"])
147
+ s.add_dependency(%q<rspec_hpricot_matchers>, [">= 1.0.0"])
148
+ s.add_dependency(%q<braid>, [">= 0.5.0"])
149
+ s.add_dependency(%q<rake>, ["= 0.8.4"])
150
+ s.add_dependency(%q<net-ssh>, ["= 2.0.11"])
151
+ s.add_dependency(%q<net-sftp>, ["= 2.0.2"])
152
+ s.add_dependency(%q<highline>, ["= 1.5.0"])
153
+ s.add_dependency(%q<hoe>, ["= 1.12.2"])
154
+ end
155
+ end
@@ -0,0 +1,81 @@
1
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
2
+
3
+ require 'rails_generator/scripts/generate'
4
+
5
+ describe "shen_spec generator" do
6
+ include Shenandoah::Spec::RailsRoot
7
+ include Shenandoah::Spec::UseGenerators
8
+
9
+ def generate(name='common')
10
+ Rails::Generator::Scripts::Generate.new.run(["shen_spec", name, "-q"])
11
+ end
12
+
13
+ describe "generation" do
14
+ %w(spec test examples).each do |dir|
15
+ describe "when the rails project has a #{dir}" do
16
+ before do
17
+ FileUtils.mkdir "#{RAILS_ROOT}/#{dir}"
18
+ generate
19
+ end
20
+
21
+ it "puts the HTML fixture in the right place" do
22
+ File.exist?("#{RAILS_ROOT}/#{dir}/javascript/common.html").should be_true
23
+ end
24
+
25
+ it "puts the JavaScript spec in the right place" do
26
+ File.exist?("#{RAILS_ROOT}/#{dir}/javascript/common_spec.js").should be_true
27
+ end
28
+ end
29
+ end
30
+
31
+ {
32
+ 'common' => ['common', 'Common'],
33
+ 'some_spec' => ['some', 'Some'],
34
+ 'models/hat' => ['models/hat', 'models.Hat'],
35
+ 'models/helicopter_spec' => ['models/helicopter', 'models.Helicopter'],
36
+ 'themes/light/alison' => ['themes/light/alison', 'themes.light.Alison']
37
+ }.each do |input, (expected_filename, expected_classname)|
38
+ describe "for '#{input}'" do
39
+ before do
40
+ generate(input)
41
+ end
42
+
43
+ describe "the HTML" do
44
+ before do
45
+ @html = File.read("#{RAILS_ROOT}/test/javascript/#{expected_filename}.html")
46
+ end
47
+
48
+ it "includes the name in the title" do
49
+ @html.should =~ %r{<title>#{expected_filename}.js | JavaScript Testing Results</title>}
50
+ end
51
+
52
+ it "includes the runner script" do
53
+ @html.should =~ %r{src="/shenandoah/browser-runner.js"}
54
+ end
55
+
56
+ it "includes screw.css" do
57
+ @html.should =~ %r{href="/screw.css"}
58
+ end
59
+ end
60
+
61
+ describe "the JS" do
62
+ before do
63
+ @js = File.read("#{RAILS_ROOT}/test/javascript/#{expected_filename}_spec.js")
64
+ end
65
+
66
+ it "requires the spec_helper" do
67
+ @js.should =~ %r{require_spec\('spec_helper.js'\);}
68
+ end
69
+
70
+ it "requires the presumed main file" do
71
+ @js.should =~ %r{require_main\('#{expected_filename}.js'\);}
72
+ end
73
+
74
+ it "describes the main file" do
75
+ @js.should =~ %r{describe\('#{expected_classname}', function \(\) \{}
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,80 @@
1
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
2
+
3
+ require 'rails_generator/scripts/generate'
4
+
5
+ describe "shenandoah generator" do
6
+ include Shenandoah::Spec::RailsRoot
7
+ include Shenandoah::Spec::UseGenerators
8
+
9
+ def generate
10
+ Rails::Generator::Scripts::Generate.new.run(["shenandoah", "-q"])
11
+ end
12
+
13
+ describe "generation" do
14
+ describe "of lib/tasks/shenandoh.rake" do
15
+ before do
16
+ generate
17
+ @path = "#{RAILS_ROOT}/lib/tasks/shenandoah.rake"
18
+ end
19
+
20
+ it "happens" do
21
+ File.exist?(@path).should be_true
22
+ end
23
+
24
+ it "has the right content" do
25
+ content = File.read(@path)
26
+ content.should =~ %r{require 'shenandoah/rails/tasks'}
27
+ content.should =~ %r{Shenandoah::Rails::Tasks.new}
28
+ end
29
+ end
30
+
31
+ %w(spec examples test).each do |dir|
32
+ describe "when the project uses '#{dir}'" do
33
+ before do
34
+ FileUtils.mkdir_p "#{RAILS_ROOT}/#{dir}"
35
+ generate
36
+ end
37
+
38
+ it "generates spec_helper" do
39
+ File.exist?("#{RAILS_ROOT}/#{dir}/javascript/spec_helper.js").should be_true
40
+ end
41
+
42
+ describe "creation of application_spec.js" do
43
+ before do
44
+ @path = "#{RAILS_ROOT}/#{dir}/javascript/application_spec.js"
45
+ end
46
+
47
+ it "happens" do
48
+ File.exist?(@path).should be_true
49
+ end
50
+
51
+ it "requires spec_helper" do
52
+ File.read(@path).should =~ %r{require_spec\('spec_helper.js'\)}
53
+ end
54
+
55
+ it "requires application.js" do
56
+ File.read(@path).should =~ %r{require_main\('application.js'\)}
57
+ end
58
+ end
59
+
60
+ describe "creation of application.html" do
61
+ before do
62
+ @path = "#{RAILS_ROOT}/#{dir}/javascript/application.html"
63
+ end
64
+
65
+ it "happens" do
66
+ File.exist?(@path).should be_true
67
+ end
68
+
69
+ it "links to shenandoah's runner" do
70
+ File.read(@path).should =~ %r{src="/shenandoah/browser-runner.js"}
71
+ end
72
+
73
+ it "links to the served screw.css" do
74
+ File.read(@path).should =~ %r{href="/screw.css"}
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,21 @@
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
+
3
+ require 'rails_generator'
4
+ require 'rails_generator/lookup'
5
+
6
+ module Shenandoah::Spec
7
+ module UseGenerators
8
+ def self.included(klass)
9
+ klass.class_eval do
10
+ before do
11
+ Rails::Generator::Base.sources.unshift(
12
+ Rails::Generator::PathSource.new("local", File.dirname(__FILE__) + "/../../rails_generators"))
13
+ end
14
+
15
+ after do
16
+ Rails::Generator::Base.sources.shift
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -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