celerity 0.0.4 → 0.0.6
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/History.txt +33 -0
- data/README.txt +19 -9
- data/Rakefile +9 -3
- data/lib/celerity.rb +39 -39
- data/lib/celerity/browser.rb +538 -153
- data/lib/celerity/clickable_element.rb +48 -7
- data/lib/celerity/collections.rb +155 -131
- data/lib/celerity/container.rb +766 -385
- data/lib/celerity/default_viewer.rb +10 -0
- data/lib/celerity/disabled_element.rb +19 -2
- data/lib/celerity/element.rb +152 -83
- data/lib/celerity/element_collection.rb +106 -0
- data/lib/celerity/element_locator.rb +89 -66
- data/lib/celerity/elements/button.rb +23 -13
- data/lib/celerity/elements/file_field.rb +17 -5
- data/lib/celerity/elements/form.rb +21 -16
- data/lib/celerity/elements/frame.rb +75 -53
- data/lib/celerity/elements/image.rb +76 -63
- data/lib/celerity/elements/label.rb +4 -2
- data/lib/celerity/elements/link.rb +30 -18
- data/lib/celerity/elements/meta.rb +6 -0
- data/lib/celerity/{non_control_elements.rb → elements/non_control_elements.rb} +106 -76
- data/lib/celerity/elements/option.rb +16 -2
- data/lib/celerity/elements/radio_check.rb +55 -20
- data/lib/celerity/elements/select_list.rb +65 -29
- data/lib/celerity/elements/table.rb +141 -94
- data/lib/celerity/elements/table_cell.rb +13 -6
- data/lib/celerity/elements/{table_body.rb → table_elements.rb} +20 -8
- data/lib/celerity/elements/table_row.rb +23 -7
- data/lib/celerity/elements/text_field.rb +89 -33
- data/lib/celerity/exception.rb +77 -41
- data/lib/celerity/extra/method_generator.rb +42 -24
- data/lib/celerity/htmlunit.rb +49 -0
- data/lib/celerity/htmlunit/commons-collections-3.2.1.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-2.5-SNAPSHOT.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-core-js-2.5-SNAPSHOT.jar +0 -0
- data/lib/celerity/htmlunit/nekohtml-1.9.12-20090308.130127-11.jar +0 -0
- data/lib/celerity/htmlunit/serializer-2.7.1.jar +0 -0
- data/lib/celerity/htmlunit/xalan-2.7.1.jar +0 -0
- data/lib/celerity/htmlunit/xml-apis-1.3.04.jar +0 -0
- data/lib/celerity/identifier.rb +3 -2
- data/lib/celerity/input_element.rb +5 -5
- data/lib/celerity/listener.rb +135 -0
- data/lib/celerity/resources/no_viewer.png +0 -0
- data/lib/celerity/util.rb +88 -0
- data/lib/celerity/version.rb +4 -3
- data/lib/celerity/watir_compatibility.rb +35 -25
- data/tasks/jar.rake +57 -0
- metadata +35 -142
- data.tar.gz.sig +0 -0
- data/Manifest.txt +0 -150
- data/lib/celerity/element_collections.rb +0 -54
- data/lib/celerity/element_map.rb +0 -51
- data/lib/celerity/elements/table_footer.rb +0 -30
- data/lib/celerity/elements/table_header.rb +0 -30
- data/lib/celerity/htmlunit/commons-collections-3.2.jar +0 -0
- data/lib/celerity/htmlunit/download.sh +0 -23
- data/lib/celerity/htmlunit/htmlunit-2.2.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-core-js-2.2.jar +0 -0
- data/lib/celerity/htmlunit/nekohtml-1.9.8.jar +0 -0
- data/lib/celerity/htmlunit/xalan-2.7.0.jar +0 -0
- data/lib/celerity/htmlunit/xml-apis-1.0.b2.jar +0 -0
- data/spec/area_spec.rb +0 -97
- data/spec/areas_spec.rb +0 -40
- data/spec/browser_spec.rb +0 -266
- data/spec/button_spec.rb +0 -227
- data/spec/buttons_spec.rb +0 -39
- data/spec/checkbox_spec.rb +0 -302
- data/spec/checkboxes_spec.rb +0 -38
- data/spec/div_spec.rb +0 -207
- data/spec/divs_spec.rb +0 -39
- data/spec/element_spec.rb +0 -79
- data/spec/filefield_spec.rb +0 -123
- data/spec/filefields_spec.rb +0 -40
- data/spec/form_spec.rb +0 -59
- data/spec/forms_spec.rb +0 -41
- data/spec/frame_spec.rb +0 -121
- data/spec/frames_spec.rb +0 -71
- data/spec/hidden_spec.rb +0 -127
- data/spec/hiddens_spec.rb +0 -39
- data/spec/hn_spec.rb +0 -104
- data/spec/hns_spec.rb +0 -45
- data/spec/html/2000_spans.html +0 -2009
- data/spec/html/bug_duplicate_attributes.html +0 -14
- data/spec/html/bug_javascript_001.html +0 -11
- data/spec/html/form_js_bug.html +0 -11
- data/spec/html/forms_with_input_elements.html +0 -114
- data/spec/html/frame_1.html +0 -17
- data/spec/html/frame_2.html +0 -16
- data/spec/html/frames.html +0 -11
- data/spec/html/iframes.html +0 -12
- data/spec/html/images.html +0 -27
- data/spec/html/images/1.gif +0 -0
- data/spec/html/images/2.gif +0 -0
- data/spec/html/images/3.gif +0 -0
- data/spec/html/images/button.jpg +0 -0
- data/spec/html/images/circle.jpg +0 -0
- data/spec/html/images/map.gif +0 -0
- data/spec/html/images/map2.gif +0 -0
- data/spec/html/images/minus.gif +0 -0
- data/spec/html/images/originaltriangle.jpg +0 -0
- data/spec/html/images/plus.gif +0 -0
- data/spec/html/images/square.jpg +0 -0
- data/spec/html/images/triangle.jpg +0 -0
- data/spec/html/invalid_js.html +0 -11
- data/spec/html/latin1_text.html +0 -17
- data/spec/html/non_control_elements.html +0 -115
- data/spec/html/simple_ajax.html +0 -22
- data/spec/html/tables.html +0 -119
- data/spec/html/utf8_text.html +0 -15
- data/spec/htmlunit_spec.rb +0 -26
- data/spec/image_spec.rb +0 -220
- data/spec/images_spec.rb +0 -39
- data/spec/label_spec.rb +0 -79
- data/spec/labels_spec.rb +0 -40
- data/spec/li_spec.rb +0 -139
- data/spec/link_spec.rb +0 -189
- data/spec/links_spec.rb +0 -43
- data/spec/lis_spec.rb +0 -40
- data/spec/map_spec.rb +0 -102
- data/spec/maps_spec.rb +0 -40
- data/spec/meta_spec.rb +0 -8
- data/spec/ol_spec.rb +0 -87
- data/spec/ols_spec.rb +0 -40
- data/spec/option_spec.rb +0 -154
- data/spec/p_spec.rb +0 -171
- data/spec/pre_spec.rb +0 -135
- data/spec/pres_spec.rb +0 -40
- data/spec/ps_spec.rb +0 -40
- data/spec/radio_spec.rb +0 -299
- data/spec/radios_spec.rb +0 -42
- data/spec/select_list_spec.rb +0 -299
- data/spec/select_lists_spec.rb +0 -47
- data/spec/span_spec.rb +0 -184
- data/spec/spans_spec.rb +0 -64
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -55
- data/spec/table_bodies_spec.rb +0 -57
- data/spec/table_body_spec.rb +0 -111
- data/spec/table_cell_spec.rb +0 -74
- data/spec/table_cells_spec.rb +0 -59
- data/spec/table_footer_spec.rb +0 -101
- data/spec/table_footers_spec.rb +0 -55
- data/spec/table_header_spec.rb +0 -101
- data/spec/table_headers_spec.rb +0 -55
- data/spec/table_row_spec.rb +0 -104
- data/spec/table_rows_spec.rb +0 -58
- data/spec/table_spec.rb +0 -160
- data/spec/tables_spec.rb +0 -42
- data/spec/text_field_spec.rb +0 -323
- data/spec/text_fields_spec.rb +0 -44
- data/spec/ul_spec.rb +0 -88
- data/spec/uls_spec.rb +0 -40
- data/spec/watir_compatibility_spec.rb +0 -260
- data/support/spec_server.rb +0 -73
- data/tasks/rspec.rake +0 -30
- data/tasks/specserver.rake +0 -21
- metadata.gz.sig +0 -0
data/spec/uls_spec.rb
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
|
-
|
|
3
|
-
describe "Uls" do
|
|
4
|
-
|
|
5
|
-
before :all do
|
|
6
|
-
@browser = Browser.new
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
before :each do
|
|
10
|
-
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe "#length" do
|
|
14
|
-
it "should return the number of uls" do
|
|
15
|
-
@browser.uls.length.should == 2
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe "#[]" do
|
|
20
|
-
it "should return the ul at the given index" do
|
|
21
|
-
@browser.uls[1].id.should == "navbar"
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe "#each" do
|
|
26
|
-
it "should iterate through uls correctly" do
|
|
27
|
-
@browser.uls.each_with_index do |ul, index|
|
|
28
|
-
ul.name.should == @browser.ul(:index, index+1).name
|
|
29
|
-
ul.id.should == @browser.ul(:index, index+1).id
|
|
30
|
-
ul.value.should == @browser.ul(:index, index+1).value
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
after :all do
|
|
36
|
-
@browser.close
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
|
-
|
|
3
|
-
describe "IE" do
|
|
4
|
-
|
|
5
|
-
before :each do
|
|
6
|
-
@browser = Browser.new
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# Class methods
|
|
10
|
-
it "should respond to .speed" do
|
|
11
|
-
Browser.should respond_to("speed")
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "should respond to .speed=" do
|
|
15
|
-
Browser.should respond_to("speed=")
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "should respond to .set_fast_speed" do
|
|
19
|
-
Browser.should respond_to("set_fast_speed")
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "should respond to .set_slow_speed" do
|
|
23
|
-
Browser.should respond_to("set_slow_speed")
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "should respond to .attach_timeout" do
|
|
27
|
-
Browser.should respond_to("attach_timeout")
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "should respond to .attach_timeout=" do
|
|
31
|
-
Browser.should respond_to("attach_timeout=")
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "should respond to .reset_attach_timeout" do
|
|
35
|
-
Browser.should respond_to("reset_attach_timeout")
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "should respond to .visible" do
|
|
39
|
-
Browser.should respond_to("visible")
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "should respond to .each" do
|
|
43
|
-
Browser.should respond_to("each")
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it "should respond to .quit" do
|
|
47
|
-
Browser.should respond_to("quit")
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it "should alias .start_window to .start" do
|
|
51
|
-
Browser.should respond_to("start")
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# Instance methods
|
|
55
|
-
it "should respond to #visible" do
|
|
56
|
-
@browser.should respond_to("visible")
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it "should respond to #visible=" do
|
|
60
|
-
@browser.should respond_to("visible=")
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
it "should respond to #wait" do
|
|
64
|
-
@browser.should respond_to("wait")
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
describe "#bring_to_front" do
|
|
68
|
-
it "should return true" do
|
|
69
|
-
@browser.bring_to_front.should be_true
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
describe "#checkBox" do
|
|
74
|
-
it "should behave like #checkbox" do
|
|
75
|
-
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
|
76
|
-
@browser.checkbox(:id, "new_user_interests_books").should exist
|
|
77
|
-
@browser.checkbox(:id, "new_user_interests_cars").should_not be_set
|
|
78
|
-
@browser.checkbox(:id, "new_user_interests_cars").set
|
|
79
|
-
@browser.checkbox(:id, "new_user_interests_cars").should be_set
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
describe "Button" do
|
|
86
|
-
|
|
87
|
-
before :all do
|
|
88
|
-
@browser = Browser.new
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
before :each do
|
|
92
|
-
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
describe "#click_no_wait" do
|
|
96
|
-
it "should behave like #click" do
|
|
97
|
-
@browser.button(:id, 'new_user_submit').click_no_wait
|
|
98
|
-
@browser.text.should include("You posted the following content:")
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
describe "Link" do
|
|
105
|
-
|
|
106
|
-
before :all do
|
|
107
|
-
@browser = Browser.new
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
before :each do
|
|
111
|
-
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
describe "#click_no_wait" do
|
|
115
|
-
it "should behave like #click" do
|
|
116
|
-
@browser.link(:text, "Link 3").click_no_wait
|
|
117
|
-
@browser.text.include?("User administration").should be_true
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
describe "Image" do
|
|
124
|
-
|
|
125
|
-
before :all do
|
|
126
|
-
@browser = Browser.new
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
before :each do
|
|
130
|
-
@browser.goto(TEST_HOST + "/images.html")
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
describe "#hasLoaded?" do
|
|
134
|
-
it "should behave like #loaded?" do
|
|
135
|
-
@browser.image(:name, 'circle').hasLoaded?.should be_true
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
describe "#has_loaded?" do
|
|
140
|
-
it "should behave like #loaded" do
|
|
141
|
-
@browser.image(:name, 'circle').has_loaded?.should be_true
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
describe "#fileSize" do
|
|
146
|
-
it "should behave like #file_size" do
|
|
147
|
-
@browser.image(:id, 'square').fileSize.should == 788
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
describe "#fileCreatedDate" do
|
|
152
|
-
it "should behave like #file_created_date" do
|
|
153
|
-
image = @browser.image(:index, 2)
|
|
154
|
-
path = File.dirname(__FILE__) + "/html/#{image.src}"
|
|
155
|
-
image.file_created_date.to_i.should == File.mtime(path).to_i
|
|
156
|
-
end
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
describe "RadioCheckCommon" do
|
|
162
|
-
before :all do
|
|
163
|
-
@browser = Browser.new
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
before :each do
|
|
167
|
-
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
describe "#is_set?" do
|
|
171
|
-
it "should behave like #set?" do
|
|
172
|
-
@browser.radio(:id, "new_user_newsletter_yes").is_set?.should be_true
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
describe "#isSet?" do
|
|
177
|
-
it "should behave like #set?" do
|
|
178
|
-
@browser.radio(:id, "new_user_newsletter_yes").isSet?.should be_true
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
describe "#get_state" do
|
|
183
|
-
it "should behave like #set?" do
|
|
184
|
-
@browser.checkbox(:id, "new_user_interests_books").get_state.should be_true
|
|
185
|
-
end
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
describe "#getState" do
|
|
189
|
-
it "should behave like #set?" do
|
|
190
|
-
@browser.checkbox(:id, "new_user_interests_books").getState.should be_true
|
|
191
|
-
end
|
|
192
|
-
end
|
|
193
|
-
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
describe "SelectList" do
|
|
197
|
-
|
|
198
|
-
before :all do
|
|
199
|
-
@browser = Browser.new
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
before :each do
|
|
203
|
-
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
describe "#getSelectedItems" do
|
|
207
|
-
it "should behave like #get_selected_items" do
|
|
208
|
-
@browser.select_list(:name, "new_user_country").getSelectedItems.should == ["Norway"]
|
|
209
|
-
@browser.select_list(:name, "new_user_languages").getSelectedItems.should == ["English", "Norwegian"]
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
describe "#getAllContents" do
|
|
214
|
-
it "should behave like #get_all_contents" do
|
|
215
|
-
@browser.select_list(:name, "new_user_country").getAllContents.should == ["Denmark" ,"Norway" , "Sweden" , "United Kingdom", "USA"]
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
describe "#clearSelection" do
|
|
220
|
-
it "should behave like #clear selection" do
|
|
221
|
-
@browser.select_list(:name, "new_user_languages").clearSelection
|
|
222
|
-
@browser.select_list(:name, "new_user_languages").getSelectedItems.should be_empty
|
|
223
|
-
end
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
describe "#select_value" do
|
|
227
|
-
it "should behave like #select" do
|
|
228
|
-
@browser.select_list(:name, "new_user_country").select_value("Denmark")
|
|
229
|
-
@browser.select_list(:name, "new_user_country").getSelectedItems.should == ["Denmark"]
|
|
230
|
-
end
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
describe "TextField" do
|
|
236
|
-
|
|
237
|
-
before :all do
|
|
238
|
-
@browser = Browser.new
|
|
239
|
-
end
|
|
240
|
-
|
|
241
|
-
before :each do
|
|
242
|
-
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
describe "#dragContentsTo" do
|
|
246
|
-
it "should behave like #drag_contents_to" do
|
|
247
|
-
@browser.text_field(:name, "new_user_first_name").set("Smith")
|
|
248
|
-
@browser.text_field(:name, "new_user_first_name").dragContentsTo(:name, "new_user_last_name")
|
|
249
|
-
@browser.text_field(:name, "new_user_first_name").value.should be_empty
|
|
250
|
-
@browser.text_field(:id, "new_user_last_name").value.should == "Smith"
|
|
251
|
-
end
|
|
252
|
-
end
|
|
253
|
-
|
|
254
|
-
describe "#getContents" do
|
|
255
|
-
it "should behave like #get_contents" do
|
|
256
|
-
@browser.text_field(:name, "new_user_occupation").getContents.should == "Developer"
|
|
257
|
-
end
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
end
|
data/support/spec_server.rb
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
require 'webrick'
|
|
2
|
-
require 'webrick/https'
|
|
3
|
-
|
|
4
|
-
module Celerity
|
|
5
|
-
|
|
6
|
-
class PostHandler < WEBrick::HTTPServlet::AbstractServlet
|
|
7
|
-
def do_POST(req, resp)
|
|
8
|
-
resp['content-type'] = 'text/html'
|
|
9
|
-
resp.body << "You posted the following content:\n"
|
|
10
|
-
resp.body << req.body
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
class PlainTextHandler < WEBrick::HTTPServlet::AbstractServlet
|
|
15
|
-
def do_GET(req, resp)
|
|
16
|
-
resp['content-type'] = 'text/plain'
|
|
17
|
-
resp.body << "This is text/plain"
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
class SlowAjaxHandler < WEBrick::HTTPServlet::AbstractServlet
|
|
22
|
-
def do_GET(req, resp)
|
|
23
|
-
sleep 10
|
|
24
|
-
resp['content-type'] = 'text/html'
|
|
25
|
-
resp.body << "A slooow ajax response"
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
class SpecServer
|
|
30
|
-
attr_reader :host, :thread, :log_file
|
|
31
|
-
|
|
32
|
-
def initialize(opts = {})
|
|
33
|
-
@ssl = opts[:ssl] || false
|
|
34
|
-
@doc_root = opts[:doc_root] || File.join(File.dirname(__FILE__),"..", "spec", "html")
|
|
35
|
-
@log_file = opts[:log_file] || File.join(File.dirname(__FILE__), "..", "log", "webrick_log.txt")
|
|
36
|
-
@port = opts[:port] || 2000
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def run
|
|
40
|
-
unless File.exist?(@log_file)
|
|
41
|
-
FileUtils.mkdir_p(File.dirname(@log_file))
|
|
42
|
-
FileUtils.touch(@log_file)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
server_options = {
|
|
46
|
-
:Port => @port,
|
|
47
|
-
:DocumentRoot => @doc_root,
|
|
48
|
-
:Logger => WEBrick::Log.new(@log_file, WEBrick::BasicLog::WARN),
|
|
49
|
-
:AccessLog => [],
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if @ssl
|
|
53
|
-
# java complains about this certifcate, need to create our own (when running under MRI)
|
|
54
|
-
server_options.merge!(
|
|
55
|
-
:SSLEnable => true,
|
|
56
|
-
:SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
|
|
57
|
-
:SSLCertName => [["CN", "Celerity"]]
|
|
58
|
-
)
|
|
59
|
-
@host = "https://localhost:#{@port}"
|
|
60
|
-
else
|
|
61
|
-
@host = "http://localhost:#{@port}"
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
server = WEBrick::HTTPServer.new(server_options)
|
|
65
|
-
server.mount("/", WEBrick::HTTPServlet::FileHandler, @doc_root, {:FancyIndexing=>true})
|
|
66
|
-
server.mount("/post_to_me", PostHandler)
|
|
67
|
-
server.mount("/plain_text", PlainTextHandler)
|
|
68
|
-
server.mount("/ajax", SlowAjaxHandler)
|
|
69
|
-
|
|
70
|
-
@thread = Thread.new { server.start }
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
data/tasks/rspec.rake
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
begin
|
|
2
|
-
require 'spec'
|
|
3
|
-
rescue LoadError
|
|
4
|
-
require 'rubygems'
|
|
5
|
-
require 'spec'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
begin
|
|
9
|
-
require 'spec/rake/spectask'
|
|
10
|
-
rescue LoadError
|
|
11
|
-
puts <<-EOS
|
|
12
|
-
To use rspec for testing you must install rspec gem:
|
|
13
|
-
gem install rspec
|
|
14
|
-
EOS
|
|
15
|
-
exit(0)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
desc "Run the specs under spec/"
|
|
19
|
-
Spec::Rake::SpecTask.new do |t|
|
|
20
|
-
t.spec_opts = ['--options', "spec/spec.opts"]
|
|
21
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
|
22
|
-
|
|
23
|
-
begin
|
|
24
|
-
require 'rcov'
|
|
25
|
-
t.rcov = true
|
|
26
|
-
t.rcov_opts = ['--exclude', 'spec,fcntl,path_helper', '--no-rcovrt']
|
|
27
|
-
rescue LoadError
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
end
|
data/tasks/specserver.rake
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
namespace :specserver do
|
|
2
|
-
task :http do
|
|
3
|
-
require File.dirname(__FILE__) + "/../support/spec_server.rb"
|
|
4
|
-
s = Celerity::SpecServer.new
|
|
5
|
-
s.run
|
|
6
|
-
puts "server started on #{s.host}\n log at: #{s.log_file}"
|
|
7
|
-
s.thread.join
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
desc "Run HTTPS webserver for specs"
|
|
11
|
-
task :https do
|
|
12
|
-
require File.dirname(__FILE__) + "/../support/spec_server.rb"
|
|
13
|
-
s = Celerity::SpecServer.new(:ssl => true)
|
|
14
|
-
s.run
|
|
15
|
-
puts "server started on #{s.host}\n log at: #{s.log_file}"
|
|
16
|
-
s.thread.join
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
desc "Run HTTP webserver for specs"
|
|
21
|
-
task :specserver => [:'specserver:http']
|
metadata.gz.sig
DELETED
|
Binary file
|