insite 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/insite/constants.rb +12 -32
- data/lib/insite/element/generated/class_map.rb +0 -22
- data/lib/insite/element/generated/element_classes.rb +0 -66
- data/lib/insite/element/generated/element_instance_methods.rb +0 -80
- data/lib/insite/insite.rb +15 -5
- data/lib/insite/methods/common_methods.rb +0 -2
- data/lib/insite/page/defined_page.rb +47 -25
- data/lib/insite/version.rb +1 -1
- metadata +2 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16f1ba3790818bbea311d4b4ae7dfafa48ce7e054e157797817ac6554efac22a
|
4
|
+
data.tar.gz: fcb7131304d81c5556913a24f085eb1f7df2c62d8f0bdb97a410f15bd9c7bb03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac5b61ba8ccde92a29dd8450fa6a8a079e201eec5571ab4fa5f0413d5f2de5f15b70d5624ee0f87cddd96a1dcaadf9f3393330f147ee93bdb3a8fb3ff48036b5
|
7
|
+
data.tar.gz: 86d7e500ec84c9061f5a1d8a7078b945fe1a8fcd714d8e3f5f7ec2bc68a96247b877fcb88c2d4506e77c74e6cfafa0b071d882b1a048b974d3e642fb6f9249ec
|
data/lib/insite/constants.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Insite
|
2
2
|
METHOD_MAP = {Watir::Rect=>[:rect],
|
3
|
-
Watir::Menu=>[:menu],
|
4
3
|
Watir::HTMLElement=>
|
5
4
|
[:var,
|
6
5
|
:i,
|
@@ -87,8 +86,6 @@ module Insite
|
|
87
86
|
Watir::TimeCollection=>[:times],
|
88
87
|
Watir::Circle=>[:circle],
|
89
88
|
Watir::CircleCollection=>[:circles],
|
90
|
-
Watir::Cursor=>[:cursor],
|
91
|
-
Watir::CursorCollection=>[:cursors],
|
92
89
|
Watir::Defs=>[:defs],
|
93
90
|
Watir::DefsCollection=>[:defss],
|
94
91
|
Watir::Desc=>[:desc],
|
@@ -99,20 +96,10 @@ module Insite
|
|
99
96
|
Watir::ForeignObjectCollection=>[:foreign_objects],
|
100
97
|
Watir::GCollection=>[:gs],
|
101
98
|
Watir::Button=>[:button],
|
102
|
-
Watir::Hatchpath=>[:hatchpath],
|
103
|
-
Watir::HatchpathCollection=>[:hatchpaths],
|
104
99
|
Watir::LinearGradient=>[:linear_gradient],
|
105
100
|
Watir::LinearGradientCollection=>[:linear_gradients],
|
106
101
|
Watir::Marker=>[:marker],
|
107
102
|
Watir::MarkerCollection=>[:markers],
|
108
|
-
Watir::Mesh=>[:mesh],
|
109
|
-
Watir::MeshCollection=>[:meshes],
|
110
|
-
Watir::MeshGradient=>[:meshgradient],
|
111
|
-
Watir::MeshGradientCollection=>[:meshgradients],
|
112
|
-
Watir::Meshpatch=>[:meshpatch],
|
113
|
-
Watir::MeshpatchCollection=>[:meshpatches],
|
114
|
-
Watir::Meshrow=>[:meshrow],
|
115
|
-
Watir::MeshrowCollection=>[:meshrows],
|
116
103
|
Watir::MetadataCollection=>[:metadatas],
|
117
104
|
Watir::PatternCollection=>[:patterns],
|
118
105
|
Watir::Polygon=>[:polygon],
|
@@ -122,10 +109,8 @@ module Insite
|
|
122
109
|
Watir::AreaCollection=>[:areas],
|
123
110
|
Watir::PolylineCollection=>[:polylines],
|
124
111
|
Watir::Script=>[:script],
|
125
|
-
Watir::Solidcolor=>[:solidcolor],
|
126
112
|
Watir::RadialGradient=>[:radial_gradient],
|
127
113
|
Watir::RadialGradientCollection=>[:radial_gradients],
|
128
|
-
Watir::SolidcolorCollection=>[:solidcolors],
|
129
114
|
Watir::RectCollection=>[:rects],
|
130
115
|
Watir::SVG=>[:svg],
|
131
116
|
Watir::SVGCollection=>[:svgs],
|
@@ -209,14 +194,10 @@ module Insite
|
|
209
194
|
Watir::HtmlCollection=>[:htmls],
|
210
195
|
Watir::HR=>[:hr],
|
211
196
|
Watir::IFrame=>[:iframe],
|
212
|
-
Watir::Keygen=>[:keygen],
|
213
197
|
Watir::InputCollection=>[:inputs],
|
214
|
-
Watir::KeygenCollection=>[:keygens],
|
215
198
|
Watir::LegendCollection=>[:legends],
|
216
199
|
Watir::LICollection=>[:lis],
|
217
200
|
Watir::IFrameCollection=>[:iframes],
|
218
|
-
Watir::MenuItem=>[:menuitem],
|
219
|
-
Watir::MenuCollection=>[:menus],
|
220
201
|
Watir::Legend=>[:legend],
|
221
202
|
Watir::Meter=>[:meter],
|
222
203
|
Watir::Label=>[:label],
|
@@ -225,7 +206,6 @@ module Insite
|
|
225
206
|
Watir::MeterCollection=>[:meters],
|
226
207
|
Watir::MetaCollection=>[:metas],
|
227
208
|
Watir::Param=>[:param],
|
228
|
-
Watir::MenuItemCollection=>[:menuitems],
|
229
209
|
Watir::Data=>[:data],
|
230
210
|
Watir::OptGroupCollection=>[:optgroups],
|
231
211
|
Watir::OList=>[:ol],
|
@@ -293,9 +273,9 @@ module Insite
|
|
293
273
|
# Watir DOM methods. This data is used to create class-level element accessors
|
294
274
|
# for page objects.
|
295
275
|
DOM_METHODS = %i(
|
296
|
-
a br datalists elements forms hidden li
|
297
|
-
abbr brs datas ellipse frame hiddens line
|
298
|
-
abbrs bs date_field ellipses frames hr linear_gradient
|
276
|
+
a br datalists elements forms hidden li params rect source tbody tspan
|
277
|
+
abbr brs datas ellipse frame hiddens line path rects sources tbodys tspans
|
278
|
+
abbrs bs date_field ellipses frames hr linear_gradient paths rp span td u
|
299
279
|
address button date_fields em frameset hrs linear_gradients meta pattern rps spans tds ul
|
300
280
|
addresses buttons date_time_field embed framesets htmls lines metadata patterns rt ss template uls
|
301
281
|
area canvas date_time_fields embeds g i link metadatas picture rtc stop templates us
|
@@ -309,14 +289,14 @@ module Insite
|
|
309
289
|
audios cite descs figcaptions h4 inputs marker object progress script summaries tfoots views
|
310
290
|
b cites details figure h4s ins markers objects progresses scripts summary th wbr
|
311
291
|
base code detailses figures h5 inses marks ol ps section sup thead wbrs
|
312
|
-
bases codes dfn file_field h5s is
|
313
|
-
bdi col dfns file_fields h6 kbd
|
314
|
-
bdis colgroup div font h6s kbds
|
315
|
-
bdo colgroups divs fonts
|
316
|
-
bdos cols dl footer
|
317
|
-
blockquote
|
318
|
-
blockquotes
|
319
|
-
body data dts foreign_objects headers legend
|
320
|
-
bodys datalist element form heads legends
|
292
|
+
bases codes dfn file_field h5s is ols q sections sups theads
|
293
|
+
bdi col dfns file_fields h6 kbd optgroup qs select svg ths
|
294
|
+
bdis colgroup div font h6s kbds optgroups radial_gradient select_list svgs time
|
295
|
+
bdo colgroups divs fonts option radial_gradients select_lists switch times
|
296
|
+
bdos cols dl footer options radio selects switches titles
|
297
|
+
blockquote dls footers head label output small symbol tr
|
298
|
+
blockquotes dt foreign_object header labels outputs radios smalls symbols track
|
299
|
+
body data dts foreign_objects headers legend p rb table tracks
|
300
|
+
bodys datalist element form heads legends param rbs tables trs
|
321
301
|
).freeze
|
322
302
|
end
|
@@ -24,8 +24,6 @@ module Insite
|
|
24
24
|
Watir::CheckBoxCollection => Insite::CheckBoxCollection,
|
25
25
|
Watir::Circle => Insite::Circle,
|
26
26
|
Watir::CircleCollection => Insite::CircleCollection,
|
27
|
-
Watir::Cursor => Insite::Cursor,
|
28
|
-
Watir::CursorCollection => Insite::CursorCollection,
|
29
27
|
Watir::DList => Insite::DList,
|
30
28
|
Watir::DListCollection => Insite::DListCollection,
|
31
29
|
Watir::Data => Insite::Data,
|
@@ -76,10 +74,6 @@ module Insite
|
|
76
74
|
Watir::HRCollection => Insite::HRCollection,
|
77
75
|
Watir::HTMLElement => Insite::HTMLElement,
|
78
76
|
Watir::HTMLElementCollection => Insite::HTMLElementCollection,
|
79
|
-
Watir::Hatch => Insite::Hatch,
|
80
|
-
Watir::HatchCollection => Insite::HatchCollection,
|
81
|
-
Watir::Hatchpath => Insite::Hatchpath,
|
82
|
-
Watir::HatchpathCollection => Insite::HatchpathCollection,
|
83
77
|
Watir::Head => Insite::Head,
|
84
78
|
Watir::HeadCollection => Insite::HeadCollection,
|
85
79
|
Watir::Heading => Insite::Heading,
|
@@ -94,8 +88,6 @@ module Insite
|
|
94
88
|
Watir::ImageCollection => Insite::ImageCollection,
|
95
89
|
Watir::Input => Insite::Input,
|
96
90
|
Watir::InputCollection => Insite::InputCollection,
|
97
|
-
Watir::Keygen => Insite::Keygen,
|
98
|
-
Watir::KeygenCollection => Insite::KeygenCollection,
|
99
91
|
Watir::LI => Insite::LI,
|
100
92
|
Watir::LICollection => Insite::LICollection,
|
101
93
|
Watir::Label => Insite::Label,
|
@@ -114,18 +106,6 @@ module Insite
|
|
114
106
|
Watir::MarqueeCollection => Insite::MarqueeCollection,
|
115
107
|
Watir::Media => Insite::Media,
|
116
108
|
Watir::MediaCollection => Insite::MediaCollection,
|
117
|
-
Watir::Menu => Insite::Menu,
|
118
|
-
Watir::MenuCollection => Insite::MenuCollection,
|
119
|
-
Watir::MenuItem => Insite::MenuItem,
|
120
|
-
Watir::MenuItemCollection => Insite::MenuItemCollection,
|
121
|
-
Watir::Mesh => Insite::Mesh,
|
122
|
-
Watir::MeshCollection => Insite::MeshCollection,
|
123
|
-
Watir::MeshGradient => Insite::MeshGradient,
|
124
|
-
Watir::MeshGradientCollection => Insite::MeshGradientCollection,
|
125
|
-
Watir::Meshpatch => Insite::Meshpatch,
|
126
|
-
Watir::MeshpatchCollection => Insite::MeshpatchCollection,
|
127
|
-
Watir::Meshrow => Insite::Meshrow,
|
128
|
-
Watir::MeshrowCollection => Insite::MeshrowCollection,
|
129
109
|
Watir::Meta => Insite::Meta,
|
130
110
|
Watir::MetaCollection => Insite::MetaCollection,
|
131
111
|
Watir::Metadata => Insite::Metadata,
|
@@ -180,8 +160,6 @@ module Insite
|
|
180
160
|
Watir::ScriptCollection => Insite::ScriptCollection,
|
181
161
|
Watir::Select => Insite::Select,
|
182
162
|
Watir::SelectCollection => Insite::SelectCollection,
|
183
|
-
Watir::Solidcolor => Insite::Solidcolor,
|
184
|
-
Watir::SolidcolorCollection => Insite::SolidcolorCollection,
|
185
163
|
Watir::Source => Insite::Source,
|
186
164
|
Watir::SourceCollection => Insite::SourceCollection,
|
187
165
|
Watir::Span => Insite::Span,
|
@@ -71,12 +71,6 @@ module Insite
|
|
71
71
|
class CircleCollection < Insite::ElementCollection
|
72
72
|
end
|
73
73
|
|
74
|
-
class Cursor < Insite::Element
|
75
|
-
end
|
76
|
-
|
77
|
-
class CursorCollection < Insite::ElementCollection
|
78
|
-
end
|
79
|
-
|
80
74
|
class DList < Insite::Element
|
81
75
|
end
|
82
76
|
|
@@ -227,18 +221,6 @@ module Insite
|
|
227
221
|
class HTMLElementCollection < Insite::ElementCollection
|
228
222
|
end
|
229
223
|
|
230
|
-
class Hatch < Insite::Element
|
231
|
-
end
|
232
|
-
|
233
|
-
class HatchCollection < Insite::ElementCollection
|
234
|
-
end
|
235
|
-
|
236
|
-
class Hatchpath < Insite::Element
|
237
|
-
end
|
238
|
-
|
239
|
-
class HatchpathCollection < Insite::ElementCollection
|
240
|
-
end
|
241
|
-
|
242
224
|
class Head < Insite::Element
|
243
225
|
end
|
244
226
|
|
@@ -281,12 +263,6 @@ module Insite
|
|
281
263
|
class InputCollection < Insite::ElementCollection
|
282
264
|
end
|
283
265
|
|
284
|
-
class Keygen < Insite::Element
|
285
|
-
end
|
286
|
-
|
287
|
-
class KeygenCollection < Insite::ElementCollection
|
288
|
-
end
|
289
|
-
|
290
266
|
class LI < Insite::Element
|
291
267
|
end
|
292
268
|
|
@@ -341,42 +317,6 @@ module Insite
|
|
341
317
|
class MediaCollection < Insite::ElementCollection
|
342
318
|
end
|
343
319
|
|
344
|
-
class Menu < Insite::Element
|
345
|
-
end
|
346
|
-
|
347
|
-
class MenuCollection < Insite::ElementCollection
|
348
|
-
end
|
349
|
-
|
350
|
-
class MenuItem < Insite::Element
|
351
|
-
end
|
352
|
-
|
353
|
-
class MenuItemCollection < Insite::ElementCollection
|
354
|
-
end
|
355
|
-
|
356
|
-
class Mesh < Insite::Element
|
357
|
-
end
|
358
|
-
|
359
|
-
class MeshCollection < Insite::ElementCollection
|
360
|
-
end
|
361
|
-
|
362
|
-
class MeshGradient < Insite::Element
|
363
|
-
end
|
364
|
-
|
365
|
-
class MeshGradientCollection < Insite::ElementCollection
|
366
|
-
end
|
367
|
-
|
368
|
-
class Meshpatch < Insite::Element
|
369
|
-
end
|
370
|
-
|
371
|
-
class MeshpatchCollection < Insite::ElementCollection
|
372
|
-
end
|
373
|
-
|
374
|
-
class Meshrow < Insite::Element
|
375
|
-
end
|
376
|
-
|
377
|
-
class MeshrowCollection < Insite::ElementCollection
|
378
|
-
end
|
379
|
-
|
380
320
|
class Meta < Insite::Element
|
381
321
|
end
|
382
322
|
|
@@ -539,12 +479,6 @@ module Insite
|
|
539
479
|
class SelectCollection < Insite::ElementCollection
|
540
480
|
end
|
541
481
|
|
542
|
-
class Solidcolor < Insite::Element
|
543
|
-
end
|
544
|
-
|
545
|
-
class SolidcolorCollection < Insite::ElementCollection
|
546
|
-
end
|
547
|
-
|
548
482
|
class Source < Insite::Element
|
549
483
|
end
|
550
484
|
|
@@ -184,14 +184,6 @@ module Insite
|
|
184
184
|
Insite::TableColCollection.new(self, parse_args(args).merge(tag_name: "col"))
|
185
185
|
end
|
186
186
|
|
187
|
-
def cursor(*args)
|
188
|
-
Insite::Cursor.new(self, parse_args(args).merge(tag_name: "cursor"))
|
189
|
-
end
|
190
|
-
|
191
|
-
def cursors(*args)
|
192
|
-
Insite::CursorCollection.new(self, parse_args(args).merge(tag_name: "cursor"))
|
193
|
-
end
|
194
|
-
|
195
187
|
def data(*args)
|
196
188
|
Insite::Data.new(self, parse_args(args).merge(tag_name: "data"))
|
197
189
|
end
|
@@ -472,14 +464,6 @@ module Insite
|
|
472
464
|
Insite::HeadingCollection.new(self, parse_args(args).merge(tag_name: "h6"))
|
473
465
|
end
|
474
466
|
|
475
|
-
def hatchpath(*args)
|
476
|
-
Insite::Hatchpath.new(self, parse_args(args).merge(tag_name: "hatchpath"))
|
477
|
-
end
|
478
|
-
|
479
|
-
def hatchpaths(*args)
|
480
|
-
Insite::HatchpathCollection.new(self, parse_args(args).merge(tag_name: "hatchpath"))
|
481
|
-
end
|
482
|
-
|
483
467
|
def head(*args)
|
484
468
|
Insite::Head.new(self, parse_args(args).merge(tag_name: "head"))
|
485
469
|
end
|
@@ -572,14 +556,6 @@ module Insite
|
|
572
556
|
Insite::HTMLElementCollection.new(self, parse_args(args).merge(tag_name: "kbd"))
|
573
557
|
end
|
574
558
|
|
575
|
-
def keygen(*args)
|
576
|
-
Insite::Keygen.new(self, parse_args(args).merge(tag_name: "keygen"))
|
577
|
-
end
|
578
|
-
|
579
|
-
def keygens(*args)
|
580
|
-
Insite::KeygenCollection.new(self, parse_args(args).merge(tag_name: "keygen"))
|
581
|
-
end
|
582
|
-
|
583
559
|
def label(*args)
|
584
560
|
Insite::Label.new(self, parse_args(args).merge(tag_name: "label"))
|
585
561
|
end
|
@@ -660,54 +636,6 @@ module Insite
|
|
660
636
|
Insite::HTMLElementCollection.new(self, parse_args(args).merge(tag_name: "mark"))
|
661
637
|
end
|
662
638
|
|
663
|
-
def menu(*args)
|
664
|
-
Insite::Menu.new(self, parse_args(args).merge(tag_name: "menu"))
|
665
|
-
end
|
666
|
-
|
667
|
-
def menuitem(*args)
|
668
|
-
Insite::MenuItem.new(self, parse_args(args).merge(tag_name: "menuitem"))
|
669
|
-
end
|
670
|
-
|
671
|
-
def menuitems(*args)
|
672
|
-
Insite::MenuItemCollection.new(self, parse_args(args).merge(tag_name: "menuitem"))
|
673
|
-
end
|
674
|
-
|
675
|
-
def menus(*args)
|
676
|
-
Insite::MenuCollection.new(self, parse_args(args).merge(tag_name: "menu"))
|
677
|
-
end
|
678
|
-
|
679
|
-
def mesh(*args)
|
680
|
-
Insite::Mesh.new(self, parse_args(args).merge(tag_name: "mesh"))
|
681
|
-
end
|
682
|
-
|
683
|
-
def meshes(*args)
|
684
|
-
Insite::MeshCollection.new(self, parse_args(args).merge(tag_name: "mesh"))
|
685
|
-
end
|
686
|
-
|
687
|
-
def meshgradient(*args)
|
688
|
-
Insite::MeshGradient.new(self, parse_args(args).merge(tag_name: "meshgradient"))
|
689
|
-
end
|
690
|
-
|
691
|
-
def meshgradients(*args)
|
692
|
-
Insite::MeshGradientCollection.new(self, parse_args(args).merge(tag_name: "meshgradient"))
|
693
|
-
end
|
694
|
-
|
695
|
-
def meshpatch(*args)
|
696
|
-
Insite::Meshpatch.new(self, parse_args(args).merge(tag_name: "meshpatch"))
|
697
|
-
end
|
698
|
-
|
699
|
-
def meshpatches(*args)
|
700
|
-
Insite::MeshpatchCollection.new(self, parse_args(args).merge(tag_name: "meshpatch"))
|
701
|
-
end
|
702
|
-
|
703
|
-
def meshrow(*args)
|
704
|
-
Insite::Meshrow.new(self, parse_args(args).merge(tag_name: "meshrow"))
|
705
|
-
end
|
706
|
-
|
707
|
-
def meshrows(*args)
|
708
|
-
Insite::MeshrowCollection.new(self, parse_args(args).merge(tag_name: "meshrow"))
|
709
|
-
end
|
710
|
-
|
711
639
|
def meta(*args)
|
712
640
|
Insite::Meta.new(self, parse_args(args).merge(tag_name: "meta"))
|
713
641
|
end
|
@@ -984,14 +912,6 @@ module Insite
|
|
984
912
|
Insite::HTMLElementCollection.new(self, parse_args(args).merge(tag_name: "small"))
|
985
913
|
end
|
986
914
|
|
987
|
-
def solidcolor(*args)
|
988
|
-
Insite::Solidcolor.new(self, parse_args(args).merge(tag_name: "solidcolor"))
|
989
|
-
end
|
990
|
-
|
991
|
-
def solidcolors(*args)
|
992
|
-
Insite::SolidcolorCollection.new(self, parse_args(args).merge(tag_name: "solidcolor"))
|
993
|
-
end
|
994
|
-
|
995
915
|
def source(*args)
|
996
916
|
Insite::Source.new(self, parse_args(args).merge(tag_name: "source"))
|
997
917
|
end
|
data/lib/insite/insite.rb
CHANGED
@@ -118,14 +118,14 @@ module Insite
|
|
118
118
|
# TODO: Sort args.
|
119
119
|
def initialize(base_url = nil, hsh={})
|
120
120
|
@site = self
|
121
|
-
@arguments = hsh.with_indifferent_access
|
121
|
+
@arguments = hsh.merge({scheme: 'https'}).with_indifferent_access
|
122
122
|
@base_url = base_url
|
123
123
|
@browser_type = (@arguments[:browser] ? @arguments[:browser].to_sym : nil)
|
124
124
|
|
125
|
-
#
|
126
|
-
# should never be used directly.
|
125
|
+
# Don't include the base page class or any page templates in the site's
|
126
|
+
# pages. Those should never be used directly.
|
127
127
|
@pages = self.class::DefinedPage.descendants.reject do |pg|
|
128
|
-
pg.page_template?
|
128
|
+
pg.page_template? || pg == self.class::Page
|
129
129
|
end
|
130
130
|
|
131
131
|
# Builds generic components for custom tags.
|
@@ -444,5 +444,15 @@ module Insite
|
|
444
444
|
@browser.url
|
445
445
|
end
|
446
446
|
|
447
|
-
|
447
|
+
private
|
448
|
+
def process_base_url(base)
|
449
|
+
case base
|
450
|
+
when /^(https\:|http\:)/
|
451
|
+
base.sub(/^(http\:|https\:)/, "{scheme}:")
|
452
|
+
when /^www\./
|
453
|
+
base.sub(/^www\./, "{scheme}://")
|
454
|
+
else
|
455
|
+
"{scheme}://#{base}"
|
456
|
+
end
|
457
|
+
end
|
448
458
|
end
|
@@ -174,16 +174,18 @@ module Insite
|
|
174
174
|
def set_url_template(base_url)
|
175
175
|
case @page_url
|
176
176
|
when nil, ''
|
177
|
-
@url_template = Addressable::Template.new(
|
177
|
+
@url_template = Addressable::Template.new(
|
178
|
+
process_base_url(base_url)
|
179
|
+
)
|
178
180
|
when /(http:\/\/|https:\/\/)/i
|
179
181
|
@url_template = Addressable::Template.new(
|
180
|
-
|
182
|
+
process_base_url(
|
183
|
+
@page_url.gsub(/(?<!:)\/\/+/, '/')
|
184
|
+
)
|
181
185
|
)
|
182
186
|
else
|
183
187
|
@url_template = Addressable::Template.new(
|
184
|
-
|
185
|
-
"#{base_url}#{@page_url}".gsub(/(?<!:)\/\/+/, '/')
|
186
|
-
)
|
188
|
+
"#{process_base_url(base_url)}#{@page_url}".gsub(/(?<!:)\/\/+/, '/')
|
187
189
|
)
|
188
190
|
end
|
189
191
|
|
@@ -202,16 +204,17 @@ module Insite
|
|
202
204
|
regexp ? @url_matcher = regexp : nil
|
203
205
|
end
|
204
206
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
207
|
+
private
|
208
|
+
def process_base_url(base)
|
209
|
+
case base
|
210
|
+
when /^(https\:|http\:)/
|
211
|
+
base.sub(/^(http\:|https\:)/, "{scheme}:")
|
212
|
+
when /^www\./
|
213
|
+
base.sub(/^www\./, "{scheme}://")
|
214
|
+
else
|
215
|
+
"{scheme}://#{base}"
|
216
|
+
end
|
217
|
+
end
|
215
218
|
end # Self.
|
216
219
|
|
217
220
|
def browser?
|
@@ -254,10 +257,23 @@ module Insite
|
|
254
257
|
@query_arguments = self.class.query_arguments
|
255
258
|
@has_fragment = self.class.has_fragment
|
256
259
|
|
257
|
-
# Try to expand the URL template if the URL has parameters.
|
258
|
-
|
260
|
+
# Try to expand the URL template if the URL has parameters. Stores the
|
261
|
+
# param list that will expand the url_template after examining the
|
262
|
+
# arguments used to initialize the page. (Start with an empty hash and
|
263
|
+
# then build it out.)
|
264
|
+
@arguments = {}.with_indifferent_access
|
265
|
+
|
259
266
|
match = @url_template.match(@browser.url)
|
260
267
|
|
268
|
+
# Raise if args are provided and the page doesn't take any args.
|
269
|
+
if (@required_arguments - [:scheme]).empty? && args
|
270
|
+
raise(
|
271
|
+
Insite::Errors::PageInitError,
|
272
|
+
"#{args.class} was provided as a #{self.class.name} initialization argument, " \
|
273
|
+
"but the page URL doesn't require any arguments.\n\n#{caller.join("\n")}"
|
274
|
+
)
|
275
|
+
end
|
276
|
+
|
261
277
|
if @required_arguments.present? && !args
|
262
278
|
@required_arguments.each do |arg|
|
263
279
|
if match && match.keys.include?(arg.to_s)
|
@@ -278,14 +294,16 @@ module Insite
|
|
278
294
|
elsif @required_arguments.present?
|
279
295
|
@required_arguments.each do |arg| # Try to extract each URL argument from the hash or object provided, OR from the site object.
|
280
296
|
if args.is_a?(Hash) && args.present?
|
281
|
-
args = args.with_indifferent_access
|
297
|
+
# args = args.with_indifferent_access
|
282
298
|
|
283
|
-
if
|
299
|
+
if @arguments[arg] #The hash has the required argument.
|
284
300
|
@arguments[arg]= args[arg]
|
285
301
|
elsif match && match.keys.include?(arg.to_s)
|
286
302
|
@arguments[arg] = match[arg.to_s]
|
287
303
|
elsif @site.respond_to?(arg)
|
288
304
|
@arguments[arg] = site.public_send(arg)
|
305
|
+
elsif @site.arguments[arg]
|
306
|
+
@arguments[arg] = @site.arguments[arg]
|
289
307
|
else
|
290
308
|
raise(
|
291
309
|
Insite::Errors::PageInitError,
|
@@ -296,9 +314,12 @@ module Insite
|
|
296
314
|
end
|
297
315
|
elsif args # Some non-hash object was provided.
|
298
316
|
if args.respond_to?(arg) #The hash has the required argument.
|
317
|
+
# @arguments[arg]= args.public_send(arg)
|
299
318
|
@arguments[arg]= args.public_send(arg)
|
300
319
|
elsif @site.respond_to?(arg)
|
301
320
|
@arguments[arg]= site.public_send(arg)
|
321
|
+
elsif @site.arguments[arg]
|
322
|
+
@arguments[arg] = @site.arguments[arg]
|
302
323
|
else
|
303
324
|
raise(
|
304
325
|
Insite::Errors::PageInitError,
|
@@ -311,12 +332,13 @@ module Insite
|
|
311
332
|
# Do nothing here yet.
|
312
333
|
end
|
313
334
|
end
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
335
|
+
# If there are no required arguments then nothing should be provided.
|
336
|
+
# elsif (@required_arguments - [:scheme]).empty? && args
|
337
|
+
# raise(
|
338
|
+
# Insite::Errors::PageInitError,
|
339
|
+
# "#{args.class} was provided as a #{self.class.name} initialization argument, " \
|
340
|
+
# "but the page URL doesn't require any arguments.\n\n#{caller.join("\n")}"
|
341
|
+
# )
|
320
342
|
else
|
321
343
|
# Do nothing here yet.
|
322
344
|
end
|
data/lib/insite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Fitisoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -73,9 +73,6 @@ dependencies:
|
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 6.11.0
|
76
|
-
- - "<"
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 6.14.0
|
79
76
|
type: :runtime
|
80
77
|
prerelease: false
|
81
78
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -83,9 +80,6 @@ dependencies:
|
|
83
80
|
- - ">="
|
84
81
|
- !ruby/object:Gem::Version
|
85
82
|
version: 6.11.0
|
86
|
-
- - "<"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: 6.14.0
|
89
83
|
- !ruby/object:Gem::Dependency
|
90
84
|
name: watir-scroll
|
91
85
|
requirement: !ruby/object:Gem::Requirement
|