js_spec 0.0.1 → 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 (41) hide show
  1. data/CHANGES +5 -1
  2. data/Rakefile +3 -3
  3. data/bin/js_spec +10 -0
  4. data/bin/js_spec_server +2 -1
  5. data/core/JSSpec.js +11 -5
  6. data/core/JSSpecExtensions.js +127 -8
  7. data/core/demo.html +8 -1
  8. data/lib/js_spec/rails_server.rb +22 -0
  9. data/lib/js_spec/{dir.rb → resources/dir.rb} +7 -5
  10. data/lib/js_spec/{file.rb → resources/file.rb} +9 -3
  11. data/lib/js_spec/resources/runners/firefox_runner.rb +90 -0
  12. data/lib/js_spec/resources/runners.rb +16 -0
  13. data/lib/js_spec/{spec_dir_runner.rb → resources/spec_dir_runner.rb} +5 -3
  14. data/lib/js_spec/{spec_file_runner.rb → resources/spec_file_runner.rb} +4 -2
  15. data/lib/js_spec/{spec_runner.rb → resources/spec_runner.rb} +3 -1
  16. data/lib/js_spec/resources/suite.rb +24 -0
  17. data/lib/js_spec/resources/suite_finish.rb +20 -0
  18. data/lib/js_spec/resources/web_root.rb +34 -0
  19. data/lib/js_spec/server.rb +16 -6
  20. data/lib/js_spec.rb +16 -7
  21. data/spec/{functional_spec_suite.rb → functional_suite.rb} +2 -2
  22. data/spec/spec_suite.rb +2 -2
  23. data/spec/unit/rails_server_spec.rb +44 -0
  24. data/spec/unit/{dir_spec.rb → resources/dir_spec.rb} +10 -8
  25. data/spec/unit/{file_spec.rb → resources/file_spec.rb} +12 -6
  26. data/spec/unit/resources/runner_spec.rb +24 -0
  27. data/spec/unit/resources/runners/firefox_runner_spec.rb +87 -0
  28. data/spec/unit/{spec_dir_runner_spec.rb → resources/spec_dir_runner_spec.rb} +5 -3
  29. data/spec/unit/resources/spec_file_runner_spec.rb +20 -0
  30. data/spec/unit/resources/suite_finish_spec.rb +42 -0
  31. data/spec/unit/resources/suite_spec.rb +44 -0
  32. data/spec/unit/resources/web_root_spec.rb +55 -0
  33. data/spec/unit/server_spec.rb +75 -14
  34. data/spec/unit/unit_spec_helper.rb +9 -8
  35. data/spec/{unit_spec_suite.rb → unit_suite.rb} +2 -2
  36. metadata +37 -28
  37. data/lib/js_spec/suite_result.rb +0 -11
  38. data/lib/js_spec/web_root.rb +0 -18
  39. data/spec/unit/spec_file_runner_spec.rb +0 -18
  40. data/spec/unit/suite_result_spec.rb +0 -31
  41. data/spec/unit/web_root_spec.rb +0 -39
@@ -23,15 +23,16 @@ module Spec
23
23
  end
24
24
 
25
25
  module Spec::Example::ExampleMethods
26
- attr_reader :spec_root_path, :implementation_root_path, :server
26
+ attr_reader :spec_root_path, :implementation_root_path, :public_path, :server
27
27
  before(:all) do
28
28
  dir = File.dirname(__FILE__)
29
- @spec_root_path = ::File.expand_path("#{dir}/../example_specs")
30
- @implementation_root_path = ::File.expand_path("#{dir}/../example_implementation")
29
+ @spec_root_path = File.expand_path("#{dir}/../example_specs")
30
+ @implementation_root_path = File.expand_path("#{dir}/../example_public/javascripts")
31
+ @public_path = File.expand_path("#{dir}/../example_public")
31
32
  end
32
33
 
33
34
  before(:each) do
34
- JsSpec::Server.instance = JsSpec::Server.new(spec_root_path, implementation_root_path)
35
+ JsSpec::Server.instance = JsSpec::Server.new(spec_root_path, implementation_root_path, public_path)
35
36
  @server = JsSpec::Server.instance
36
37
  end
37
38
 
@@ -61,13 +62,13 @@ module Spec::Example::ExampleMethods
61
62
  end
62
63
 
63
64
  def spec_file(relative_path)
64
- absolute_path = File.expand_path(spec_root_path + relative_path)
65
- JsSpec::File.new(absolute_path, "/specs#{relative_path}")
65
+ absolute_path = spec_root_path + relative_path
66
+ JsSpec::Resources::File.new(absolute_path, "/specs#{relative_path}")
66
67
  end
67
68
 
68
69
  def spec_dir(relative_path="")
69
- absolute_path = File.expand_path(spec_root_path + relative_path)
70
- JsSpec::Dir.new(absolute_path, "/specs#{relative_path}")
70
+ absolute_path = spec_root_path + relative_path
71
+ JsSpec::Resources::Dir.new(absolute_path, "/specs#{relative_path}")
71
72
  end
72
73
 
73
74
  def contain_spec_file_with_correct_paths(path_relative_to_spec_root)
@@ -1,4 +1,4 @@
1
- class JsSpecUnitSuite
1
+ class UnitSuite
2
2
  def run
3
3
  dir = File.dirname(__FILE__)
4
4
  Dir["#{dir}/unit/**/*_spec.rb"].each do |file|
@@ -7,4 +7,4 @@ class JsSpecUnitSuite
7
7
  end
8
8
  end
9
9
 
10
- JsSpecUnitSuite.new.run
10
+ UnitSuite.new.run
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: js_spec
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.1
7
- date: 2007-12-18 00:00:00 -08:00
8
- summary: JsSpec is a server for the JSSpec javascript framework.
6
+ version: 0.1.0
7
+ date: 2008-01-25 00:00:00 -08:00
8
+ summary: The JSSpec client library (http://code.google.com/p/jsspec/) plus a convenient ruby server.
9
9
  require_paths:
10
10
  - lib
11
11
  email: brian@pivotallabs.com
12
12
  homepage: http://pivotallabs.com
13
13
  rubyforge_project: pivotalrb
14
- description: JsSpec is a server for the JSSpec javascript framework.
14
+ description: The JSSpec client library (http://code.google.com/p/jsspec/) plus a convenient ruby server.
15
15
  autorequire: js_spec
16
16
  default_executable:
17
17
  bindir: bin
@@ -29,39 +29,48 @@ post_install_message:
29
29
  authors:
30
30
  - Brian Takita & Nathan Sobo
31
31
  files:
32
- - Rakefile
33
32
  - CHANGES
34
33
  - README
35
- - lib/js_spec/spec_file_runner.rb
36
- - lib/js_spec/spec_runner.rb
37
- - lib/js_spec/dir.rb
38
- - lib/js_spec/spec_dir_runner.rb
39
- - lib/js_spec/web_root.rb
40
- - lib/js_spec/suite_result.rb
41
- - lib/js_spec/file.rb
34
+ - Rakefile
35
+ - lib/js_spec/rails_server.rb
36
+ - lib/js_spec/resources/dir.rb
37
+ - lib/js_spec/resources/suite_finish.rb
38
+ - lib/js_spec/resources/runners.rb
39
+ - lib/js_spec/resources/spec_runner.rb
40
+ - lib/js_spec/resources/spec_dir_runner.rb
41
+ - lib/js_spec/resources/file.rb
42
+ - lib/js_spec/resources/web_root.rb
43
+ - lib/js_spec/resources/runners/firefox_runner.rb
44
+ - lib/js_spec/resources/spec_file_runner.rb
45
+ - lib/js_spec/resources/suite.rb
42
46
  - lib/js_spec/server.rb
43
47
  - lib/js_spec.rb
48
+ - core/COPYING
49
+ - core/JSSpec.css
50
+ - core/demo.html
51
+ - core/exp
44
52
  - core/JSSpec.js
45
53
  - core/diff_match_patch.js
46
54
  - core/JSSpecExtensions.js
47
- - core/exp
48
- - core/JSSpec.css
49
- - core/demo.html
50
- - core/COPYING
55
+ - bin/js_spec
51
56
  - bin/js_spec_server
52
- - spec/spec_suite.rb
53
- - spec/unit_spec_suite.rb
54
- - spec/functional/server_spec.rb
55
- - spec/functional/functional_spec_helper.rb
56
- - spec/functional_spec_suite.rb
57
- - spec/unit/spec_file_runner_spec.rb
58
- - spec/unit/file_spec.rb
59
- - spec/unit/spec_dir_runner_spec.rb
60
- - spec/unit/server_spec.rb
61
- - spec/unit/dir_spec.rb
62
- - spec/unit/web_root_spec.rb
63
- - spec/unit/suite_result_spec.rb
57
+ - spec/unit/resources/dir_spec.rb
58
+ - spec/unit/resources/web_root_spec.rb
59
+ - spec/unit/resources/suite_spec.rb
60
+ - spec/unit/resources/spec_file_runner_spec.rb
61
+ - spec/unit/resources/runner_spec.rb
62
+ - spec/unit/resources/file_spec.rb
63
+ - spec/unit/resources/runners/firefox_runner_spec.rb
64
+ - spec/unit/resources/suite_finish_spec.rb
65
+ - spec/unit/resources/spec_dir_runner_spec.rb
64
66
  - spec/unit/unit_spec_helper.rb
67
+ - spec/unit/rails_server_spec.rb
68
+ - spec/unit/server_spec.rb
69
+ - spec/functional/functional_spec_helper.rb
70
+ - spec/functional/server_spec.rb
71
+ - spec/functional_suite.rb
72
+ - spec/spec_suite.rb
73
+ - spec/unit_suite.rb
65
74
  test_files: []
66
75
 
67
76
  rdoc_options:
@@ -1,11 +0,0 @@
1
- module JsSpec
2
- class SuiteResult
3
- def passed?
4
- false
5
- end
6
-
7
- def post
8
- STDOUT.puts Server.request['text']
9
- end
10
- end
11
- end
@@ -1,18 +0,0 @@
1
- module JsSpec
2
- class WebRoot
3
- def locate(name)
4
- case name
5
- when 'specs'
6
- JsSpec::Dir.new(JsSpec::Server.spec_root_path, "/specs")
7
- when 'core'
8
- JsSpec::Dir.new(JsSpec::Server.core_path, "/core")
9
- when 'implementations'
10
- JsSpec::Dir.new(JsSpec::Server.implementation_root_path, "/implementations")
11
- when 'results'
12
- JsSpec::SuiteResult.new
13
- else
14
- raise "Invalid path: #{name}"
15
- end
16
- end
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- require File.expand_path("#{File.dirname(__FILE__)}/unit_spec_helper")
2
-
3
- module JsSpec
4
- describe SpecFileRunner, "#spec_files" do
5
- attr_reader :absolute_path, :relative_path, :file, :runner
6
-
7
- before do
8
- @absolute_path = "#{spec_root_path}/failing_spec.js"
9
- @relative_path = "/specs/failing_spec.js"
10
- @file = File.new(absolute_path, relative_path)
11
- @runner = SpecFileRunner.new(file)
12
- end
13
-
14
- it "returns the single File to run in an Array" do
15
- runner.spec_files.should == [file]
16
- end
17
- end
18
- end
@@ -1,31 +0,0 @@
1
- require File.expand_path("#{File.dirname(__FILE__)}/unit_spec_helper")
2
-
3
- module JsSpec
4
- describe SuiteResult do
5
- attr_reader :result
6
- before do
7
- @result = SuiteResult.new
8
- end
9
-
10
- describe "#post" do
11
- attr_reader :stdout
12
- before do
13
- @stdout = StringIO.new
14
- SuiteResult.const_set(:STDOUT, stdout)
15
- end
16
- after do
17
- SuiteResult.__send__(:remove_const, :STDOUT)
18
- end
19
-
20
- it "writes the body of the request to stdout" do
21
- body = "The text in the POST body"
22
- request = Rack::Request.new({'rack.input' => StringIO.new("text=#{body}")})
23
- request.body.string.should == "text=#{body}"
24
- stub.proxy(Server).request {request}
25
-
26
- result.post
27
- stdout.string.should == "#{body}\n"
28
- end
29
- end
30
- end
31
- end
@@ -1,39 +0,0 @@
1
- require File.expand_path("#{File.dirname(__FILE__)}/unit_spec_helper")
2
-
3
- module JsSpec
4
- describe WebRoot do
5
- attr_reader :root_dir
6
- before(:each) do
7
- @root_dir = WebRoot.new
8
- end
9
-
10
- describe "#locate" do
11
- it "when passed 'specs', returns a SpecDirRunner representing the specs" do
12
- runner = root_dir.locate('specs')
13
- runner.should == spec_dir
14
- end
15
-
16
- it "when passed 'core', returns a Dir representing the JsSpec core directory" do
17
- runner = root_dir.locate('core')
18
- runner.should == JsSpec::Dir.new(JsSpec::Server.core_path, '/core')
19
- end
20
-
21
- it "when passed 'implementations', returns a Dir representing the javascript implementations directory" do
22
- runner = root_dir.locate('implementations')
23
- runner.should == JsSpec::Dir.new(JsSpec::Server.implementation_root_path, '/implementations')
24
- end
25
-
26
- it "when passed 'results', returns a SuiteResult" do
27
- runner = root_dir.locate('results')
28
- runner.should be_instance_of(JsSpec::SuiteResult)
29
- end
30
-
31
- it "when not passed 'core' or 'specs', raises an error" do
32
- lambda do
33
- root_dir.locate('invalid')
34
- end.should raise_error
35
- end
36
- end
37
- end
38
-
39
- end