require File.dirname(__FILE__) + '/../test_helper' class TestNavigation < Test::Unit::TestCase def setup @nav = RHNH::Magellan::Navigator.instance end def test_pages [:home1, :home2, :page1, :page2].each do |page| expected = { :controller => 'navexample', :action => page.to_s } assert_equal expected, @nav.pages[page].url end end def test_back_link [:home1, :home2].each do |page| state = { :homepage => page } expected = { :controller => 'navexample', :action => page.to_s } [:page1, :page2].each do |frompage| assert_equal expected, @nav.get_url(frompage, :back, state) assert_equal expected, @nav.get_url(frompage, :back, state) end end end def test_back_link_no_state expected = { :controller => 'navexample', :action => 'home1', :params => {:error => "Invalid state"} } [:page1, :page2].each do |frompage| assert_equal expected, @nav.get_url(frompage, :back) assert_equal expected, @nav.get_url(frompage, :back) end end end