Commit f4be5188784624a959a55bbfabab1f8c15d9f5f0

Authored by Rodrigo Souto
1 parent f2bf49d5

[pluginize-solr] Moving find_by_contents tests

plugins/solr/test/unit/enterprise_test.rb
... ... @@ -15,4 +15,33 @@ class EnterpriseTest < ActiveSupport::TestCase
15 15 Product.expects(:solr_batch_add_association).with(product, :enterprise)
16 16 product.update_attribute :name, "novo nome"
17 17 end
  18 +
  19 + should 'be found in search for its product categories' do
  20 + TestSolr.enable
  21 + ent1 = fast_create(Enterprise, :name => 'test1', :identifier => 'test1')
  22 + prod_cat = fast_create(ProductCategory, :name => 'pctest', :environment_id => Environment.default.id)
  23 + prod = ent1.products.create!(:name => 'teste', :product_category => prod_cat)
  24 +
  25 + ent2 = fast_create(Enterprise, :name => 'test2', :identifier => 'test2')
  26 +
  27 + result = Enterprise.find_by_contents(prod_cat.name)[:results]
  28 +
  29 + assert_includes result, ent1
  30 + assert_not_includes result, ent2
  31 + end
  32 +
  33 + should 'be found in search for its product categories hierarchy' do
  34 + TestSolr.enable
  35 + ent1 = fast_create(Enterprise, :name => 'test1', :identifier => 'test1')
  36 + prod_cat = fast_create(ProductCategory, :name => 'pctest', :environment_id => Environment.default.id)
  37 + prod_child = fast_create(ProductCategory, :name => 'pchild', :environment_id => Environment.default.id, :parent_id => prod_cat.id)
  38 + prod = ent1.products.create!(:name => 'teste', :product_category => prod_child)
  39 +
  40 + ent2 = fast_create(Enterprise, :name => 'test2', :identifier => 'test2')
  41 +
  42 + result = Enterprise.find_by_contents(prod_cat.name)[:results]
  43 +
  44 + assert_includes result, ent1
  45 + assert_not_includes result, ent2
  46 + end
18 47 end
... ...
plugins/solr/test/unit/product_test.rb
... ... @@ -189,5 +189,43 @@ class ProductTest < ActiveSupport::TestCase
189 189  
190 190 assert_equal [img_and_qual, image_only, qual_only, product], Product.find_by_contents('product')[:results].docs
191 191 end
  192 +
  193 + should 'be indexed by category full name' do
  194 + TestSolr.enable
  195 + parent_cat = fast_create(ProductCategory, :name => 'Parent')
  196 + prod_cat = fast_create(ProductCategory, :name => 'Category1', :parent_id => parent_cat.id)
  197 + prod_cat2 = fast_create(ProductCategory, :name => 'Category2')
  198 + p = Product.create(:name => 'a test', :product_category => prod_cat, :enterprise_id => @profile.id)
  199 + p2 = Product.create(:name => 'another test', :product_category => prod_cat2, :enterprise_id => @profile.id)
  200 +
  201 + r = Product.find_by_contents('Parent')[:results].docs
  202 + assert_includes r, p
  203 + assert_not_includes r, p2
  204 + end
  205 +
  206 + should 'index by schema name when database is postgresql' do
  207 + TestSolr.enable
  208 + uses_postgresql 'schema_one'
  209 + p1 = Product.create!(:name => 'some thing', :product_category => @product_category, :enterprise_id => @profile.id)
  210 + assert_equal [p1], Product.find_by_contents('thing')[:results].docs
  211 + uses_postgresql 'schema_two'
  212 + p2 = Product.create!(:name => 'another thing', :product_category => @product_category, :enterprise_id => @profile.id)
  213 + assert_not_includes Product.find_by_contents('thing')[:results], p1
  214 + assert_includes Product.find_by_contents('thing')[:results], p2
  215 + uses_postgresql 'schema_one'
  216 + assert_includes Product.find_by_contents('thing')[:results], p1
  217 + assert_not_includes Product.find_by_contents('thing')[:results], p2
  218 + uses_sqlite
  219 + end
  220 +
  221 + should 'not index by schema name when database is not postgresql' do
  222 + TestSolr.enable
  223 + uses_sqlite
  224 + p1 = Product.create!(:name => 'some thing', :product_category => @product_category, :enterprise_id => @profile.id)
  225 + assert_equal [p1], Product.find_by_contents('thing')[:results].docs
  226 + p2 = Product.create!(:name => 'another thing', :product_category => @product_category, :enterprise_id => @profile.id)
  227 + assert_includes Product.find_by_contents('thing')[:results], p1
  228 + assert_includes Product.find_by_contents('thing')[:results], p2
  229 + end
192 230 end
193 231  
... ...
plugins/solr/test/unit/profile_test.rb
... ... @@ -85,4 +85,80 @@ class ProfileTest < ActiveSupport::TestCase
85 85  
86 86 assert_includes ExtraDataForIndex.find_by_contents('sample')[:results], profile
87 87 end
  88 +
  89 + should 'find_by_contents' do
  90 + TestSolr.enable
  91 + p = create(Profile, :name => 'wanted')
  92 +
  93 + assert Profile.find_by_contents('wanted')[:results].include?(p)
  94 + assert ! Profile.find_by_contents('not_wanted')[:results].include?(p)
  95 + end
  96 +
  97 + # This problem should be solved; talk to Bráulio if it fails
  98 + should 'be able to find profiles by their names' do
  99 + TestSolr.enable
  100 + small = create(Profile, :name => 'A small profile for testing')
  101 + big = create(Profile, :name => 'A big profile for testing')
  102 +
  103 + assert Profile.find_by_contents('small')[:results].include?(small)
  104 + assert Profile.find_by_contents('big')[:results].include?(big)
  105 +
  106 + both = Profile.find_by_contents('profile testing')[:results]
  107 + assert both.include?(small)
  108 + assert both.include?(big)
  109 + end
  110 +
  111 + should 'search with latitude and longitude' do
  112 + TestSolr.enable
  113 + e = fast_create(Enterprise, {:lat => 45, :lng => 45}, :search => true)
  114 +
  115 + assert_includes Enterprise.find_by_contents('', {}, {:radius => 2, :latitude => 45, :longitude => 45})[:results].docs, e
  116 + end
  117 +
  118 + should 'index profile identifier for searching' do
  119 + TestSolr.enable
  120 + Profile.destroy_all
  121 + p = create(Profile, :identifier => 'lalala')
  122 + assert_includes Profile.find_by_contents('lalala')[:results], p
  123 + end
  124 +
  125 + should 'index profile name for searching' do
  126 + TestSolr.enable
  127 + p = create(Profile, :name => 'Interesting Profile')
  128 + assert_includes Profile.find_by_contents('interesting')[:results], p
  129 + end
  130 +
  131 + should 'index comments title together with article' do
  132 + TestSolr.enable
  133 + owner = create_user('testuser').person
  134 + art = fast_create(TinyMceArticle, :profile_id => owner.id, :name => 'ytest')
  135 + c1 = Comment.create(:title => 'a nice comment', :body => 'anything', :author => owner, :source => art ); c1.save!
  136 +
  137 + assert_includes Article.find_by_contents('nice')[:results], art
  138 + end
  139 +
  140 + should 'index by schema name when database is postgresql' do
  141 + TestSolr.enable
  142 + uses_postgresql 'schema_one'
  143 + p1 = Profile.create!(:name => 'some thing', :identifier => 'some-thing')
  144 + assert_equal [p1], Profile.find_by_contents('thing')[:results].docs
  145 + uses_postgresql 'schema_two'
  146 + p2 = Profile.create!(:name => 'another thing', :identifier => 'another-thing')
  147 + assert_not_includes Profile.find_by_contents('thing')[:results], p1
  148 + assert_includes Profile.find_by_contents('thing')[:results], p2
  149 + uses_postgresql 'schema_one'
  150 + assert_includes Profile.find_by_contents('thing')[:results], p1
  151 + assert_not_includes Profile.find_by_contents('thing')[:results], p2
  152 + uses_sqlite
  153 + end
  154 +
  155 + should 'not index by schema name when database is not postgresql' do
  156 + TestSolr.enable
  157 + uses_sqlite
  158 + p1 = Profile.create!(:name => 'some thing', :identifier => 'some-thing')
  159 + assert_equal [p1], Profile.find_by_contents('thing')[:results].docs
  160 + p2 = Profile.create!(:name => 'another thing', :identifier => 'another-thing')
  161 + assert_includes Profile.find_by_contents('thing')[:results], p1
  162 + assert_includes Profile.find_by_contents('thing')[:results], p2
  163 + end
88 164 end
... ...
test/unit/article_test.rb
... ... @@ -357,24 +357,6 @@ class ArticleTest < ActiveSupport::TestCase
357 357 assert_equal true, a.display_to?(person)
358 358 end
359 359  
360   - should 'index comments title together with article' do
361   - TestSolr.enable
362   - owner = create_user('testuser').person
363   - art = fast_create(TinyMceArticle, :profile_id => owner.id, :name => 'ytest')
364   - c1 = Comment.create(:title => 'a nice comment', :body => 'anything', :author => owner, :source => art ); c1.save!
365   -
366   - assert_includes Article.find_by_contents('nice')[:results], art
367   - end
368   -
369   - should 'index comments body together with article' do
370   - TestSolr.enable
371   - owner = create_user('testuser').person
372   - art = fast_create(TinyMceArticle, :profile_id => owner.id, :name => 'ytest')
373   - c1 = Comment.create(:title => 'test comment', :body => 'anything', :author => owner, :source => art); c1.save!
374   -
375   - assert_includes Article.find_by_contents('anything')[:results], art
376   - end
377   -
378 360 should 'cache children count' do
379 361 owner = create_user('testuser').person
380 362 art = owner.articles.build(:name => 'ytest'); art.save!
... ... @@ -1434,31 +1416,6 @@ class ArticleTest < ActiveSupport::TestCase
1434 1416 assert !child.accept_uploads?
1435 1417 end
1436 1418  
1437   - should 'index by schema name when database is postgresql' do
1438   - TestSolr.enable
1439   - uses_postgresql 'schema_one'
1440   - art1 = Article.create!(:name => 'some thing', :profile_id => @profile.id)
1441   - assert_equal [art1], Article.find_by_contents('thing')[:results].docs
1442   - uses_postgresql 'schema_two'
1443   - art2 = Article.create!(:name => 'another thing', :profile_id => @profile.id)
1444   - assert_not_includes Article.find_by_contents('thing')[:results], art1
1445   - assert_includes Article.find_by_contents('thing')[:results], art2
1446   - uses_postgresql 'schema_one'
1447   - assert_includes Article.find_by_contents('thing')[:results], art1
1448   - assert_not_includes Article.find_by_contents('thing')[:results], art2
1449   - uses_sqlite
1450   - end
1451   -
1452   - should 'not index by schema name when database is not postgresql' do
1453   - TestSolr.enable
1454   - uses_sqlite
1455   - art1 = Article.create!(:name => 'some thing', :profile_id => @profile.id)
1456   - assert_equal [art1], Article.find_by_contents('thing')[:results].docs
1457   - art2 = Article.create!(:name => 'another thing', :profile_id => @profile.id)
1458   - assert_includes Article.find_by_contents('thing')[:results], art1
1459   - assert_includes Article.find_by_contents('thing')[:results], art2
1460   - end
1461   -
1462 1419 should 'get images paths in article body' do
1463 1420 Environment.any_instance.stubs(:default_hostname).returns('noosfero.org')
1464 1421 a = TinyMceArticle.new :profile => @profile
... ...
test/unit/enterprise_test.rb
... ... @@ -85,35 +85,6 @@ class EnterpriseTest < ActiveSupport::TestCase
85 85 assert !e.boxes[2].blocks.empty?, 'person must have blocks in area 3'
86 86 end
87 87  
88   - should 'be found in search for its product categories' do
89   - TestSolr.enable
90   - ent1 = fast_create(Enterprise, :name => 'test1', :identifier => 'test1')
91   - prod_cat = fast_create(ProductCategory, :name => 'pctest', :environment_id => Environment.default.id)
92   - prod = ent1.products.create!(:name => 'teste', :product_category => prod_cat)
93   -
94   - ent2 = fast_create(Enterprise, :name => 'test2', :identifier => 'test2')
95   -
96   - result = Enterprise.find_by_contents(prod_cat.name)[:results]
97   -
98   - assert_includes result, ent1
99   - assert_not_includes result, ent2
100   - end
101   -
102   - should 'be found in search for its product categories hierarchy' do
103   - TestSolr.enable
104   - ent1 = fast_create(Enterprise, :name => 'test1', :identifier => 'test1')
105   - prod_cat = fast_create(ProductCategory, :name => 'pctest', :environment_id => Environment.default.id)
106   - prod_child = fast_create(ProductCategory, :name => 'pchild', :environment_id => Environment.default.id, :parent_id => prod_cat.id)
107   - prod = ent1.products.create!(:name => 'teste', :product_category => prod_child)
108   -
109   - ent2 = fast_create(Enterprise, :name => 'test2', :identifier => 'test2')
110   -
111   - result = Enterprise.find_by_contents(prod_cat.name)[:results]
112   -
113   - assert_includes result, ent1
114   - assert_not_includes result, ent2
115   - end
116   -
117 88 should 'allow to add new members if has no members' do
118 89 enterprise = fast_create(Enterprise)
119 90  
... ...
test/unit/environment_test.rb
... ... @@ -441,14 +441,6 @@ class EnvironmentTest < ActiveSupport::TestCase
441 441 assert_equal 'this enterprise was disabled', env.message_for_disabled_enterprise
442 442 end
443 443  
444   - should 'find by contents from articles' do
445   - TestSolr.enable
446   - environment = fast_create(Environment)
447   - assert_nothing_raised do
448   - environment.articles.find_by_contents('')[:results]
449   - end
450   - end
451   -
452 444 should 'provide custom header' do
453 445 assert_equal 'my header', Environment.new(:custom_header => 'my header').custom_header
454 446 end
... ... @@ -545,17 +537,6 @@ class EnvironmentTest < ActiveSupport::TestCase
545 537 assert_equal 'default', Environment.new.layout_template
546 538 end
547 539  
548   - should 'return more than 10 enterprises by contents' do
549   - TestSolr.enable
550   - env = Environment.default
551   - Enterprise.destroy_all
552   - ('1'..'20').each do |n|
553   - Enterprise.create!(:name => 'test ' + n, :identifier => 'test_' + n)
554   - end
555   -
556   - assert_equal 20, env.enterprises.find_by_contents('test')[:results].total_entries
557   - end
558   -
559 540 should 'set replace_enterprise_template_when_enable on environment' do
560 541 e = Environment.new(:name => 'Enterprise test')
561 542 e.replace_enterprise_template_when_enable = true
... ...
test/unit/event_test.rb
... ... @@ -56,20 +56,6 @@ class EventTest < ActiveSupport::TestCase
56 56 assert_kind_of Date, e.end_date
57 57 end
58 58  
59   - should 'be indexed by title' do
60   - TestSolr.enable
61   - profile = create_user('testuser').person
62   - e = Event.create!(:name => 'my surprisingly nice event', :start_date => Date.new(2008, 06, 06), :profile => profile)
63   - assert_includes Event.find_by_contents('surprisingly')[:results], e
64   - end
65   -
66   - should 'be indexed by body' do
67   - TestSolr.enable
68   - profile = create_user('testuser').person
69   - e = Event.create!(:name => 'bli', :start_date => Date.new(2008, 06, 06), :profile => profile, :body => 'my surprisingly long description about my freaking nice event')
70   - assert_includes Event.find_by_contents('surprisingly')[:results], e
71   - end
72   -
73 59 should 'use its own icon' do
74 60 assert_equal 'event', Event.icon_name
75 61 end
... ...
test/unit/product_test.rb
... ... @@ -104,19 +104,6 @@ class ProductTest < ActiveSupport::TestCase
104 104 assert_equal nil, p.category_full_name
105 105 end
106 106  
107   - should 'be indexed by category full name' do
108   - TestSolr.enable
109   - parent_cat = fast_create(ProductCategory, :name => 'Parent')
110   - prod_cat = fast_create(ProductCategory, :name => 'Category1', :parent_id => parent_cat.id)
111   - prod_cat2 = fast_create(ProductCategory, :name => 'Category2')
112   - p = Product.create(:name => 'a test', :product_category => prod_cat, :enterprise_id => @profile.id)
113   - p2 = Product.create(:name => 'another test', :product_category => prod_cat2, :enterprise_id => @profile.id)
114   -
115   - r = Product.find_by_contents('Parent')[:results].docs
116   - assert_includes r, p
117   - assert_not_includes r, p2
118   - end
119   -
120 107 should 'have same lat and lng of its enterprise' do
121 108 ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_enterprise', :lat => 30.0, :lng => 30.0)
122 109 prod = ent.products.create!(:name => 'test product', :product_category => @product_category)
... ... @@ -343,31 +330,6 @@ class ProductTest < ActiveSupport::TestCase
343 330 assert_kind_of Unit, product.build_unit
344 331 end
345 332  
346   - should 'index by schema name when database is postgresql' do
347   - TestSolr.enable
348   - uses_postgresql 'schema_one'
349   - p1 = Product.create!(:name => 'some thing', :product_category => @product_category, :enterprise_id => @profile.id)
350   - assert_equal [p1], Product.find_by_contents('thing')[:results].docs
351   - uses_postgresql 'schema_two'
352   - p2 = Product.create!(:name => 'another thing', :product_category => @product_category, :enterprise_id => @profile.id)
353   - assert_not_includes Product.find_by_contents('thing')[:results], p1
354   - assert_includes Product.find_by_contents('thing')[:results], p2
355   - uses_postgresql 'schema_one'
356   - assert_includes Product.find_by_contents('thing')[:results], p1
357   - assert_not_includes Product.find_by_contents('thing')[:results], p2
358   - uses_sqlite
359   - end
360   -
361   - should 'not index by schema name when database is not postgresql' do
362   - TestSolr.enable
363   - uses_sqlite
364   - p1 = Product.create!(:name => 'some thing', :product_category => @product_category, :enterprise_id => @profile.id)
365   - assert_equal [p1], Product.find_by_contents('thing')[:results].docs
366   - p2 = Product.create!(:name => 'another thing', :product_category => @product_category, :enterprise_id => @profile.id)
367   - assert_includes Product.find_by_contents('thing')[:results], p1
368   - assert_includes Product.find_by_contents('thing')[:results], p2
369   - end
370   -
371 333 should 'respond to price details' do
372 334 product = Product.new
373 335 assert_respond_to product, :price_details
... ...
test/unit/profile_test.rb
... ... @@ -97,14 +97,6 @@ class ProfileTest < ActiveSupport::TestCase
97 97 assert pe.memberships.include?(pr)
98 98 end
99 99  
100   - def test_find_by_contents
101   - TestSolr.enable
102   - p = create(Profile, :name => 'wanted')
103   -
104   - assert Profile.find_by_contents('wanted')[:results].include?(p)
105   - assert ! Profile.find_by_contents('not_wanted')[:results].include?(p)
106   - end
107   -
108 100 should 'remove pages when removing profile' do
109 101 profile = fast_create(Profile)
110 102 first = fast_create(Article, :profile_id => profile.id)
... ... @@ -189,20 +181,6 @@ class ProfileTest < ActiveSupport::TestCase
189 181 assert_not_equal list.object_id, other_list.object_id
190 182 end
191 183  
192   - # This problem should be solved; talk to Bráulio if it fails
193   - should 'be able to find profiles by their names' do
194   - TestSolr.enable
195   - small = create(Profile, :name => 'A small profile for testing')
196   - big = create(Profile, :name => 'A big profile for testing')
197   -
198   - assert Profile.find_by_contents('small')[:results].include?(small)
199   - assert Profile.find_by_contents('big')[:results].include?(big)
200   -
201   - both = Profile.find_by_contents('profile testing')[:results]
202   - assert both.include?(small)
203   - assert both.include?(big)
204   - end
205   -
206 184 should 'provide a shortcut for picking a profile by its identifier' do
207 185 profile = fast_create(Profile, :identifier => 'testprofile')
208 186 assert_equal profile, Profile['testprofile']
... ... @@ -438,13 +416,6 @@ class ProfileTest < ActiveSupport::TestCase
438 416 assert article.advertise?
439 417 end
440 418  
441   - should 'search with latitude and longitude' do
442   - TestSolr.enable
443   - e = fast_create(Enterprise, {:lat => 45, :lng => 45}, :search => true)
444   -
445   - assert_includes Enterprise.find_by_contents('', {}, {:radius => 2, :latitude => 45, :longitude => 45})[:results].docs, e
446   - end
447   -
448 419 should 'have a public profile by default' do
449 420 assert_equal true, Profile.new.public_profile
450 421 end
... ... @@ -498,19 +469,6 @@ class ProfileTest < ActiveSupport::TestCase
498 469 assert p.display_info_to?(admin)
499 470 end
500 471  
501   - should 'index profile identifier for searching' do
502   - TestSolr.enable
503   - Profile.destroy_all
504   - p = create(Profile, :identifier => 'lalala')
505   - assert_includes Profile.find_by_contents('lalala')[:results], p
506   - end
507   -
508   - should 'index profile name for searching' do
509   - TestSolr.enable
510   - p = create(Profile, :name => 'Interesting Profile')
511   - assert_includes Profile.find_by_contents('interesting')[:results], p
512   - end
513   -
514 472 should 'enabled by default on creation' do
515 473 profile = fast_create(Profile)
516 474 assert profile.enabled?
... ... @@ -1691,31 +1649,6 @@ class ProfileTest < ActiveSupport::TestCase
1691 1649 assert_equal 1, community.members_count
1692 1650 end
1693 1651  
1694   - should 'index by schema name when database is postgresql' do
1695   - TestSolr.enable
1696   - uses_postgresql 'schema_one'
1697   - p1 = Profile.create!(:name => 'some thing', :identifier => 'some-thing')
1698   - assert_equal [p1], Profile.find_by_contents('thing')[:results].docs
1699   - uses_postgresql 'schema_two'
1700   - p2 = Profile.create!(:name => 'another thing', :identifier => 'another-thing')
1701   - assert_not_includes Profile.find_by_contents('thing')[:results], p1
1702   - assert_includes Profile.find_by_contents('thing')[:results], p2
1703   - uses_postgresql 'schema_one'
1704   - assert_includes Profile.find_by_contents('thing')[:results], p1
1705   - assert_not_includes Profile.find_by_contents('thing')[:results], p2
1706   - uses_sqlite
1707   - end
1708   -
1709   - should 'not index by schema name when database is not postgresql' do
1710   - TestSolr.enable
1711   - uses_sqlite
1712   - p1 = Profile.create!(:name => 'some thing', :identifier => 'some-thing')
1713   - assert_equal [p1], Profile.find_by_contents('thing')[:results].docs
1714   - p2 = Profile.create!(:name => 'another thing', :identifier => 'another-thing')
1715   - assert_includes Profile.find_by_contents('thing')[:results], p1
1716   - assert_includes Profile.find_by_contents('thing')[:results], p2
1717   - end
1718   -
1719 1652 should 'know if url is the profile homepage' do
1720 1653 profile = fast_create(Profile)
1721 1654  
... ...
test/unit/text_article_test.rb
... ... @@ -13,13 +13,6 @@ class TextArticleTest < ActiveSupport::TestCase
13 13 article = fast_create(TextileArticle, :name => 'textile article test', :profile_id => person.id)
14 14 assert_includes TextArticle.find(:all), article
15 15 end
16   -
17   - should 'found TextileArticle by TextArticle indexes' do
18   - TestSolr.enable
19   - person = create_user('testuser').person
20   - article = TextileArticle.create!(:name => 'found article test', :profile => person)
21   - assert_equal TextileArticle.find_by_contents('found')[:results].docs, TextArticle.find_by_contents('found')[:results].docs
22   - end
23 16  
24 17 should 'remove HTML from name' do
25 18 person = create_user('testuser').person
... ...
test/unit/tiny_mce_article_test.rb
... ... @@ -21,13 +21,6 @@ class TinyMceArticleTest < ActiveSupport::TestCase
21 21 assert_kind_of String, TinyMceArticle.short_description
22 22 end
23 23  
24   - should 'be found when searching for articles by query' do
25   - TestSolr.enable
26   - tma = TinyMceArticle.create!(:name => 'test tinymce article', :body => '---', :profile => profile)
27   - assert_includes TinyMceArticle.find_by_contents('article')[:results], tma
28   - assert_includes Article.find_by_contents('article')[:results], tma
29   - end
30   -
31 24 should 'not sanitize target attribute' do
32 25 article = TinyMceArticle.create!(:name => 'open link in new window', :body => "open <a href='www.invalid.com' target='_blank'>link</a> in new window", :profile => profile)
33 26 assert_tag_in_string article.body, :tag => 'a', :attributes => {:target => '_blank'}
... ...