pivotal-screw-unit-server 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +3 -0
- data/VERSION.yml +2 -2
- data/vendor/js-test-core/CHANGES +1 -0
- data/vendor/js-test-core/lib/js_test_core/models/selenium_session.rb +1 -1
- data/vendor/js-test-core/lib/js_test_core/representations/spec.html.rb +6 -1
- data/vendor/js-test-core/lib/js_test_core/resources/file.rb +1 -2
- data/vendor/js-test-core/lib/js_test_core/resources/not_found.rb +1 -8
- data/vendor/js-test-core/lib/js_test_core/resources/selenium_session.rb +15 -32
- data/vendor/js-test-core/lib/js_test_core/resources/spec_file.rb +6 -3
- data/vendor/js-test-core/lib/js_test_core/resources/web_root.rb +1 -1
- data/vendor/js-test-core/spec/unit/js_test_core/models/selenium_session_spec.rb +48 -8
- data/vendor/js-test-core/spec/unit/js_test_core/resources/selenium_session_spec.rb +96 -74
- data/vendor/js-test-core/spec/unit/js_test_core/resources/spec_file_spec.rb +24 -0
- data/vendor/js-test-core/spec/unit/unit_spec_helper.rb +2 -1
- metadata +7 -7
data/CHANGES
CHANGED
data/VERSION.yml
CHANGED
data/vendor/js-test-core/CHANGES
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module JsTestCore
|
2
2
|
module Representations
|
3
3
|
class Spec < Page
|
4
|
-
needs :spec_files
|
4
|
+
needs :spec_files, :session_id
|
5
5
|
protected
|
6
6
|
def title_text
|
7
7
|
"Js Test Core Suite"
|
@@ -15,6 +15,11 @@ module JsTestCore
|
|
15
15
|
spec_files.each do |file|
|
16
16
|
script :type => "text/javascript", :src => file
|
17
17
|
end
|
18
|
+
script_to_set_window_session_id
|
19
|
+
end
|
20
|
+
|
21
|
+
def script_to_set_window_session_id
|
22
|
+
script "window._session_id = '#{session_id}';", :type => "text/javascript"
|
18
23
|
end
|
19
24
|
|
20
25
|
def body_content
|
@@ -51,8 +51,7 @@ module JsTestCore
|
|
51
51
|
200,
|
52
52
|
{
|
53
53
|
'Content-Type' => content_type,
|
54
|
-
'Last-Modified' => ::File.mtime(absolute_path).rfc822
|
55
|
-
'Content-Length' => ::File.size(absolute_path)
|
54
|
+
'Last-Modified' => ::File.mtime(absolute_path).rfc822
|
56
55
|
},
|
57
56
|
::File.read(absolute_path)
|
58
57
|
]
|
@@ -21,14 +21,7 @@ module JsTestCore
|
|
21
21
|
|
22
22
|
def call
|
23
23
|
body = Representations::NotFound.new(:message => "File #{request.path_info} not found").to_s
|
24
|
-
[
|
25
|
-
404,
|
26
|
-
{
|
27
|
-
"Content-Type" => "text/html",
|
28
|
-
"Content-Length" => body.size.to_s
|
29
|
-
},
|
30
|
-
body
|
31
|
-
]
|
24
|
+
[ 404, { "Content-Type" => "text/html" }, body ]
|
32
25
|
end
|
33
26
|
end
|
34
27
|
end
|
@@ -34,6 +34,19 @@ module JsTestCore
|
|
34
34
|
|
35
35
|
protected
|
36
36
|
|
37
|
+
def do_post(selenium_browser_start_command)
|
38
|
+
selenium_session = Models::SeleniumSession.new({
|
39
|
+
:spec_url => request['spec_url'].to_s == "" ? full_spec_suite_url : request['spec_url'],
|
40
|
+
:selenium_browser_start_command => selenium_browser_start_command,
|
41
|
+
:selenium_host => request['selenium_host'].to_s == "" ? 'localhost' : request['selenium_host'].to_s,
|
42
|
+
:selenium_port => request['selenium_port'].to_s == "" ? 4444 : Integer(request['selenium_port'])
|
43
|
+
})
|
44
|
+
selenium_session.start
|
45
|
+
|
46
|
+
body = "session_id=#{selenium_session.session_id}"
|
47
|
+
[ 200, { }, body ]
|
48
|
+
end
|
49
|
+
|
37
50
|
def do_get
|
38
51
|
selenium_session = Models::SeleniumSession.find(session_id)
|
39
52
|
if selenium_session
|
@@ -46,21 +59,10 @@ module JsTestCore
|
|
46
59
|
"status=#{FAILURE_COMPLETION}&reason=#{selenium_session.run_result}"
|
47
60
|
end
|
48
61
|
end
|
49
|
-
[
|
50
|
-
200,
|
51
|
-
{'Content-Length' => body.length},
|
52
|
-
body
|
53
|
-
]
|
62
|
+
[ 200, {}, body ]
|
54
63
|
else
|
55
64
|
body = Representations::NotFound.new(:message => "Could not find session #{session_id}").to_s
|
56
|
-
[
|
57
|
-
404,
|
58
|
-
{
|
59
|
-
"Content-Type" => "text/html",
|
60
|
-
"Content-Length" => body.size.to_s
|
61
|
-
},
|
62
|
-
body
|
63
|
-
]
|
65
|
+
[ 404, { "Content-Type" => "text/html" }, body ]
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
@@ -77,25 +79,6 @@ module JsTestCore
|
|
77
79
|
params["session_id"] || request.cookies["session_id"]
|
78
80
|
end
|
79
81
|
|
80
|
-
def do_post(selenium_browser_start_command)
|
81
|
-
selenium_session = Models::SeleniumSession.new({
|
82
|
-
:spec_url => request['spec_url'].to_s == "" ? full_spec_suite_url : request['spec_url'],
|
83
|
-
:selenium_browser_start_command => selenium_browser_start_command,
|
84
|
-
:selenium_host => request['selenium_host'].to_s == "" ? 'localhost' : request['selenium_host'].to_s,
|
85
|
-
:selenium_port => request['selenium_port'].to_s == "" ? 4444 : Integer(request['selenium_port'])
|
86
|
-
})
|
87
|
-
selenium_session.start
|
88
|
-
|
89
|
-
body = "session_id=#{selenium_session.session_id}"
|
90
|
-
[
|
91
|
-
200,
|
92
|
-
{
|
93
|
-
"Content-Length" => body.length
|
94
|
-
},
|
95
|
-
body
|
96
|
-
]
|
97
|
-
end
|
98
|
-
|
99
82
|
def full_spec_suite_url
|
100
83
|
"#{Configuration.root_url}/specs"
|
101
84
|
end
|
@@ -44,15 +44,18 @@ module JsTestCore
|
|
44
44
|
200,
|
45
45
|
{
|
46
46
|
'Content-Type' => "text/html",
|
47
|
-
'Last-Modified' => ::File.mtime(real_path).rfc822
|
48
|
-
'Content-Length' => html.length
|
47
|
+
'Last-Modified' => ::File.mtime(real_path).rfc822
|
49
48
|
},
|
50
49
|
html
|
51
50
|
]
|
52
51
|
end
|
53
52
|
|
54
53
|
def render_spec(spec_files)
|
55
|
-
self.class.spec_representation_class.new(:spec_files => spec_files).to_s
|
54
|
+
self.class.spec_representation_class.new(:spec_files => spec_files, :session_id => session_id).to_s
|
55
|
+
end
|
56
|
+
|
57
|
+
def session_id
|
58
|
+
params[:session_id] || request.cookies["session_id"]
|
56
59
|
end
|
57
60
|
|
58
61
|
def absolute_path
|
@@ -4,7 +4,7 @@ module JsTestCore
|
|
4
4
|
map "/"
|
5
5
|
|
6
6
|
get("") do
|
7
|
-
|
7
|
+
"<html><head></head><body>Welcome to the Js Test Server. Click the following link to run you <a href=/specs>spec suite</a>.</body></html>"
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -3,18 +3,45 @@ require File.expand_path("#{File.dirname(__FILE__)}/../../unit_spec_helper")
|
|
3
3
|
module JsTestCore
|
4
4
|
module Models
|
5
5
|
describe SeleniumSession do
|
6
|
-
attr_reader :driver, :
|
6
|
+
attr_reader :driver, :selenium_session, :browser_host, :spec_url, :selenium_browser_start_command, :selenium_host, :selenium_port
|
7
7
|
|
8
8
|
before do
|
9
9
|
@driver = FakeSeleniumDriver.new
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@
|
14
|
-
|
10
|
+
|
11
|
+
@browser_host = "http://localhost:8080"
|
12
|
+
@spec_url = "#{browser_host}/specs"
|
13
|
+
@selenium_browser_start_command = "*firefox"
|
14
|
+
@selenium_host = "localhost"
|
15
|
+
@selenium_port = 4444
|
16
|
+
|
17
|
+
stub.proxy(Selenium::Client::Driver).new do
|
18
|
+
driver
|
19
|
+
end
|
20
|
+
|
21
|
+
@selenium_session = SeleniumSession.new(
|
22
|
+
:spec_url => spec_url,
|
23
|
+
:selenium_browser_start_command => selenium_browser_start_command,
|
24
|
+
:selenium_host => selenium_host,
|
25
|
+
:selenium_port => selenium_port
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.started
|
30
|
+
attr_reader :session_id
|
31
|
+
before do
|
32
|
+
selenium_session.start
|
33
|
+
@session_id = selenium_session.session_id
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#initialize" do
|
38
|
+
it "creates a Selenium Driver" do
|
39
|
+
Selenium::Client::Driver.should have_received.new(selenium_host, selenium_port, selenium_browser_start_command, browser_host)
|
40
|
+
end
|
15
41
|
end
|
16
42
|
|
17
43
|
describe ".find" do
|
44
|
+
started
|
18
45
|
context "when passed an id for which there is a corresponding selenium_session" do
|
19
46
|
it "returns the selenium_session" do
|
20
47
|
SeleniumSession.find(session_id).should == selenium_session
|
@@ -29,7 +56,20 @@ module JsTestCore
|
|
29
56
|
end
|
30
57
|
end
|
31
58
|
|
59
|
+
describe "#start" do
|
60
|
+
it "starts the Selenium Driver, opens the home page, sets the session_id cookie, and opens the spec page" do
|
61
|
+
stub(Thread).start.yields
|
62
|
+
mock.proxy(driver).start.ordered
|
63
|
+
mock.proxy(driver).open("/").ordered
|
64
|
+
mock.proxy(driver).create_cookie("session_id=#{FakeSeleniumDriver::SESSION_ID}").ordered
|
65
|
+
mock.proxy(driver).open("/specs").ordered
|
66
|
+
|
67
|
+
selenium_session.start
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
32
71
|
describe "#running?" do
|
72
|
+
started
|
33
73
|
context "when the driver#session_started? is true" do
|
34
74
|
it "returns true" do
|
35
75
|
driver.session_started?.should be_true
|
@@ -46,8 +86,8 @@ module JsTestCore
|
|
46
86
|
end
|
47
87
|
end
|
48
88
|
|
49
|
-
describe "#
|
50
|
-
|
89
|
+
describe "#finish" do
|
90
|
+
started
|
51
91
|
|
52
92
|
before do
|
53
93
|
mock.proxy(driver).stop
|
@@ -5,25 +5,17 @@ module JsTestCore
|
|
5
5
|
describe SeleniumSession do
|
6
6
|
attr_reader :request, :driver, :session_id, :selenium_browser_start_command
|
7
7
|
|
8
|
-
def self.before_with_selenium_browser_start_command(selenium_browser_start_command="selenium browser start command")
|
9
|
-
before do
|
10
|
-
@driver = FakeSeleniumDriver.new
|
11
|
-
@session_id = FakeSeleniumDriver::SESSION_ID
|
12
|
-
@selenium_browser_start_command = selenium_browser_start_command
|
13
|
-
stub(Selenium::Client::Driver).new('localhost', 4444, selenium_browser_start_command, 'http://0.0.0.0:8080') do
|
14
|
-
driver
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
8
|
after do
|
20
9
|
Models::SeleniumSession.send(:instances).clear
|
21
10
|
end
|
22
11
|
|
23
12
|
describe "POST /selenium_sessions" do
|
24
|
-
before_with_selenium_browser_start_command
|
25
13
|
before do
|
26
|
-
|
14
|
+
@session_id = FakeSeleniumDriver::SESSION_ID
|
15
|
+
@driver = FakeSeleniumDriver.new
|
16
|
+
stub.proxy(Selenium::Client::Driver).new do
|
17
|
+
driver
|
18
|
+
end
|
27
19
|
end
|
28
20
|
|
29
21
|
it "responds with a 200 and the session_id" do
|
@@ -37,112 +29,144 @@ module JsTestCore
|
|
37
29
|
)
|
38
30
|
end
|
39
31
|
|
40
|
-
it "
|
41
|
-
mock(
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
driver
|
32
|
+
it "creates and starts a Models::SeleniumSession" do
|
33
|
+
mock.proxy(Models::SeleniumSession).new({
|
34
|
+
:selenium_host => 'localhost',
|
35
|
+
:selenium_port => 4444,
|
36
|
+
:selenium_browser_start_command => "*firefox",
|
37
|
+
:spec_url => 'http://0.0.0.0:8080/specs'
|
38
|
+
}) do |selenium_session|
|
39
|
+
mock.strong(selenium_session).start
|
49
40
|
end
|
50
|
-
|
41
|
+
|
42
|
+
response = post(SeleniumSession.path("/"), {:selenium_browser_start_command => "*firefox"})
|
51
43
|
end
|
52
44
|
|
53
45
|
describe "when a selenium_host parameter is passed into the request" do
|
54
|
-
it "starts the
|
55
|
-
mock(
|
56
|
-
|
46
|
+
it "creates and starts the Models::SeleniumSession with the given selenium_host" do
|
47
|
+
mock.proxy(Models::SeleniumSession).new({
|
48
|
+
:selenium_host => 'another-machine',
|
49
|
+
:selenium_port => 4444,
|
50
|
+
:selenium_browser_start_command => "*firefox",
|
51
|
+
:spec_url => 'http://0.0.0.0:8080/specs'
|
52
|
+
}) do |selenium_session|
|
53
|
+
mock.strong(selenium_session).start
|
57
54
|
end
|
55
|
+
|
58
56
|
response = post(SeleniumSession.path("/"), {
|
59
|
-
:selenium_browser_start_command =>
|
57
|
+
:selenium_browser_start_command => "*firefox",
|
60
58
|
:selenium_host => "another-machine"
|
61
59
|
})
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
65
63
|
describe "when a selenium_host parameter is not passed into the request" do
|
66
|
-
it "starts the
|
67
|
-
mock(
|
68
|
-
|
64
|
+
it "creates and starts the Models::SeleniumSession with localhost" do
|
65
|
+
mock.proxy(Models::SeleniumSession).new({
|
66
|
+
:selenium_host => 'localhost',
|
67
|
+
:selenium_port => 4444,
|
68
|
+
:selenium_browser_start_command => "*firefox",
|
69
|
+
:spec_url => 'http://0.0.0.0:8080/specs'
|
70
|
+
}) do |selenium_session|
|
71
|
+
mock.strong(selenium_session).start
|
69
72
|
end
|
73
|
+
|
70
74
|
response = post(SeleniumSession.path("/"), {
|
71
|
-
:selenium_browser_start_command =>
|
75
|
+
:selenium_browser_start_command => "*firefox",
|
72
76
|
:selenium_host => ""
|
73
77
|
})
|
74
78
|
end
|
75
79
|
end
|
76
80
|
|
77
81
|
describe "when a selenium_port parameter is passed into the request" do
|
78
|
-
it "starts the
|
79
|
-
mock(
|
80
|
-
|
82
|
+
it "creates and starts the Models::SeleniumSession with the given selenium_port" do
|
83
|
+
mock.proxy(Models::SeleniumSession).new({
|
84
|
+
:selenium_host => 'localhost',
|
85
|
+
:selenium_port => 4000,
|
86
|
+
:selenium_browser_start_command => "*firefox",
|
87
|
+
:spec_url => 'http://0.0.0.0:8080/specs'
|
88
|
+
}) do |selenium_session|
|
89
|
+
mock.strong(selenium_session).start
|
81
90
|
end
|
82
91
|
response = post(SeleniumSession.path("/"), {
|
83
|
-
:selenium_browser_start_command =>
|
92
|
+
:selenium_browser_start_command => "*firefox",
|
84
93
|
:selenium_port => "4000"
|
85
94
|
})
|
86
95
|
end
|
87
96
|
end
|
88
97
|
|
89
98
|
describe "when a selenium_port parameter is not passed into the request" do
|
90
|
-
it "starts the
|
91
|
-
mock(
|
92
|
-
|
99
|
+
it "creates and starts the Models::SeleniumSession on port 4444" do
|
100
|
+
mock.proxy(Models::SeleniumSession).new({
|
101
|
+
:selenium_host => 'localhost',
|
102
|
+
:selenium_port => 4444,
|
103
|
+
:selenium_browser_start_command => "*firefox",
|
104
|
+
:spec_url => 'http://0.0.0.0:8080/specs'
|
105
|
+
}) do |selenium_session|
|
106
|
+
mock.strong(selenium_session).start
|
93
107
|
end
|
94
108
|
response = post(SeleniumSession.path("/"), {
|
95
|
-
:selenium_browser_start_command =>
|
109
|
+
:selenium_browser_start_command => "*firefox",
|
96
110
|
:selenium_port => ""
|
97
111
|
})
|
98
112
|
end
|
99
113
|
end
|
100
114
|
|
101
115
|
describe "when a spec_url is passed into the request" do
|
102
|
-
it "
|
103
|
-
mock(
|
104
|
-
|
116
|
+
it "creates and starts the Models::SeleniumSession with the given spec_url" do
|
117
|
+
mock.proxy(Models::SeleniumSession).new({
|
118
|
+
:selenium_host => 'localhost',
|
119
|
+
:selenium_port => 4444,
|
120
|
+
:selenium_browser_start_command => "*firefox",
|
121
|
+
:spec_url => 'http://another-host:8080/specs/subdir'
|
122
|
+
}) do |selenium_session|
|
123
|
+
mock.strong(selenium_session).start
|
105
124
|
end
|
106
|
-
mock(driver).start
|
107
|
-
stub(driver).create_cookie
|
108
|
-
mock(driver).open("/")
|
109
|
-
mock(driver).open("/specs/subdir")
|
110
|
-
mock(driver).session_id {session_id}.at_least(1)
|
111
125
|
|
112
126
|
response = post(SeleniumSession.path("/"), {
|
113
|
-
:selenium_browser_start_command =>
|
127
|
+
:selenium_browser_start_command => "*firefox",
|
114
128
|
:spec_url => "http://another-host:8080/specs/subdir"
|
115
129
|
})
|
116
130
|
end
|
117
131
|
end
|
118
132
|
|
119
133
|
describe "when a spec_url is not passed into the request" do
|
120
|
-
|
121
|
-
mock(
|
122
|
-
|
134
|
+
it "creates and starts the Models::SeleniumSession with a spec_url of http://0.0.0.0:8080/specs" do
|
135
|
+
mock.proxy(Models::SeleniumSession).new({
|
136
|
+
:selenium_host => 'localhost',
|
137
|
+
:selenium_port => 4444,
|
138
|
+
:selenium_browser_start_command => "*firefox",
|
139
|
+
:spec_url => 'http://0.0.0.0:8080/specs'
|
140
|
+
}) do |selenium_session|
|
141
|
+
mock.strong(selenium_session).start
|
123
142
|
end
|
124
|
-
end
|
125
|
-
|
126
|
-
it "uses Selenium to run the entire spec session in Firefox" do
|
127
|
-
mock(driver).start
|
128
|
-
stub(driver).create_cookie
|
129
|
-
mock(driver).open("/")
|
130
|
-
mock(driver).open("/specs")
|
131
|
-
mock(driver).session_id {session_id}.at_least(1)
|
132
143
|
|
133
144
|
response = post(SeleniumSession.path("/"), {
|
134
|
-
:selenium_browser_start_command =>
|
145
|
+
:selenium_browser_start_command => "*firefox",
|
135
146
|
:spec_url => ""
|
136
147
|
})
|
137
148
|
end
|
138
149
|
end
|
139
150
|
end
|
140
151
|
|
141
|
-
|
142
|
-
|
152
|
+
def self.before_with_selenium_browser_start_command(selenium_browser_start_command)
|
153
|
+
before do
|
154
|
+
@session_id = FakeSeleniumDriver::SESSION_ID
|
155
|
+
@selenium_browser_start_command = selenium_browser_start_command
|
156
|
+
end
|
157
|
+
end
|
143
158
|
|
159
|
+
describe "POST /selenium_sessions/firefox" do
|
144
160
|
it "creates a selenium_session whose #driver started with '*firefox'" do
|
145
|
-
Models::SeleniumSession.
|
161
|
+
mock.proxy(Models::SeleniumSession).new({
|
162
|
+
:selenium_host => 'localhost',
|
163
|
+
:selenium_port => 4444,
|
164
|
+
:selenium_browser_start_command => "*firefox",
|
165
|
+
:spec_url => 'http://0.0.0.0:8080/specs'
|
166
|
+
}) do |selenium_session|
|
167
|
+
mock.strong(selenium_session).start
|
168
|
+
end
|
169
|
+
|
146
170
|
response = post(SeleniumSession.path("/firefox"))
|
147
171
|
body = "session_id=#{session_id}"
|
148
172
|
response.should be_http(
|
@@ -150,18 +174,20 @@ module JsTestCore
|
|
150
174
|
{'Content-Length' => body.length.to_s},
|
151
175
|
body
|
152
176
|
)
|
153
|
-
|
154
|
-
selenium_session = Models::SeleniumSession.find(session_id)
|
155
|
-
selenium_session.class.should == Models::SeleniumSession
|
156
|
-
selenium_session.driver.should == driver
|
157
177
|
end
|
158
178
|
end
|
159
179
|
|
160
180
|
describe "POST /selenium_sessions/iexplore" do
|
161
|
-
before_with_selenium_browser_start_command "*iexplore"
|
162
|
-
|
163
181
|
it "creates a selenium_session whose #driver started with '*iexplore'" do
|
164
|
-
Models::SeleniumSession.
|
182
|
+
mock.proxy(Models::SeleniumSession).new({
|
183
|
+
:selenium_host => 'localhost',
|
184
|
+
:selenium_port => 4444,
|
185
|
+
:selenium_browser_start_command => "*iexplore",
|
186
|
+
:spec_url => 'http://0.0.0.0:8080/specs'
|
187
|
+
}) do |selenium_session|
|
188
|
+
mock.strong(selenium_session).start
|
189
|
+
end
|
190
|
+
|
165
191
|
response = post(SeleniumSession.path("/iexplore"))
|
166
192
|
body = "session_id=#{session_id}"
|
167
193
|
response.should be_http(
|
@@ -169,10 +195,6 @@ module JsTestCore
|
|
169
195
|
{'Content-Length' => body.length.to_s},
|
170
196
|
body
|
171
197
|
)
|
172
|
-
|
173
|
-
selenium_session = Models::SeleniumSession.find(session_id)
|
174
|
-
selenium_session.class.should == Models::SeleniumSession
|
175
|
-
selenium_session.driver.should == driver
|
176
198
|
end
|
177
199
|
end
|
178
200
|
|
@@ -105,6 +105,30 @@ module JsTestCore
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
+
context "when passed a :session_id param" do
|
109
|
+
it "instantiates the Representation with the :session_id and renders window._session_id=:session_id" do
|
110
|
+
session_id = "DEADBEEF"
|
111
|
+
|
112
|
+
response = get(SpecFile.path("failing_spec"), :session_id => session_id)
|
113
|
+
doc = Nokogiri::HTML(response.body)
|
114
|
+
doc.css("script").any? do |script|
|
115
|
+
script.inner_html.include?("window._session_id = '#{session_id}';")
|
116
|
+
end.should be_true
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context "when the :session_id cookie is set" do
|
121
|
+
it "instantiates the Representation with the :session_id and renders window._session_id=:session_id" do
|
122
|
+
session_id = "DEADBEEF"
|
123
|
+
|
124
|
+
response = get(SpecFile.path("failing_spec"), {}, {:cookie => "session_id=#{session_id}"})
|
125
|
+
doc = Nokogiri::HTML(response.body)
|
126
|
+
doc.css("script").any? do |script|
|
127
|
+
script.inner_html.include?("window._session_id = '#{session_id}';")
|
128
|
+
end.should be_true
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
108
132
|
describe "GET /specs/i_dont_exist" do
|
109
133
|
it "renders a 404" do
|
110
134
|
response = get(SpecFile.path("i_dont_exist"))
|
@@ -2,6 +2,7 @@ require "rubygems"
|
|
2
2
|
require "spec"
|
3
3
|
require "spec/autorun"
|
4
4
|
require "rack/test"
|
5
|
+
require "rr"
|
5
6
|
ARGV.push("-b")
|
6
7
|
|
7
8
|
dir = File.dirname(__FILE__)
|
@@ -16,7 +17,7 @@ require "#{LIBRARY_ROOT_DIR}/spec/spec_helpers/fake_selenium_driver"
|
|
16
17
|
require "#{LIBRARY_ROOT_DIR}/spec/spec_helpers/show_test_exceptions"
|
17
18
|
|
18
19
|
Spec::Runner.configure do |config|
|
19
|
-
config.mock_with
|
20
|
+
config.mock_with RR::Adapters::Rspec
|
20
21
|
end
|
21
22
|
|
22
23
|
Sinatra::Application.use ShowTestExceptions
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pivotal-screw-unit-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pivotal Labs
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-06-
|
13
|
+
date: 2009-06-14 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -162,7 +162,7 @@ files:
|
|
162
162
|
- vendor/js-test-core/vendor/lucky-luciano/spec/lucky_luciano/resource_spec.rb
|
163
163
|
- vendor/js-test-core/vendor/lucky-luciano/spec/spec_helper.rb
|
164
164
|
- vendor/js-test-core/vendor/lucky-luciano/spec/spec_suite.rb
|
165
|
-
has_rdoc:
|
165
|
+
has_rdoc: true
|
166
166
|
homepage: http://github.com/pivotal/screw-unit-server
|
167
167
|
post_install_message:
|
168
168
|
rdoc_options:
|
@@ -187,14 +187,14 @@ requirements: []
|
|
187
187
|
rubyforge_project:
|
188
188
|
rubygems_version: 1.2.0
|
189
189
|
signing_key:
|
190
|
-
specification_version:
|
190
|
+
specification_version: 2
|
191
191
|
summary: Server and helpers for your Screw Unit tests.
|
192
192
|
test_files:
|
193
|
+
- spec/unit_suite.rb
|
194
|
+
- spec/functional/functional_spec_server_starter.rb
|
193
195
|
- spec/functional/functional_spec.rb
|
194
196
|
- spec/functional/functional_spec_helper.rb
|
195
|
-
- spec/functional/functional_spec_server_starter.rb
|
196
|
-
- spec/functional_suite.rb
|
197
197
|
- spec/spec_suite.rb
|
198
198
|
- spec/unit/js_test_core/specs/spec_file_spec.rb
|
199
199
|
- spec/unit/unit_spec_helper.rb
|
200
|
-
- spec/
|
200
|
+
- spec/functional_suite.rb
|