spassky 0.1.44 → 0.1.45
Sign up to get free protection for your applications and to get access to all the features.
- data/features/device_timeout.feature +1 -0
- data/features/step_definitions/steps.rb +4 -0
- data/lib/spassky/server/app.rb +1 -1
- data/lib/spassky/server/assert.js +1 -0
- data/lib/spassky/server/device_list.rb +3 -1
- data/lib/spassky/server/test_suite_container.rb +3 -7
- data/lib/spassky/version.rb +1 -1
- data/spec/spassky/server/app_spec.rb +1 -1
- data/spec/spassky/server/device_list_spec.rb +11 -0
- data/spec/spassky/server/test_suite_container_spec.rb +9 -10
- metadata +28 -28
@@ -20,6 +20,7 @@ Feature: Device Timeout
|
|
20
20
|
|
21
21
|
Scenario: One device times out
|
22
22
|
Given a connected mobile device "ipad"
|
23
|
+
And I have a timeout of 5 seconds
|
23
24
|
When the device disconnects
|
24
25
|
And I run "spassky run --pattern timed-out.html --test timed-out.html --server <host>" with the server host
|
25
26
|
Then the output should contain:
|
@@ -34,6 +34,10 @@ end
|
|
34
34
|
Given /^a Wireless Universal Resource FiLe$/ do
|
35
35
|
end
|
36
36
|
|
37
|
+
Given /^I have a timeout of (\d+) seconds?$/ do |timeout|
|
38
|
+
ENV["SPASSKY_TIMEOUT"] = timeout
|
39
|
+
end
|
40
|
+
|
37
41
|
When /^I run "([^"]*)" with the server host$/ do |command_line|
|
38
42
|
run_simple(unescape(command_line.gsub('<host>', "http://#{@uri.host}:#{@uri.port}")), false)
|
39
43
|
end
|
data/lib/spassky/server/app.rb
CHANGED
@@ -83,7 +83,7 @@ module Spassky::Server
|
|
83
83
|
def get_test_file_contents
|
84
84
|
file_name = params[:splat].join("/")
|
85
85
|
assert_post_back_url = "/test_runs/#{params[:id]}/run/#{params[:random]}/assert"
|
86
|
-
TestSuiteContainer.new(test_run.contents, idle_url, assert_post_back_url
|
86
|
+
TestSuiteContainer.new(test_run.contents, idle_url, assert_post_back_url).get_file(file_name)
|
87
87
|
end
|
88
88
|
|
89
89
|
def save_test_result
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module Spassky::Server
|
2
2
|
class TestSuiteContainer
|
3
|
-
def initialize(contents, next_url_to_redirect_to, assert_post_back_url
|
3
|
+
def initialize(contents, next_url_to_redirect_to, assert_post_back_url)
|
4
4
|
@contents = contents
|
5
5
|
@next_url_to_redirect_to = next_url_to_redirect_to
|
6
6
|
@assert_post_back_url = assert_post_back_url
|
7
|
-
@seconds = seconds
|
8
7
|
end
|
9
8
|
|
10
9
|
def get_file(name)
|
@@ -15,17 +14,14 @@ module Spassky::Server
|
|
15
14
|
private
|
16
15
|
|
17
16
|
def add_helpers_to_html html
|
18
|
-
html.gsub('</head>', assert_js_script +
|
17
|
+
html.gsub('</head>', assert_js_script + '</head>')
|
19
18
|
end
|
20
19
|
|
21
20
|
def assert_js_script
|
22
21
|
assert_js = File.read(File.join(File.dirname(__FILE__), 'assert.js'))
|
23
22
|
assert_js.gsub!("{ASSERT_POST_BACK_URL}", @assert_post_back_url)
|
23
|
+
assert_js.gsub!("{IDLE_URL}", @next_url_to_redirect_to)
|
24
24
|
"<script type=\"text/javascript\">#{assert_js}</script>"
|
25
25
|
end
|
26
|
-
|
27
|
-
def meta_refresh_tag
|
28
|
-
"<meta http-equiv=\"refresh\" content=\"#{@seconds}; url='#{@next_url_to_redirect_to}'\">"
|
29
|
-
end
|
30
26
|
end
|
31
27
|
end
|
data/lib/spassky/version.rb
CHANGED
@@ -106,7 +106,7 @@ module Spassky::Server
|
|
106
106
|
TestRun.stub!(:find).with('123').and_return(test)
|
107
107
|
html_test = mock(:html_test)
|
108
108
|
html_test.stub!(:get_file).and_return("contents")
|
109
|
-
TestSuiteContainer.should_receive(:new).with({}, "/device/idle/random-string", "/test_runs/123/run/random/assert"
|
109
|
+
TestSuiteContainer.should_receive(:new).with({}, "/device/idle/random-string", "/test_runs/123/run/random/assert").and_return html_test
|
110
110
|
get "/test_runs/123/run/random/fake_test.html.file"
|
111
111
|
last_response.body.should == "contents"
|
112
112
|
end
|
@@ -31,5 +31,16 @@ module Spassky::Server
|
|
31
31
|
Time.stub!(:now).and_return(now)
|
32
32
|
subject.recently_connected_devices.should == ["b"]
|
33
33
|
end
|
34
|
+
|
35
|
+
it "supports timeouts set in the environment" do
|
36
|
+
now = Time.now
|
37
|
+
Time.stub!(:now).and_return(now - 30)
|
38
|
+
subject.update_last_connected("a")
|
39
|
+
Time.stub!(:now).and_return(now - 29)
|
40
|
+
subject.update_last_connected("b")
|
41
|
+
Time.stub!(:now).and_return(now)
|
42
|
+
ENV["SPASSKY_TIMEOUT"] = "30"
|
43
|
+
subject.recently_connected_devices.should == ["b"]
|
44
|
+
end
|
34
45
|
end
|
35
46
|
end
|
@@ -15,31 +15,30 @@ module Spassky::Server
|
|
15
15
|
|
16
16
|
context "file name is a file" do
|
17
17
|
it "returns the specified file" do
|
18
|
-
TestSuiteContainer.new(@test_contents,
|
18
|
+
TestSuiteContainer.new(@test_contents, "", "").get_file("test_file.js").should == "some javascript"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
context "with a file that is in a subdirectory" do
|
23
23
|
it "returns the file" do
|
24
|
-
TestSuiteContainer.new(@test_contents,
|
24
|
+
TestSuiteContainer.new(@test_contents, "", "").get_file("directory/another_directory/filename.txt").should == "file 1 contents"
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "when the test contents includes a </head> tag" do
|
29
|
-
it "adds a meta-refresh tag to the test contents" do
|
30
|
-
url = "http://example.org"
|
31
|
-
seconds = 23
|
32
|
-
TestSuiteContainer.new(@test_contents, url, "", seconds).get_file("example_test.html").should include "<meta http-equiv=\"refresh\" content=\"#{seconds}; url='#{url}'\"></head>"
|
33
|
-
end
|
34
|
-
|
35
29
|
it "adds the assert.js script to the head" do
|
36
30
|
File.stub!(:read).and_return("assert.js!")
|
37
|
-
TestSuiteContainer.new(@test_contents,
|
31
|
+
TestSuiteContainer.new(@test_contents, "", "").get_file("example_test.html").should include "<script type=\"text/javascript\">assert.js!</script>"
|
38
32
|
end
|
39
33
|
|
40
34
|
it "injects the assert post back url into assert.js" do
|
41
35
|
File.stub!(:read).and_return("assert.js! {ASSERT_POST_BACK_URL}")
|
42
|
-
TestSuiteContainer.new(@test_contents,
|
36
|
+
TestSuiteContainer.new(@test_contents, "", "http://assert.org").get_file("example_test.html").should include "assert.js! http://assert.org"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "injects the idle url into assert.js" do
|
40
|
+
File.stub!(:read).and_return("assert.js! {IDLE_URL}")
|
41
|
+
TestSuiteContainer.new(@test_contents, "http://idle_url.org", "").get_file("example_test.html").should include "assert.js! http://idle_url.org"
|
43
42
|
end
|
44
43
|
end
|
45
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spassky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.45
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2011-
|
14
|
+
date: 2011-10-05 00:00:00.000000000Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rest-client
|
18
|
-
requirement: &
|
18
|
+
requirement: &70238235418160 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70238235418160
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
|
-
requirement: &
|
29
|
+
requirement: &70238235417660 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70238235417660
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: sinatra
|
40
|
-
requirement: &
|
40
|
+
requirement: &70238235417180 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '0'
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70238235417180
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rainbow
|
51
|
-
requirement: &
|
51
|
+
requirement: &70238235416640 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: '0'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70238235416640
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: wurfl-lite
|
62
|
-
requirement: &
|
62
|
+
requirement: &70238235416100 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ! '>='
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: '0'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70238235416100
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: trollop
|
73
|
-
requirement: &
|
73
|
+
requirement: &70238235415520 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: '0'
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70238235415520
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: rake
|
84
|
-
requirement: &
|
84
|
+
requirement: &70238235414920 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *70238235414920
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: rspec
|
95
|
-
requirement: &
|
95
|
+
requirement: &70238235414220 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ! '>='
|
@@ -100,10 +100,10 @@ dependencies:
|
|
100
100
|
version: '0'
|
101
101
|
type: :development
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *70238235414220
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: cucumber
|
106
|
-
requirement: &
|
106
|
+
requirement: &70238235413100 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
109
|
- - ! '>='
|
@@ -111,10 +111,10 @@ dependencies:
|
|
111
111
|
version: '0'
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
|
-
version_requirements: *
|
114
|
+
version_requirements: *70238235413100
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
116
|
name: capybara
|
117
|
-
requirement: &
|
117
|
+
requirement: &70238235412660 !ruby/object:Gem::Requirement
|
118
118
|
none: false
|
119
119
|
requirements:
|
120
120
|
- - ! '>='
|
@@ -122,10 +122,10 @@ dependencies:
|
|
122
122
|
version: '0'
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
|
-
version_requirements: *
|
125
|
+
version_requirements: *70238235412660
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: aruba
|
128
|
-
requirement: &
|
128
|
+
requirement: &70238235412100 !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
131
131
|
- - ! '>='
|
@@ -133,10 +133,10 @@ dependencies:
|
|
133
133
|
version: '0'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
|
-
version_requirements: *
|
136
|
+
version_requirements: *70238235412100
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: fakefs
|
139
|
-
requirement: &
|
139
|
+
requirement: &70238235407100 !ruby/object:Gem::Requirement
|
140
140
|
none: false
|
141
141
|
requirements:
|
142
142
|
- - ! '>='
|
@@ -144,10 +144,10 @@ dependencies:
|
|
144
144
|
version: '0'
|
145
145
|
type: :development
|
146
146
|
prerelease: false
|
147
|
-
version_requirements: *
|
147
|
+
version_requirements: *70238235407100
|
148
148
|
- !ruby/object:Gem::Dependency
|
149
149
|
name: factory_girl
|
150
|
-
requirement: &
|
150
|
+
requirement: &70238235406500 !ruby/object:Gem::Requirement
|
151
151
|
none: false
|
152
152
|
requirements:
|
153
153
|
- - ! '>='
|
@@ -155,7 +155,7 @@ dependencies:
|
|
155
155
|
version: '0'
|
156
156
|
type: :development
|
157
157
|
prerelease: false
|
158
|
-
version_requirements: *
|
158
|
+
version_requirements: *70238235406500
|
159
159
|
description: ''
|
160
160
|
email:
|
161
161
|
- andrew.vos@gmail.com
|