Sha256: a3c1a9f942aa3ea084618abb4ff3599f4de27f63438d343e62e4ae2bc67ae846

Contents?: true

Size: 1.67 KB

Versions: 4

Compression:

Stored size: 1.67 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../test_helper' )

module IntegrationTests
  class BlogCategoriesTest < ActionController::IntegrationTest
    def setup
      super
      @section = Blog.first
      @site = @section.site
      use_site! @site
      @special_characters_category = @section.categories.find_by_title('$%&')
      @non_ascii_category = @section.categories.find_by_title('öäü')
      @section.categories.build(:title => 'uk').save
      @section.categories.build(:title => 'london').save
      @london = @section.categories.find_by_title('london')
      @uk     = @section.categories.find_by_title('uk')
      @london.move_to_child_of(@uk)
      @section.categories.update_paths!
    end
  
    test "user views categories of a blog that has nested categories" do
      login_as_user
      visit_blog_index
      
      if default_theme?
        visit_category(@uk)
        visit_category(@london)
      end
    end
    
    test "category with special characters permalink is accessible" do
      login_as_user
      visit_blog_index
      
      visit_category(@non_ascii_category) if default_theme?
    end
    
    # FIXME categories does not work with characters like $%&
    # test "category with special characters permalink is accessible" do
    #   login_as_user
    #   visit_blog_index
    #   visit_category(@special_characters_category)
    # end
    
    def visit_blog_index
      visit blog_path(@section)
      assert_template 'blogs/articles/index'
    end
    
    def visit_category(category)
      click_link category.title
      assert_template 'blogs/articles/index'
      assert_select 'h2.list_header', "Articles about #{category.title}"
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
adva_blog-0.2.0 test/integration/blog_categories_test.rb
adva_blog-0.1.0 test/integration/blog_categories_test.rb
adva_blog-0.0.1 test/integration/blog_categories_test.rb
adva-0.0.1 adva_blog/test/integration/blog_categories_test.rb