gametel 0.5.4 → 0.5.5

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.
@@ -10,5 +10,5 @@ Feature: Navigation through the screens of the application
10
10
 
11
11
  Scenario: Navigating to a screen starting with a current screen
12
12
  Given I am on the the ViewsMenuScreen
13
- When I navigate to the Controls screen
13
+ When I continue navigating to the Controls screen
14
14
  Then I should see the text "Checkbox 1" on the screen
@@ -2,11 +2,14 @@ When /^I navigate to the Controls screen$/ do
2
2
  navigate_to(ControlsScreen)
3
3
  end
4
4
 
5
+ When /^I continue navigating to the Controls screen$/ do
6
+ continue_navigation_to(ControlsScreen)
7
+ end
8
+
5
9
  When /^I navigate to the Buttons screen using the "(.*?)" route$/ do |route|
6
10
  navigate_to(ButtonScreen, :using => route.to_sym)
7
11
  end
8
12
 
9
13
  Given /^I am on the the ViewsMenuScreen$/ do
10
- on(MainMenuScreen).views
11
- on(ViewsMenuScreen)
14
+ navigate_to(ViewsMenuScreen)
12
15
  end
@@ -1,58 +1,21 @@
1
+ require 'page_navigation'
2
+
1
3
  module Gametel
2
4
  #
3
5
  # Module to facilitate create new gametel screen objects in
4
6
  # definitions.
5
7
  #
6
8
  module Navigation
7
-
8
- class << self
9
- attr_reader :navigation_routes
10
-
11
- def routes=(routes)
12
- @navigation_routes = routes
13
- end
14
- end
9
+ include PageNavigation
15
10
 
16
11
  #
17
12
  # create a new screen given a class name
18
13
  #
19
14
  def on(cls, &block)
20
- @current_screen = cls.new
15
+ @current_screen = @current_page = cls.new
21
16
  block.call @current_screen if block
22
17
  @current_screen
23
18
  end
24
19
 
25
- #
26
- # Navigate to a specific screen following a predefined path.
27
- #
28
- def navigate_to(screen_cls, how = {:using => :default}, &block)
29
- path = path_for how
30
- from = @current_screen ? @current_screen.class : path[0][0]
31
- from_index = find_index_for(path, from)
32
- to_index = find_index_for(path, screen_cls) - 1
33
- navigate_through_pages(path[from_index..to_index])
34
- on(screen_cls, &block)
35
- end
36
-
37
- private
38
-
39
- def path_for(how)
40
- path = Gametel::Navigation.navigation_routes[how[:using]]
41
- fail("Gametel::Navigation route :#{how[:using].to_s} not found") unless path
42
- path
43
- end
44
-
45
- def find_index_for(path, item)
46
- path.each_with_index { |each, index| return index if each[0] == item}
47
- end
48
-
49
- def navigate_through_pages(pages)
50
- pages.each do |cls, method|
51
- page = on(cls)
52
- fail("Navigation method not specified on #{cls}. Please call the ") unless page.respond_to? method
53
- page.send method
54
- end
55
- end
56
-
57
20
  end
58
21
  end
@@ -1,3 +1,3 @@
1
1
  module Gametel
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gametel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-27 00:00:00.000000000 Z
13
+ date: 2013-01-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: brazenhead
@@ -44,6 +44,22 @@ dependencies:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: 0.5.4
47
+ - !ruby/object:Gem::Dependency
48
+ name: page_navigation
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0.3'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0.3'
47
63
  - !ruby/object:Gem::Dependency
48
64
  name: rspec
49
65
  requirement: !ruby/object:Gem::Requirement