page_navigation 0.2 → 0.3

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/ChangeLog CHANGED
@@ -1,4 +1,7 @@
1
- === Version 0.2 / 2012-1-25
1
+ === Version 0.3 / 2013-1-26
2
+ * Fixed issue when navigating from a page to the same page
3
+
4
+ === Version 0.2 / 2013-1-25
2
5
  * Fixed minor issue when module is included in module that is included in Class
3
6
 
4
7
  === Version 0.1 / 2013-1-25
@@ -1,3 +1,3 @@
1
1
  module PageNavigation
2
- VERSION = "0.2"
2
+ VERSION = "0.3"
3
3
  end
@@ -73,9 +73,10 @@ module PageNavigation
73
73
  #
74
74
  def continue_navigation_to(page_cls, how = {:using => :default}, &block)
75
75
  path = path_for how
76
- from_index = find_index_for(path, @current_page.class)+1
76
+ from_index = find_index_for(path, @current_page.class)
77
77
  to_index = find_index_for(path, page_cls)-1
78
- navigate_through_pages(path[from_index..to_index])
78
+ navigate_through_pages([path[from_index]]) if from_index == to_index
79
+ navigate_through_pages(path[from_index..to_index]) unless from_index == to_index
79
80
  on(page_cls, &block)
80
81
  end
81
82
 
@@ -78,12 +78,29 @@ describe PageNavigation do
78
78
  [AnotherPage, :b_method],
79
79
  [YetAnotherPage, :c_method]]
80
80
  }
81
- fake_page = double('a_page')
81
+ @navigator.current_page = FactoryTestPage.new
82
+ f_page = FactoryTestPage.new
83
+ FactoryTestPage.should_receive(:new).and_return(f_page)
84
+ f_page.should_receive(:respond_to?).with(:a_method).and_return(true)
85
+ f_page.should_receive(:a_method)
86
+ a_page = AnotherPage.new
87
+ AnotherPage.should_receive(:new).and_return(a_page)
88
+ a_page.should_receive(:respond_to?).with(:b_method).and_return(true)
89
+ a_page.should_receive(:b_method)
90
+ @navigator.continue_navigation_to(YetAnotherPage).class.should == YetAnotherPage
91
+ end
92
+
93
+ it "should know how to continue routng from a location that is one page from the end" do
94
+ TestNavigator.routes = {
95
+ :default => [[FactoryTestPage, :a_method],
96
+ [AnotherPage, :b_method],
97
+ [YetAnotherPage, :c_method]]
98
+ }
99
+ @navigator.current_page = AnotherPage.new
100
+ fake_page = AnotherPage.new
82
101
  AnotherPage.should_receive(:new).and_return(fake_page)
83
102
  fake_page.should_receive(:respond_to?).with(:b_method).and_return(true)
84
103
  fake_page.should_receive(:b_method)
85
- @navigator.current_page = FactoryTestPage.new
86
- FactoryTestPage.should_not_receive(:new)
87
104
  @navigator.continue_navigation_to(YetAnotherPage).class.should == YetAnotherPage
88
105
  end
89
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-26 00:00:00.000000000 Z
12
+ date: 2013-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -63,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
63
  version: '0'
64
64
  segments:
65
65
  - 0
66
- hash: 1381246942640339342
66
+ hash: -751630789489587890
67
67
  required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  none: false
69
69
  requirements:
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  version: '0'
73
73
  segments:
74
74
  - 0
75
- hash: 1381246942640339342
75
+ hash: -751630789489587890
76
76
  requirements: []
77
77
  rubyforge_project: page_naigation
78
78
  rubygems_version: 1.8.24