PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/amexsbs/railsapp/vendor/plugins/tab_tab/test/tab_test.rb

https://bitbucket.org/AcireStudios/social-app-demo
Ruby | 41 lines | 32 code | 9 blank | 0 comment | 0 complexity | 9cd363cc868616fa7e03f57910acc602 MD5 | raw file
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception, MIT
  1. require File.join(File.dirname(__FILE__), 'test_helper')
  2. class TabTest < Test::Unit::TestCase
  3. def test_tab_name_generation_from_literal
  4. assert_equal 'Home', Tab.new(:home ).name
  5. assert_equal 'Settings', Tab.new(:account => :settings).name
  6. assert_equal 'User Preferences', Tab.new(:user_preferences ).name
  7. end
  8. def test_html_id_generation_from_literal
  9. assert_equal 'home_tab', Tab.new(:home).html_id
  10. assert_equal 'user_preferences_tab', Tab.new(:user_preferences).html_id
  11. assert_equal 'account_settings_tab',
  12. Tab.new(:account => :settings).html_id
  13. end
  14. def test_equivalence_of_different_tab_literal_forms
  15. assert_equal Tab.new(:pictures => :shared),
  16. Tab.new('pictures', 'shared')
  17. assert_equal Tab.new('pictures' => { :shared => 'organize' }),
  18. Tab.new(:pictures, 'shared', :organize)
  19. assert_not_equal Tab.new(:pictures => { :shared => :organize }),
  20. Tab.new('pictures', 'organize', 'shared')
  21. end
  22. def test_proper_activation_of_ancestor_tabs
  23. assert_activation [ :pets, :dogs, :big ], :pets
  24. assert_activation [ :pets, :dogs, :big ], :pets => :dogs
  25. assert_activation [ :pets, :dogs, :big ],
  26. [ :pets, :dogs, :big ]
  27. assert_no_activation :dogs, :pets => :dogs
  28. assert_no_activation :pets, :pets => :dogs
  29. assert_no_activation [ :planets, :countries, :cities ],
  30. [ :planets, :cities, :countries ]
  31. end
  32. end