page_navigation 0.8 → 0.9
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.
- checksums.yaml +4 -4
- data/ChangeLog +4 -1
- data/lib/page_navigation.rb +3 -1
- data/lib/page_navigation/version.rb +1 -1
- data/spec/lib/page_navigation_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ebc2cb244eb336736f35d2bebd8ffe53070dd32
|
4
|
+
data.tar.gz: f04fc258fdb71e36343d247700258ad9da77cb40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f78f9d41851504fe576f033be34342b8d936449fd5a7460b064d353e22ecaedfbc3224391bf0c2e90928a73a1d98d72062413cd85fd66cef501a65cb4d48a124
|
7
|
+
data.tar.gz: d1d31040c6989a4d0a6029caa6f450a1a0363eed048984ae2c5a41c8b0d2685d639d71efd3d575476dcefcdefe3cc63c5a27cfc54bf7ba1f02b65623499927bf
|
data/ChangeLog
CHANGED
data/lib/page_navigation.rb
CHANGED
@@ -55,12 +55,14 @@ module PageNavigation
|
|
55
55
|
# @return [PageObject] the page you are navigating to
|
56
56
|
#
|
57
57
|
def navigate_to(page_cls, how = {:using => :default}, &block)
|
58
|
+
how[:using] = :default unless how[:using]
|
58
59
|
path = path_for how
|
59
60
|
to_index = find_index_for(path, page_cls)-1
|
60
61
|
if to_index == -1
|
61
62
|
return on(page_cls, &block)
|
62
63
|
else
|
63
|
-
|
64
|
+
start = how[:from] ? path.find_index { |entry| entry[0] == how[:from] } : 0
|
65
|
+
navigate_through_pages(path[start..to_index])
|
64
66
|
end
|
65
67
|
on(page_cls, &block)
|
66
68
|
end
|
@@ -145,4 +145,19 @@ describe PageNavigation do
|
|
145
145
|
y_page.should_receive(:c_method)
|
146
146
|
@navigator.navigate_all
|
147
147
|
end
|
148
|
+
|
149
|
+
it "should be able to start in the middle of a route and proceed" do
|
150
|
+
TestNavigator.routes = {
|
151
|
+
:default => [[FactoryTestPage, :a_method],
|
152
|
+
[AnotherPage, :b_method],
|
153
|
+
[YetAnotherPage, :c_method]]
|
154
|
+
}
|
155
|
+
a_page = AnotherPage.new
|
156
|
+
y_page = YetAnotherPage.new
|
157
|
+
AnotherPage.should_receive(:new).and_return(a_page)
|
158
|
+
a_page.should_receive(:respond_to?).with(:b_method).and_return(true)
|
159
|
+
a_page.should_receive(:b_method)
|
160
|
+
YetAnotherPage.should_receive(:new).and_return(y_page)
|
161
|
+
@navigator.navigate_to(YetAnotherPage, :from => AnotherPage)
|
162
|
+
end
|
148
163
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: page_navigation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.9'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey S. Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: data_magic
|