cirandas.net

ref: master

test/integration/assets_menu_test.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require_relative "../test_helper"

class AssetsMenuTest < ActionDispatch::IntegrationTest

  def setup
#    HomeController.any_instance.stubs(:get_layout).returns('application')
#    SearchController.any_instance.stubs(:get_layout).returns('application')

    parent = Category.create!(:name => "Parent Category", :environment => Environment.default, :display_color => '#888a85')
    @category = Category.create!(:name => "Category A", :environment => Environment.default, :parent => parent)
  end

  should 'link to uncategorized assets at site root' do
    get '/'
    assert_tag :tag => 'a', :attributes => { :href => '/search/contents' }
  end

  should 'link to assets inside category root' do
    (1..SearchController::MULTIPLE_SEARCH_LIMIT+1).each do |i|
      enterprise = Enterprise.create! :identifier => "ent#{i}", :name => "enterprise#{i}"
      ProfileCategorization.add_category_to_profile(@category, enterprise)
    end

    get '/cat/parent-category/category-a'
    assert_tag :tag => 'a', :attributes => { :href => '/search/enterprises/parent-category/category-a' }
  end

end