screw-unit 0.3.3 → 0.5.1
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/CHANGES +10 -0
- data/Rakefile +27 -25
- data/VERSION.yml +4 -0
- data/bin/screw_unit_server +14 -4
- data/core/EXAMPLE.html +1 -1
- data/core/example/spec/suite.html +1 -1
- data/core/lib/jquery-1.3.2.js +4376 -0
- data/core/lib/jquery.fn.js +2 -1
- data/core/lib/screw.behaviors.js +8 -7
- data/core/lib/screw.builder.js +34 -19
- data/core/lib/screw.css +1 -1
- data/core/lib/screw.events.js +5 -5
- data/core/lib/screw.matchers.js +59 -2
- data/core/spec/suite.html +2 -1
- data/core/spec/with_screw_context_spec.js +9 -0
- data/lib/screw_unit.rb +13 -16
- data/lib/screw_unit/representations.rb +2 -0
- data/lib/screw_unit/{resources/spec.rb → representations/spec.html.rb} +55 -39
- data/spec/functional/functional_spec.rb +1 -1
- data/spec/functional/functional_spec_helper.rb +21 -33
- data/spec/functional/functional_spec_server_starter.rb +68 -0
- data/spec/unit/js_test_core/specs/spec_file_spec.rb +52 -18
- data/spec/unit/unit_spec_helper.rb +24 -91
- data/vendor/js-test-core/CHANGES +8 -0
- data/vendor/js-test-core/Rakefile +1 -0
- data/vendor/js-test-core/lib/js_test_core.rb +22 -14
- data/vendor/js-test-core/lib/js_test_core/app.rb +12 -0
- data/vendor/js-test-core/lib/js_test_core/client.rb +21 -9
- data/vendor/js-test-core/lib/js_test_core/configuration.rb +35 -0
- data/vendor/js-test-core/lib/js_test_core/extensions.rb +1 -1
- data/vendor/js-test-core/lib/js_test_core/extensions/selenium/client/driver.rb +7 -0
- data/vendor/js-test-core/lib/js_test_core/models.rb +8 -0
- data/vendor/js-test-core/lib/js_test_core/models/selenium_session.rb +80 -0
- data/vendor/js-test-core/lib/js_test_core/representations.rb +11 -0
- data/vendor/js-test-core/lib/js_test_core/representations/dir.html.rb +24 -0
- data/vendor/js-test-core/lib/js_test_core/representations/not_found.html.rb +15 -0
- data/vendor/js-test-core/lib/js_test_core/representations/page.html.rb +41 -0
- data/vendor/js-test-core/lib/js_test_core/representations/spec.html.rb +24 -0
- data/vendor/js-test-core/lib/js_test_core/resources.rb +13 -7
- data/vendor/js-test-core/lib/js_test_core/resources/core_file.rb +19 -0
- data/vendor/js-test-core/lib/js_test_core/resources/file.rb +42 -20
- data/vendor/js-test-core/lib/js_test_core/resources/implementations_deprecation.rb +12 -0
- data/vendor/js-test-core/lib/js_test_core/resources/not_found.rb +35 -0
- data/vendor/js-test-core/lib/js_test_core/resources/resource.rb +16 -0
- data/vendor/js-test-core/lib/js_test_core/resources/selenium_session.rb +104 -0
- data/vendor/js-test-core/lib/js_test_core/resources/spec_file.rb +63 -0
- data/vendor/js-test-core/lib/js_test_core/resources/web_root.rb +5 -60
- data/vendor/js-test-core/{vendor/thin-rest/README → spec/example_core/subdir/SubDirFile.js} +0 -0
- data/vendor/js-test-core/spec/example_specs/custom_dir_and_suite/passing_spec.js +6 -0
- data/vendor/js-test-core/spec/example_specs/custom_suite.html +8 -0
- data/vendor/js-test-core/spec/example_specs/foo/failing_spec.js +1 -1
- data/vendor/js-test-core/spec/example_specs/foo/passing_spec.js +1 -1
- data/vendor/js-test-core/spec/spec_helpers/be_http.rb +32 -0
- data/vendor/js-test-core/spec/spec_helpers/example_group.rb +36 -0
- data/vendor/js-test-core/spec/spec_helpers/fake_selenium_driver.rb +27 -0
- data/vendor/js-test-core/spec/spec_helpers/show_test_exceptions.rb +22 -0
- data/vendor/js-test-core/spec/unit/js_test_core/client_spec.rb +35 -10
- data/vendor/js-test-core/spec/unit/js_test_core/configuration_spec.rb +44 -0
- data/vendor/js-test-core/spec/unit/js_test_core/models/selenium_session_spec.rb +85 -0
- data/vendor/js-test-core/spec/unit/js_test_core/resources/core_file_spec.rb +60 -0
- data/vendor/js-test-core/spec/unit/js_test_core/resources/file_spec.rb +54 -63
- data/vendor/js-test-core/spec/unit/js_test_core/resources/implementations_deprecation_spec.rb +18 -0
- data/vendor/js-test-core/spec/unit/js_test_core/resources/not_found_spec.rb +51 -0
- data/vendor/js-test-core/spec/unit/js_test_core/resources/selenium_session_spec.rb +362 -0
- data/vendor/js-test-core/spec/unit/js_test_core/resources/spec_file_spec.rb +120 -0
- data/vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb +15 -19
- data/vendor/js-test-core/spec/unit/unit_spec_helper.rb +16 -149
- data/vendor/js-test-core/vendor/lucky-luciano/README.markdown +7 -0
- data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano.rb +4 -0
- data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano/resource.rb +135 -0
- data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano/rspec.rb +4 -0
- data/vendor/js-test-core/vendor/lucky-luciano/lib/lucky_luciano/rspec/be_http.rb +32 -0
- data/vendor/js-test-core/vendor/lucky-luciano/spec/lucky_luciano/resource_spec.rb +231 -0
- data/vendor/js-test-core/vendor/lucky-luciano/spec/spec_helper.rb +48 -0
- data/vendor/js-test-core/vendor/{thin-rest → lucky-luciano}/spec/spec_suite.rb +1 -2
- metadata +134 -145
- data/core/lib/jquery-1.2.6.js +0 -3549
- data/lib/screw_unit/resources.rb +0 -2
- data/spec/unit/js_test_core/specs/spec_dir_spec.rb +0 -38
- data/vendor/js-test-core/lib/js_test_core/rack.rb +0 -2
- data/vendor/js-test-core/lib/js_test_core/rack/commonlogger.rb +0 -5
- data/vendor/js-test-core/lib/js_test_core/rails_server.rb +0 -22
- data/vendor/js-test-core/lib/js_test_core/resources/dir.rb +0 -67
- data/vendor/js-test-core/lib/js_test_core/resources/file_not_found.rb +0 -11
- data/vendor/js-test-core/lib/js_test_core/resources/runner.rb +0 -107
- data/vendor/js-test-core/lib/js_test_core/resources/session.rb +0 -44
- data/vendor/js-test-core/lib/js_test_core/resources/session_finish.rb +0 -17
- data/vendor/js-test-core/lib/js_test_core/resources/specs/spec_dir.rb +0 -46
- data/vendor/js-test-core/lib/js_test_core/resources/specs/spec_file.rb +0 -17
- data/vendor/js-test-core/lib/js_test_core/selenium.rb +0 -2
- data/vendor/js-test-core/lib/js_test_core/selenium/selenium_driver.rb +0 -5
- data/vendor/js-test-core/lib/js_test_core/server.rb +0 -50
- data/vendor/js-test-core/lib/js_test_core/thin.rb +0 -3
- data/vendor/js-test-core/lib/js_test_core/thin/backends/js_test_core_server.rb +0 -9
- data/vendor/js-test-core/lib/js_test_core/thin/js_test_core_connection.rb +0 -8
- data/vendor/js-test-core/spec/unit/js_test_core/rails_server_spec.rb +0 -45
- data/vendor/js-test-core/spec/unit/js_test_core/resources/dir_spec.rb +0 -52
- data/vendor/js-test-core/spec/unit/js_test_core/resources/file_not_found_spec.rb +0 -16
- data/vendor/js-test-core/spec/unit/js_test_core/resources/runners/runner_spec.rb +0 -303
- data/vendor/js-test-core/spec/unit/js_test_core/resources/session_finish_spec.rb +0 -79
- data/vendor/js-test-core/spec/unit/js_test_core/resources/session_spec.rb +0 -82
- data/vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_dir_spec.rb +0 -105
- data/vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_file_spec.rb +0 -42
- data/vendor/js-test-core/spec/unit/js_test_core/server_spec.rb +0 -117
- data/vendor/js-test-core/spec/unit/thin/js_test_core_connection_spec.rb +0 -6
- data/vendor/js-test-core/vendor/thin-rest/CHANGES +0 -2
- data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest.rb +0 -9
- data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/connection.rb +0 -116
- data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/extensions.rb +0 -3
- data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/extensions/object.rb +0 -21
- data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/resource.rb +0 -108
- data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/resource_invalid.rb +0 -4
- data/vendor/js-test-core/vendor/thin-rest/lib/thin_rest/routing_error.rb +0 -5
- data/vendor/js-test-core/vendor/thin-rest/spec/thin_rest/connection_spec.rb +0 -207
- data/vendor/js-test-core/vendor/thin-rest/spec/thin_rest/resource_spec.rb +0 -127
- data/vendor/js-test-core/vendor/thin-rest/spec/thin_rest_spec_helper.rb +0 -124
@@ -20,6 +20,6 @@ describe "ScrewUnit" do
|
|
20
20
|
it "runs a full failing Suite" do
|
21
21
|
ScrewUnit::Client.run(:spec_url => "#{root_url}/specs/foo/failing_spec")
|
22
22
|
stdout.string.strip.should include("FAILURE")
|
23
|
-
stdout.string.strip.should include("expected true to equal false")
|
23
|
+
stdout.string.strip.should include("A failing spec in foo fails: expected true to equal false")
|
24
24
|
end
|
25
25
|
end
|
@@ -1,55 +1,43 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "spec"
|
3
|
-
|
3
|
+
require "spec/autorun"
|
4
|
+
require "selenium_rc"
|
5
|
+
require "thin"
|
4
6
|
dir = File.dirname(__FILE__)
|
5
|
-
|
6
|
-
require "
|
7
|
-
require "
|
8
|
-
require "
|
7
|
+
LIBRARY_ROOT_DIR = File.expand_path("#{dir}/../..")
|
8
|
+
require "#{LIBRARY_ROOT_DIR}/vendor/js-test-core/spec/spec_helpers/be_http"
|
9
|
+
require "#{LIBRARY_ROOT_DIR}/vendor/js-test-core/spec/spec_helpers/show_test_exceptions"
|
10
|
+
require "#{dir}/functional_spec_server_starter"
|
11
|
+
ARGV.push("-b")
|
9
12
|
|
10
13
|
Spec::Runner.configure do |config|
|
11
14
|
config.mock_with :rr
|
12
15
|
end
|
13
16
|
|
14
|
-
|
15
|
-
|
17
|
+
Sinatra::Application.use ShowTestExceptions
|
18
|
+
Sinatra::Application.set :raise_errors, true
|
19
|
+
|
20
|
+
Sinatra::Application.use(ScrewUnit::App)
|
16
21
|
|
17
|
-
module WaitFor
|
18
|
-
extend self
|
19
|
-
def wait_for(time=5)
|
20
|
-
Timeout.timeout(time) do
|
21
|
-
loop do
|
22
|
-
value = yield
|
23
|
-
return value if value
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
22
|
|
29
23
|
class Spec::ExampleGroup
|
30
24
|
include WaitFor
|
31
|
-
attr_reader :spec_root_path, :
|
25
|
+
attr_reader :spec_root_path, :public_path
|
26
|
+
|
32
27
|
before(:all) do
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
dir = File.dirname(__FILE__)
|
38
|
-
@spec_root_path = "#{dir}/../example_specs"
|
39
|
-
@public_path = "#{dir}/../example_public"
|
40
|
-
@implementation_root_path = "#{public_path}/javascripts"
|
41
|
-
unless $screw_unit_server_started
|
28
|
+
@spec_root_path = FunctionalSpecServerStarter.spec_root_path
|
29
|
+
@public_path = FunctionalSpecServerStarter.public_path
|
30
|
+
unless SeleniumRC::Server.service_is_running?
|
42
31
|
Thread.start do
|
43
|
-
|
32
|
+
SeleniumRC::Server.boot
|
44
33
|
end
|
45
|
-
$screw_unit_server_started = true
|
46
|
-
end
|
47
|
-
wait_for do
|
48
|
-
Lsof.running?(8080)
|
49
34
|
end
|
35
|
+
FunctionalSpecServerStarter.call
|
36
|
+
TCPSocket.wait_for_service :host => "0.0.0.0", :port => "4444"
|
50
37
|
end
|
51
38
|
|
52
39
|
def root_url
|
53
40
|
"http://#{ScrewUnit::DEFAULT_HOST}:#{ScrewUnit::DEFAULT_PORT}"
|
54
41
|
end
|
55
42
|
end
|
43
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "timeout"
|
3
|
+
require "lsof"
|
4
|
+
dir = File.dirname(__FILE__)
|
5
|
+
$LOAD_PATH.unshift "#{dir}/../../lib"
|
6
|
+
require "screw_unit"
|
7
|
+
require "nokogiri"
|
8
|
+
|
9
|
+
module WaitFor
|
10
|
+
extend self
|
11
|
+
def wait_for(time=5)
|
12
|
+
Timeout.timeout(time) do
|
13
|
+
loop do
|
14
|
+
value = yield
|
15
|
+
return value if value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class FunctionalSpecServerStarter
|
22
|
+
class << self
|
23
|
+
include WaitFor
|
24
|
+
def call(threaded=true)
|
25
|
+
return if $screw_unit_server_started
|
26
|
+
|
27
|
+
Lsof.kill(8080)
|
28
|
+
wait_for do
|
29
|
+
!Lsof.running?(8080)
|
30
|
+
end
|
31
|
+
|
32
|
+
dir = File.dirname(__FILE__)
|
33
|
+
Dir.chdir("#{dir}/../../") do
|
34
|
+
Thread.start do
|
35
|
+
start_thin_server
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
wait_for do
|
40
|
+
Lsof.running?(8080)
|
41
|
+
end
|
42
|
+
$screw_unit_server_started = true
|
43
|
+
end
|
44
|
+
|
45
|
+
def start_thin_server
|
46
|
+
system("bin/screw_unit_server #{spec_root_path} #{public_path}")
|
47
|
+
at_exit do
|
48
|
+
Lsof.kill(8080)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def spec_root_path
|
53
|
+
File.expand_path("#{dir}/../example_specs")
|
54
|
+
end
|
55
|
+
|
56
|
+
def public_path
|
57
|
+
File.expand_path("#{dir}/../example_public")
|
58
|
+
end
|
59
|
+
|
60
|
+
def dir
|
61
|
+
dir = File.dirname(__FILE__)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
if $0 == __FILE__
|
67
|
+
FunctionalSpecServerStarter.call(false)
|
68
|
+
end
|
@@ -4,28 +4,62 @@ module JsTestCore
|
|
4
4
|
module Resources
|
5
5
|
module Specs
|
6
6
|
describe SpecFile do
|
7
|
-
describe "
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
describe "File" do
|
8
|
+
describe "GET /specs/failing_spec" do
|
9
|
+
attr_reader :html, :doc
|
10
|
+
before do
|
11
|
+
response = get(SpecFile.path("/failing_spec"))
|
12
|
+
response.should be_http(
|
13
|
+
200,
|
14
|
+
{},
|
15
|
+
""
|
16
|
+
)
|
17
|
+
|
18
|
+
@doc = Nokogiri::HTML(response.body)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns script tags for the test javascript file" do
|
22
|
+
doc.at("script[@src='/specs/failing_spec.js']").should_not be_nil
|
13
23
|
end
|
14
|
-
|
15
|
-
connection.receive_data("GET /specs/failing_spec HTTP/1.1\r\nHost: _\r\n\r\n")
|
16
|
-
@doc = Hpricot(html)
|
17
|
-
end
|
18
24
|
|
19
|
-
|
20
|
-
|
25
|
+
it "returns the screw unit template" do
|
26
|
+
doc.at("link[@href='/core/screw.css']").should_not be_nil
|
27
|
+
doc.at("script[@src='/core/screw.builder.js']").should_not be_nil
|
28
|
+
doc.at("script[@src='/core/screw.events.js']").should_not be_nil
|
29
|
+
doc.at("script[@src='/core/screw.behaviors.js']").should_not be_nil
|
30
|
+
doc.at("body/#screw_unit_content").should_not be_nil
|
31
|
+
end
|
21
32
|
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "Directory" do
|
36
|
+
describe "GET /specs" do
|
37
|
+
attr_reader :dir, :html, :doc
|
22
38
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
39
|
+
before do
|
40
|
+
response = get(SpecFile.path("/"))
|
41
|
+
response.should be_http(
|
42
|
+
200,
|
43
|
+
{},
|
44
|
+
""
|
45
|
+
)
|
46
|
+
|
47
|
+
@doc = Nokogiri::HTML(response.body)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "returns script tags for each test javascript file" do
|
51
|
+
doc.at("script[@src='/specs/failing_spec.js']").should_not be_nil
|
52
|
+
doc.at("script[@src='/specs/foo/failing_spec.js']").should_not be_nil
|
53
|
+
doc.at("script[@src='/specs/foo/passing_spec.js']").should_not be_nil
|
54
|
+
end
|
55
|
+
|
56
|
+
it "returns the screw unit template" do
|
57
|
+
doc.at("link[@href='/core/screw.css']").should_not be_nil
|
58
|
+
doc.at("script[@src='/core/screw.builder.js']").should_not be_nil
|
59
|
+
doc.at("script[@src='/core/screw.events.js']").should_not be_nil
|
60
|
+
doc.at("script[@src='/core/screw.behaviors.js']").should_not be_nil
|
61
|
+
doc.at("body/#screw_unit_content").should_not be_nil
|
62
|
+
end
|
29
63
|
end
|
30
64
|
end
|
31
65
|
end
|
@@ -1,118 +1,51 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "spec"
|
3
|
-
|
3
|
+
require "spec/autorun"
|
4
|
+
require "rack/test"
|
5
|
+
ARGV.push("-b")
|
4
6
|
|
5
|
-
|
7
|
+
dir = File.dirname(__FILE__)
|
8
|
+
LIBRARY_ROOT_DIR = File.expand_path("#{dir}/../..")
|
9
|
+
$LOAD_PATH.unshift File.expand_path("#{LIBRARY_ROOT_DIR}/lib")
|
6
10
|
require "screw_unit"
|
7
|
-
require "
|
11
|
+
require "nokogiri"
|
8
12
|
require "guid"
|
13
|
+
require "#{LIBRARY_ROOT_DIR}/vendor/js-test-core/spec/spec_helpers/be_http"
|
14
|
+
require "#{LIBRARY_ROOT_DIR}/vendor/js-test-core/spec/spec_helpers/show_test_exceptions"
|
9
15
|
|
10
16
|
Spec::Runner.configure do |config|
|
11
17
|
config.mock_with :rr
|
12
18
|
end
|
13
19
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
!@actual.nil?
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
20
|
+
Sinatra::Application.use ShowTestExceptions
|
21
|
+
Sinatra::Application.set :raise_errors, true
|
22
|
+
Sinatra::Application.set :show_exceptions, false
|
23
|
+
JsTestCore::App.set :raise_errors, true
|
24
|
+
JsTestCore::App.set :show_exceptions, false
|
24
25
|
|
25
|
-
|
26
|
-
class << self
|
27
|
-
def thin_logging
|
28
|
-
@thin_logging = true if @thin_logging.nil?
|
29
|
-
@thin_logging
|
30
|
-
end
|
31
|
-
|
32
|
-
attr_writer :thin_logging
|
33
|
-
end
|
26
|
+
Sinatra::Application.use(ScrewUnit::App)
|
34
27
|
|
35
|
-
|
28
|
+
class Spec::ExampleGroup
|
29
|
+
include Rack::Test::Methods
|
30
|
+
include BeHttp
|
31
|
+
|
32
|
+
attr_reader :spec_root_path, :public_path, :server, :connection
|
36
33
|
before(:all) do
|
37
34
|
dir = File.dirname(__FILE__)
|
38
35
|
@spec_root_path = File.expand_path("#{dir}/../example_specs")
|
39
|
-
@implementation_root_path = File.expand_path("#{dir}/../example_public/javascripts")
|
40
36
|
@public_path = File.expand_path("#{dir}/../example_public")
|
41
37
|
end
|
42
38
|
|
43
39
|
before(:each) do
|
44
|
-
JsTestCore::
|
45
|
-
|
46
|
-
raise "You need to mock calls to EventMachine.run or the process will hang"
|
47
|
-
end
|
48
|
-
stub(EventMachine).start_server do
|
49
|
-
raise "You need to mock calls to EventMachine.start_server or the process will hang"
|
50
|
-
end
|
51
|
-
stub(EventMachine).send_data do
|
52
|
-
raise "Calls to EventMachine.send_data must be mocked or stubbed"
|
53
|
-
end
|
54
|
-
@connection = Thin::JsTestCoreConnection.new(Guid.new)
|
55
|
-
stub(EventMachine).send_data {raise "EventMachine.send_data must be handled"}
|
56
|
-
stub(EventMachine).close_connection {raise "EventMachine.close_connection must be handled"}
|
57
|
-
@server = JsTestCore::Server.instance
|
58
|
-
Thin::Logging.silent = !self.class.thin_logging
|
59
|
-
Thin::Logging.debug = self.class.thin_logging
|
60
|
-
end
|
61
|
-
|
62
|
-
after(:each) do
|
63
|
-
Thin::Logging.silent = true
|
64
|
-
Thin::Logging.debug = false
|
65
|
-
end
|
66
|
-
|
67
|
-
def get(url, params={})
|
68
|
-
request(:get, url, params)
|
69
|
-
end
|
70
|
-
|
71
|
-
def post(url, params={})
|
72
|
-
request(:post, url, params)
|
40
|
+
JsTestCore::Configuration.instance.spec_root_path = spec_root_path
|
41
|
+
JsTestCore::Configuration.instance.public_path = public_path
|
73
42
|
end
|
74
43
|
|
75
|
-
def
|
76
|
-
|
44
|
+
def app
|
45
|
+
Sinatra::Application
|
77
46
|
end
|
78
47
|
|
79
|
-
def delete(url, params={})
|
80
|
-
request(:delete, url, params)
|
81
|
-
end
|
82
|
-
|
83
|
-
def env_for(method, url, params)
|
84
|
-
Rack::MockRequest.env_for(url, params.merge({:method => method.to_s.upcase, 'js_test_core.connection' => connection}))
|
85
|
-
end
|
86
|
-
|
87
|
-
def create_request(method, url, params={})
|
88
|
-
env = env_for(method, url, params)
|
89
|
-
server.call(env)[2]
|
90
|
-
end
|
91
|
-
alias_method :request, :create_request
|
92
|
-
|
93
48
|
def core_path
|
94
49
|
JsTestCore::Server.core_path
|
95
50
|
end
|
96
|
-
|
97
|
-
def spec_file(relative_path)
|
98
|
-
absolute_path = spec_root_path + relative_path
|
99
|
-
JsTestCore::Resources::File.new(absolute_path, "/specs#{relative_path}")
|
100
|
-
end
|
101
|
-
|
102
|
-
def spec_dir(relative_path="")
|
103
|
-
absolute_path = spec_root_path + relative_path
|
104
|
-
JsTestCore::Resources::SpecDir.new(absolute_path, "/specs#{relative_path}")
|
105
|
-
end
|
106
|
-
|
107
|
-
def contain_spec_file_with_correct_paths(path_relative_to_spec_root)
|
108
|
-
expected_absolute_path = spec_root_path + path_relative_to_spec_root
|
109
|
-
expected_relative_path = "/specs" + path_relative_to_spec_root
|
110
|
-
|
111
|
-
::Spec::Matchers::SimpleMatcher.new(expected_relative_path) do |globbed_files|
|
112
|
-
file = globbed_files.find do |file|
|
113
|
-
file.absolute_path == expected_absolute_path
|
114
|
-
end
|
115
|
-
file && file.relative_path == expected_relative_path
|
116
|
-
end
|
117
|
-
end
|
118
51
|
end
|
data/vendor/js-test-core/CHANGES
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
- No longer using the /implementanions directory. Replace all cases of /implementations with /javascripts.
|
2
|
+
- Added support for custom suite files
|
3
|
+
- Added dependency on Erector
|
4
|
+
- Better error messages
|
5
|
+
- Changed dependency from Selenium to selenium-client
|
6
|
+
- Renamed Resources::Runner to Resources::SeleniumSession
|
7
|
+
- Changed /runners to /selenium_sessions
|
8
|
+
|
1
9
|
0.2.0
|
2
10
|
- Renamed Suite to Session to follow Selenium conventions
|
3
11
|
- Renamed SuiteFinish to SessionFinish to follow Selenium conventions
|
@@ -1,38 +1,46 @@
|
|
1
1
|
require "rubygems"
|
2
|
-
gem "thin", ">=
|
2
|
+
gem "thin", ">=1.2.1"
|
3
|
+
gem "erector", ">=0.6.6"
|
4
|
+
gem "selenium-client"
|
3
5
|
|
4
6
|
dir = File.dirname(__FILE__)
|
5
|
-
$LOAD_PATH.unshift File.expand_path("#{dir}/../vendor/
|
6
|
-
require "
|
7
|
-
|
8
|
-
# This causes errors to be printed to STDOUT.
|
9
|
-
Thin::Logging.silent = false
|
10
|
-
Thin::Logging.debug = true
|
7
|
+
$LOAD_PATH.unshift File.expand_path("#{dir}/../vendor/lucky-luciano/lib")
|
8
|
+
require "lucky_luciano"
|
11
9
|
|
12
10
|
require "fileutils"
|
13
11
|
require "tmpdir"
|
14
12
|
require "timeout"
|
15
13
|
require "cgi"
|
16
14
|
require "net/http"
|
17
|
-
require "selenium"
|
15
|
+
require "selenium/client"
|
18
16
|
require "optparse"
|
17
|
+
require "erector"
|
18
|
+
|
19
|
+
require "#{dir}/js_test_core/configuration"
|
19
20
|
|
20
21
|
require "#{dir}/js_test_core/extensions"
|
21
|
-
require "#{dir}/js_test_core/
|
22
|
-
require "#{dir}/js_test_core/rack"
|
22
|
+
require "#{dir}/js_test_core/models"
|
23
23
|
require "#{dir}/js_test_core/resources"
|
24
|
-
require "#{dir}/js_test_core/
|
24
|
+
require "#{dir}/js_test_core/representations"
|
25
25
|
|
26
26
|
require "#{dir}/js_test_core/client"
|
27
27
|
require "#{dir}/js_test_core/selenium_server_configuration"
|
28
|
-
|
29
|
-
require "#{dir}/js_test_core/
|
28
|
+
|
29
|
+
require "#{dir}/js_test_core/app"
|
30
30
|
|
31
31
|
module JsTestCore
|
32
32
|
DEFAULT_HOST = "0.0.0.0"
|
33
33
|
DEFAULT_PORT = 8080
|
34
34
|
|
35
35
|
class << self
|
36
|
-
|
36
|
+
Configuration.instance = Configuration.new
|
37
|
+
|
38
|
+
def method_missing(method_name, *args, &block)
|
39
|
+
if Configuration.instance.respond_to?(method_name)
|
40
|
+
Configuration.instance.send(method_name, *args, &block)
|
41
|
+
else
|
42
|
+
super
|
43
|
+
end
|
44
|
+
end
|
37
45
|
end
|
38
46
|
end
|