Commit 71ecb24fcd831edfb6e3df5367cb469d62aa527d
Exists in
master
and in
12 other branches
Merge branch 'master' of gitlab.com:noosfero/noosfero
Showing
5 changed files
with
51 additions
and
59 deletions
Show diff stats
plugins/organization_ratings/po/pt/organization_ratings.po
| @@ -7,8 +7,8 @@ msgid "" | @@ -7,8 +7,8 @@ msgid "" | ||
| 7 | msgstr "" | 7 | msgstr "" |
| 8 | "Project-Id-Version: 1.3~rc2-1-ga15645d\n" | 8 | "Project-Id-Version: 1.3~rc2-1-ga15645d\n" |
| 9 | "POT-Creation-Date: 2015-10-30 16:35-0300\n" | 9 | "POT-Creation-Date: 2015-10-30 16:35-0300\n" |
| 10 | -"PO-Revision-Date: 2016-01-21 15:50+0000\n" | ||
| 11 | -"Last-Translator: Dylan Guedes <djmgguedes@gmail.com>\n" | 10 | +"PO-Revision-Date: 2016-02-18 14:44+0000\n" |
| 11 | +"Last-Translator: Eduardo Vital <vitaldu@gmail.com>\n" | ||
| 12 | "Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero" | 12 | "Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero" |
| 13 | "/plugin-organization-ratings/pt/>\n" | 13 | "/plugin-organization-ratings/pt/>\n" |
| 14 | "Language: pt\n" | 14 | "Language: pt\n" |
| @@ -261,7 +261,7 @@ msgstr "para esta %s." | @@ -261,7 +261,7 @@ msgstr "para esta %s." | ||
| 261 | 261 | ||
| 262 | #: plugins/organization_ratings/views/organization_ratings_plugin_profile/_new_rating_fields.html.erb:70 | 262 | #: plugins/organization_ratings/views/organization_ratings_plugin_profile/_new_rating_fields.html.erb:70 |
| 263 | msgid "Hi, %s! The administrators set the minimum time of" | 263 | msgid "Hi, %s! The administrators set the minimum time of" |
| 264 | -msgstr "Olá, %s! Os administradores configuraram o tempo mínimo de " | 264 | +msgstr "Olá, %s! Os administradores configuraram o tempo mínimo de" |
| 265 | 265 | ||
| 266 | #: plugins/organization_ratings/views/organization_ratings_plugin_profile/_new_rating_fields.html.erb:71 | 266 | #: plugins/organization_ratings/views/organization_ratings_plugin_profile/_new_rating_fields.html.erb:71 |
| 267 | msgid "%d hour(s)" | 267 | msgid "%d hour(s)" |
plugins/site_tour/po/pt/site_tour.po
| @@ -2,14 +2,16 @@ msgid "" | @@ -2,14 +2,16 @@ msgid "" | ||
| 2 | msgstr "" | 2 | msgstr "" |
| 3 | "Project-Id-Version: 1.3~rc2-1-ga15645d\n" | 3 | "Project-Id-Version: 1.3~rc2-1-ga15645d\n" |
| 4 | "POT-Creation-Date: 2015-10-30 16:35-0300\n" | 4 | "POT-Creation-Date: 2015-10-30 16:35-0300\n" |
| 5 | -"PO-Revision-Date: 2015-02-03 17:27-0300\n" | ||
| 6 | -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
| 7 | -"Language-Team: LANGUAGE <LL@li.org>\n" | ||
| 8 | -"Language: \n" | 5 | +"PO-Revision-Date: 2016-02-18 14:44+0000\n" |
| 6 | +"Last-Translator: Eduardo Vital <vitaldu@gmail.com>\n" | ||
| 7 | +"Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero" | ||
| 8 | +"/plugin-site-tour/pt/>\n" | ||
| 9 | +"Language: pt\n" | ||
| 9 | "MIME-Version: 1.0\n" | 10 | "MIME-Version: 1.0\n" |
| 10 | "Content-Type: text/plain; charset=UTF-8\n" | 11 | "Content-Type: text/plain; charset=UTF-8\n" |
| 11 | "Content-Transfer-Encoding: 8bit\n" | 12 | "Content-Transfer-Encoding: 8bit\n" |
| 12 | -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | 13 | +"Plural-Forms: nplurals=2; plural=n != 1;\n" |
| 14 | +"X-Generator: Weblate 2.5-dev\n" | ||
| 13 | 15 | ||
| 14 | #: plugins/site_tour/lib/site_tour_plugin/tour_block.rb:3 | 16 | #: plugins/site_tour/lib/site_tour_plugin/tour_block.rb:3 |
| 15 | msgid "Click to start tour!" | 17 | msgid "Click to start tour!" |
| @@ -88,7 +90,7 @@ msgstr "Próximo" | @@ -88,7 +90,7 @@ msgstr "Próximo" | ||
| 88 | 90 | ||
| 89 | #: plugins/site_tour/views/tour_actions.html.erb:17 | 91 | #: plugins/site_tour/views/tour_actions.html.erb:17 |
| 90 | msgid "Back" | 92 | msgid "Back" |
| 91 | -msgstr "Anterior" | 93 | +msgstr "Voltar" |
| 92 | 94 | ||
| 93 | #: plugins/site_tour/views/tour_actions.html.erb:18 | 95 | #: plugins/site_tour/views/tour_actions.html.erb:18 |
| 94 | msgid "Skip" | 96 | msgid "Skip" |
po/pt/noosfero.po
| @@ -13,8 +13,8 @@ msgid "" | @@ -13,8 +13,8 @@ msgid "" | ||
| 13 | msgstr "" | 13 | msgstr "" |
| 14 | "Project-Id-Version: 1.3~rc2-8-g01ea9f7\n" | 14 | "Project-Id-Version: 1.3~rc2-8-g01ea9f7\n" |
| 15 | "POT-Creation-Date: 2015-11-04 12:36-0300\n" | 15 | "POT-Creation-Date: 2015-11-04 12:36-0300\n" |
| 16 | -"PO-Revision-Date: 2016-01-21 16:56+0000\n" | ||
| 17 | -"Last-Translator: Dylan Guedes <djmgguedes@gmail.com>\n" | 16 | +"PO-Revision-Date: 2016-02-18 14:44+0000\n" |
| 17 | +"Last-Translator: Eduardo Vital <vitaldu@gmail.com>\n" | ||
| 18 | "Language-Team: Portuguese " | 18 | "Language-Team: Portuguese " |
| 19 | "<https://hosted.weblate.org/projects/noosfero/noosfero/pt/>\n" | 19 | "<https://hosted.weblate.org/projects/noosfero/noosfero/pt/>\n" |
| 20 | "Language: pt\n" | 20 | "Language: pt\n" |
| @@ -9258,7 +9258,7 @@ msgstr "Fãs de %s" | @@ -9258,7 +9258,7 @@ msgstr "Fãs de %s" | ||
| 9258 | 9258 | ||
| 9259 | #: app/views/profile/_create_article.html.erb:12 | 9259 | #: app/views/profile/_create_article.html.erb:12 |
| 9260 | msgid "See more" | 9260 | msgid "See more" |
| 9261 | -msgstr "Ver mais" | 9261 | +msgstr "Veja mais" |
| 9262 | 9262 | ||
| 9263 | #: app/views/profile/index.html.erb:32 | 9263 | #: app/views/profile/index.html.erb:32 |
| 9264 | msgid "Network" | 9264 | msgid "Network" |
test/unit/action_tracker_notification_test.rb
| @@ -89,7 +89,8 @@ class ActionTrackerNotificationTest < ActiveSupport::TestCase | @@ -89,7 +89,8 @@ class ActionTrackerNotificationTest < ActiveSupport::TestCase | ||
| 89 | end | 89 | end |
| 90 | 90 | ||
| 91 | should "have comments through article action_tracker" do | 91 | should "have comments through article action_tracker" do |
| 92 | - person = create_user.person | 92 | + user = User.current = create_user |
| 93 | + person = user.person | ||
| 93 | article = create(TextileArticle, :profile_id => person.id) | 94 | article = create(TextileArticle, :profile_id => person.id) |
| 94 | process_delayed_job_queue | 95 | process_delayed_job_queue |
| 95 | notification = ActionTrackerNotification.last | 96 | notification = ActionTrackerNotification.last |
test/unit/article_test.rb
| @@ -7,7 +7,8 @@ class ArticleTest < ActiveSupport::TestCase | @@ -7,7 +7,8 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 7 | 7 | ||
| 8 | def setup | 8 | def setup |
| 9 | ActiveSupport::TestCase::setup | 9 | ActiveSupport::TestCase::setup |
| 10 | - @profile = create_user('testing').person | 10 | + user = User.current = create_user 'testing' |
| 11 | + @profile = user.person | ||
| 11 | end | 12 | end |
| 12 | attr_reader :profile | 13 | attr_reader :profile |
| 13 | 14 | ||
| @@ -468,14 +469,12 @@ class ArticleTest < ActiveSupport::TestCase | @@ -468,14 +469,12 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 468 | end | 469 | end |
| 469 | 470 | ||
| 470 | should 'say that logged off user cannot see private article' do | 471 | should 'say that logged off user cannot see private article' do |
| 471 | - profile = fast_create(Profile, :name => 'test profile', :identifier => 'test_profile') | ||
| 472 | article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => false) | 472 | article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => false) |
| 473 | 473 | ||
| 474 | refute article.display_to?(nil) | 474 | refute article.display_to?(nil) |
| 475 | end | 475 | end |
| 476 | 476 | ||
| 477 | should 'say that not member of profile cannot see private article' do | 477 | should 'say that not member of profile cannot see private article' do |
| 478 | - profile = fast_create(Profile, :name => 'test profile', :identifier => 'test_profile') | ||
| 479 | article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => false) | 478 | article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => false) |
| 480 | person = create_user('test_user').person | 479 | person = create_user('test_user').person |
| 481 | 480 | ||
| @@ -483,7 +482,6 @@ class ArticleTest < ActiveSupport::TestCase | @@ -483,7 +482,6 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 483 | end | 482 | end |
| 484 | 483 | ||
| 485 | should 'say that member user can not see private article' do | 484 | should 'say that member user can not see private article' do |
| 486 | - profile = fast_create(Profile, :name => 'test profile', :identifier => 'test_profile') | ||
| 487 | article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => false, :show_to_followers => false) | 485 | article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => false, :show_to_followers => false) |
| 488 | person = create_user('test_user').person | 486 | person = create_user('test_user').person |
| 489 | profile.affiliate(person, Profile::Roles.member(profile.environment.id)) | 487 | profile.affiliate(person, Profile::Roles.member(profile.environment.id)) |
| @@ -492,25 +490,23 @@ class ArticleTest < ActiveSupport::TestCase | @@ -492,25 +490,23 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 492 | end | 490 | end |
| 493 | 491 | ||
| 494 | should 'say that profile admin can see private article' do | 492 | should 'say that profile admin can see private article' do |
| 495 | - profile = fast_create(Profile, :name => 'test profile', :identifier => 'test_profile') | 493 | + org = fast_create(Profile, :name => 'test profile', :identifier => 'test_profile') |
| 496 | article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => false) | 494 | article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => false) |
| 497 | - person = create_user('test_user').person | ||
| 498 | - profile.affiliate(person, Profile::Roles.admin(profile.environment.id)) | 495 | + org.affiliate(profile, Profile::Roles.admin(org.environment.id)) |
| 499 | 496 | ||
| 500 | - assert article.display_to?(person) | 497 | + assert article.display_to?(profile) |
| 501 | end | 498 | end |
| 502 | 499 | ||
| 503 | should 'say that profile moderator can see private article' do | 500 | should 'say that profile moderator can see private article' do |
| 504 | - profile = fast_create(Profile, :name => 'test profile', :identifier => 'test_profile') | ||
| 505 | - article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => false) | ||
| 506 | - person = create_user('test_user').person | ||
| 507 | - profile.affiliate(person, Profile::Roles.moderator(profile.environment.id)) | 501 | + org = fast_create(Profile, :name => 'test profile', :identifier => 'test_profile') |
| 502 | + article = fast_create(Article, :name => 'test article', :profile_id => org.id, :published => false) | ||
| 503 | + org.affiliate(profile, Profile::Roles.moderator(org.environment.id)) | ||
| 508 | 504 | ||
| 509 | - assert article.display_to?(person) | 505 | + assert article.display_to?(profile) |
| 510 | end | 506 | end |
| 511 | 507 | ||
| 512 | should 'show article to non member if article public but profile private' do | 508 | should 'show article to non member if article public but profile private' do |
| 513 | - profile = fast_create(Profile, :name => 'test profile', :identifier => 'test_profile', :public_profile => false) | 509 | + profile.update public_profile: false |
| 514 | article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => true) | 510 | article = fast_create(Article, :name => 'test article', :profile_id => profile.id, :published => true) |
| 515 | person1 = create_user('test_user1').person | 511 | person1 = create_user('test_user1').person |
| 516 | profile.affiliate(person1, Profile::Roles.member(profile.environment.id)) | 512 | profile.affiliate(person1, Profile::Roles.member(profile.environment.id)) |
| @@ -522,7 +518,6 @@ class ArticleTest < ActiveSupport::TestCase | @@ -522,7 +518,6 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 522 | end | 518 | end |
| 523 | 519 | ||
| 524 | should 'make new article private if created inside a private folder' do | 520 | should 'make new article private if created inside a private folder' do |
| 525 | - profile = fast_create(Profile, :name => 'test profile', :identifier => 'test_profile') | ||
| 526 | folder = fast_create(Folder, :name => 'my_intranet', :profile_id => profile.id, :published => false) | 521 | folder = fast_create(Folder, :name => 'my_intranet', :profile_id => profile.id, :published => false) |
| 527 | article = fast_create(Article, :name => 'my private article', :profile_id => profile.id, :parent_id => folder.id) | 522 | article = fast_create(Article, :name => 'my private article', :profile_id => profile.id, :parent_id => folder.id) |
| 528 | 523 | ||
| @@ -530,7 +525,6 @@ class ArticleTest < ActiveSupport::TestCase | @@ -530,7 +525,6 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 530 | end | 525 | end |
| 531 | 526 | ||
| 532 | should 'save as private' do | 527 | should 'save as private' do |
| 533 | - profile = fast_create(Profile, :name => 'test profile', :identifier => 'test_profile') | ||
| 534 | folder = fast_create(Folder, :name => 'my_intranet', :profile_id => profile.id, :published => false) | 528 | folder = fast_create(Folder, :name => 'my_intranet', :profile_id => profile.id, :published => false) |
| 535 | article = fast_create(Article, :name => 'my private article') | 529 | article = fast_create(Article, :name => 'my private article') |
| 536 | article.profile = profile | 530 | article.profile = profile |
| @@ -1012,13 +1006,13 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1012,13 +1006,13 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1012 | 1006 | ||
| 1013 | should 'not notify activity by default on create' do | 1007 | should 'not notify activity by default on create' do |
| 1014 | ActionTracker::Record.delete_all | 1008 | ActionTracker::Record.delete_all |
| 1015 | - create Article, :name => 'test', :profile_id => fast_create(Profile).id, :published => true | 1009 | + create Article, :name => 'test', :profile_id => profile.id, :published => true |
| 1016 | assert_equal 0, ActionTracker::Record.count | 1010 | assert_equal 0, ActionTracker::Record.count |
| 1017 | end | 1011 | end |
| 1018 | 1012 | ||
| 1019 | should 'not notify activity by default on update' do | 1013 | should 'not notify activity by default on update' do |
| 1020 | ActionTracker::Record.delete_all | 1014 | ActionTracker::Record.delete_all |
| 1021 | - a = create Article, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true | 1015 | + a = create Article, :name => 'bar', :profile_id => profile.id, :published => true |
| 1022 | a.name = 'foo' | 1016 | a.name = 'foo' |
| 1023 | a.save! | 1017 | a.save! |
| 1024 | assert_equal 0, ActionTracker::Record.count | 1018 | assert_equal 0, ActionTracker::Record.count |
| @@ -1026,13 +1020,13 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1026,13 +1020,13 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1026 | 1020 | ||
| 1027 | should 'not notify activity by default on destroy' do | 1021 | should 'not notify activity by default on destroy' do |
| 1028 | ActionTracker::Record.delete_all | 1022 | ActionTracker::Record.delete_all |
| 1029 | - a = create Article, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true | 1023 | + a = create Article, :name => 'bar', :profile_id => profile.id, :published => true |
| 1030 | a.destroy | 1024 | a.destroy |
| 1031 | assert_equal 0, ActionTracker::Record.count | 1025 | assert_equal 0, ActionTracker::Record.count |
| 1032 | end | 1026 | end |
| 1033 | 1027 | ||
| 1034 | should 'create activity' do | 1028 | should 'create activity' do |
| 1035 | - a = create TextileArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true | 1029 | + a = create TextileArticle, :name => 'bar', :profile_id => profile.id, :published => true |
| 1036 | a.activity.destroy | 1030 | a.activity.destroy |
| 1037 | assert_nil a.activity | 1031 | assert_nil a.activity |
| 1038 | 1032 | ||
| @@ -1212,10 +1206,9 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1212,10 +1206,9 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1212 | end | 1206 | end |
| 1213 | 1207 | ||
| 1214 | should 'get article galleries' do | 1208 | should 'get article galleries' do |
| 1215 | - p = fast_create(Profile) | ||
| 1216 | - a = fast_create(Article, :profile_id => p.id) | ||
| 1217 | - g = fast_create(Gallery, :profile_id => p.id) | ||
| 1218 | - assert_equal [g], p.articles.galleries | 1209 | + a = fast_create(Article, :profile_id => profile.id) |
| 1210 | + g = fast_create(Gallery, :profile_id => profile.id) | ||
| 1211 | + assert_equal [g], profile.articles.galleries | ||
| 1219 | end | 1212 | end |
| 1220 | 1213 | ||
| 1221 | should 'has many translations' do | 1214 | should 'has many translations' do |
| @@ -1236,7 +1229,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1236,7 +1229,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1236 | end | 1229 | end |
| 1237 | 1230 | ||
| 1238 | should 'validate inclusion of language' do | 1231 | should 'validate inclusion of language' do |
| 1239 | - a = build(Article, :profile_id => fast_create(Profile).id) | 1232 | + a = build(Article, :profile_id => profile.id) |
| 1240 | a.language = '12' | 1233 | a.language = '12' |
| 1241 | a.valid? | 1234 | a.valid? |
| 1242 | assert a.errors[:language.to_s].present? | 1235 | assert a.errors[:language.to_s].present? |
| @@ -1268,7 +1261,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1268,7 +1261,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1268 | end | 1261 | end |
| 1269 | 1262 | ||
| 1270 | should 'list possible translations' do | 1263 | should 'list possible translations' do |
| 1271 | - native_article = fast_create(Article, :language => 'pt', :profile_id => fast_create(Profile).id ) | 1264 | + native_article = fast_create(Article, :language => 'pt', :profile_id => profile.id ) |
| 1272 | article_translation = fast_create(Article, :language => 'en', :translation_of_id => native_article.id) | 1265 | article_translation = fast_create(Article, :language => 'en', :translation_of_id => native_article.id) |
| 1273 | possible_translations = native_article.possible_translations | 1266 | possible_translations = native_article.possible_translations |
| 1274 | refute possible_translations.include?('en') | 1267 | refute possible_translations.include?('en') |
| @@ -1278,7 +1271,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1278,7 +1271,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1278 | should 'verify if translation is already in use' do | 1271 | should 'verify if translation is already in use' do |
| 1279 | native_article = fast_create(Article, :language => 'pt') | 1272 | native_article = fast_create(Article, :language => 'pt') |
| 1280 | article_translation = fast_create(Article, :language => 'en', :translation_of_id => native_article.id) | 1273 | article_translation = fast_create(Article, :language => 'en', :translation_of_id => native_article.id) |
| 1281 | - a = build(Article, :profile => fast_create(Profile)) | 1274 | + a = build(Article, :profile => profile) |
| 1282 | a.language = 'en' | 1275 | a.language = 'en' |
| 1283 | a.translation_of = native_article | 1276 | a.translation_of = native_article |
| 1284 | a.valid? | 1277 | a.valid? |
| @@ -1290,7 +1283,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1290,7 +1283,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1290 | 1283 | ||
| 1291 | should 'verify if native translation is already in use' do | 1284 | should 'verify if native translation is already in use' do |
| 1292 | native_article = fast_create(Article, :language => 'pt') | 1285 | native_article = fast_create(Article, :language => 'pt') |
| 1293 | - a = build(Article, :profile => fast_create(Profile)) | 1286 | + a = build(Article, :profile => profile) |
| 1294 | a.language = 'pt' | 1287 | a.language = 'pt' |
| 1295 | a.translation_of = native_article | 1288 | a.translation_of = native_article |
| 1296 | a.valid? | 1289 | a.valid? |
| @@ -1302,7 +1295,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1302,7 +1295,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1302 | 1295 | ||
| 1303 | should 'translation have a language' do | 1296 | should 'translation have a language' do |
| 1304 | native_article = fast_create(Article, :language => 'pt') | 1297 | native_article = fast_create(Article, :language => 'pt') |
| 1305 | - a = build(Article, :profile_id => fast_create(Profile).id) | 1298 | + a = build(Article, :profile_id => profile.id) |
| 1306 | a.translation_of = native_article | 1299 | a.translation_of = native_article |
| 1307 | a.valid? | 1300 | a.valid? |
| 1308 | assert a.errors[:language.to_s].present? | 1301 | assert a.errors[:language.to_s].present? |
| @@ -1312,8 +1305,8 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1312,8 +1305,8 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1312 | end | 1305 | end |
| 1313 | 1306 | ||
| 1314 | should 'native translation have a language' do | 1307 | should 'native translation have a language' do |
| 1315 | - native_article = fast_create(Article, :profile_id => fast_create(Profile).id ) | ||
| 1316 | - a = build(Article, :profile_id => fast_create(Profile).id) | 1308 | + native_article = fast_create(Article, :profile_id => profile.id ) |
| 1309 | + a = build(Article, :profile_id => profile.id) | ||
| 1317 | a.language = 'en' | 1310 | a.language = 'en' |
| 1318 | a.translation_of = native_article | 1311 | a.translation_of = native_article |
| 1319 | a.valid? | 1312 | a.valid? |
| @@ -1378,22 +1371,22 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1378,22 +1371,22 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1378 | end | 1371 | end |
| 1379 | 1372 | ||
| 1380 | should 'get only non translated articles' do | 1373 | should 'get only non translated articles' do |
| 1381 | - p = fast_create(Profile) | ||
| 1382 | - native = fast_create(Article, :language => 'pt', :profile_id => p.id) | ||
| 1383 | - translation = fast_create(Article, :language => 'en', :translation_of_id => native.id, :profile_id => p.id) | ||
| 1384 | - assert_equal [native], p.articles.native_translations | 1374 | + profile.articles.delete_all |
| 1375 | + native = fast_create(Article, :language => 'pt', :profile_id => profile.id) | ||
| 1376 | + translation = fast_create(Article, :language => 'en', :translation_of_id => native.id, :profile_id => profile.id) | ||
| 1377 | + assert_equal [native], profile.articles.native_translations | ||
| 1385 | end | 1378 | end |
| 1386 | 1379 | ||
| 1387 | should 'not list own language as a possible translation if language has changed' do | 1380 | should 'not list own language as a possible translation if language has changed' do |
| 1388 | - a = build(Article, :language => 'pt', :profile_id => fast_create(Profile).id) | 1381 | + a = build(Article, :language => 'pt', :profile_id => profile.id) |
| 1389 | refute a.possible_translations.include?('pt') | 1382 | refute a.possible_translations.include?('pt') |
| 1390 | - a = fast_create(Article, :language => 'pt', :profile_id => fast_create(Profile).id ) | 1383 | + a = fast_create(Article, :language => 'pt', :profile_id => profile.id ) |
| 1391 | a.language = 'en' | 1384 | a.language = 'en' |
| 1392 | refute a.possible_translations.include?('en') | 1385 | refute a.possible_translations.include?('en') |
| 1393 | end | 1386 | end |
| 1394 | 1387 | ||
| 1395 | should 'list own language as a possible translation if language has not changed' do | 1388 | should 'list own language as a possible translation if language has not changed' do |
| 1396 | - a = fast_create(Article, :language => 'pt', :profile_id => fast_create(Profile).id) | 1389 | + a = fast_create(Article, :language => 'pt', :profile_id => profile.id) |
| 1397 | assert a.possible_translations.include?('pt') | 1390 | assert a.possible_translations.include?('pt') |
| 1398 | end | 1391 | end |
| 1399 | 1392 | ||
| @@ -1435,7 +1428,6 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1435,7 +1428,6 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1435 | should 'return only folders' do | 1428 | should 'return only folders' do |
| 1436 | not_folders = [RssFeed, TinyMceArticle, Event, TextileArticle] | 1429 | not_folders = [RssFeed, TinyMceArticle, Event, TextileArticle] |
| 1437 | folders = [Folder, Blog, Gallery, Forum] | 1430 | folders = [Folder, Blog, Gallery, Forum] |
| 1438 | - profile = fast_create(Profile) | ||
| 1439 | 1431 | ||
| 1440 | not_folders.each do |klass| | 1432 | not_folders.each do |klass| |
| 1441 | item = fast_create(klass) | 1433 | item = fast_create(klass) |
| @@ -1451,7 +1443,6 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1451,7 +1443,6 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1451 | should 'return no folders' do | 1443 | should 'return no folders' do |
| 1452 | not_folders = [RssFeed, TinyMceArticle, Event, TextileArticle] | 1444 | not_folders = [RssFeed, TinyMceArticle, Event, TextileArticle] |
| 1453 | folders = [Folder, Blog, Gallery, Forum] | 1445 | folders = [Folder, Blog, Gallery, Forum] |
| 1454 | - profile = fast_create(Profile) | ||
| 1455 | 1446 | ||
| 1456 | not_folders.each do |klass| | 1447 | not_folders.each do |klass| |
| 1457 | item = fast_create(klass) | 1448 | item = fast_create(klass) |
| @@ -1611,18 +1602,16 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1611,18 +1602,16 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1611 | end | 1602 | end |
| 1612 | 1603 | ||
| 1613 | should 'delegate region info to profile' do | 1604 | should 'delegate region info to profile' do |
| 1614 | - profile = fast_create(Profile) | ||
| 1615 | - Profile.any_instance.expects(:region) | ||
| 1616 | - Profile.any_instance.expects(:region_id) | 1605 | + Person.any_instance.expects(:region) |
| 1606 | + Person.any_instance.expects(:region_id) | ||
| 1617 | article = fast_create(Article, :profile_id => profile.id) | 1607 | article = fast_create(Article, :profile_id => profile.id) |
| 1618 | article.region | 1608 | article.region |
| 1619 | article.region_id | 1609 | article.region_id |
| 1620 | end | 1610 | end |
| 1621 | 1611 | ||
| 1622 | should 'delegate environment info to profile' do | 1612 | should 'delegate environment info to profile' do |
| 1623 | - profile = fast_create(Profile) | ||
| 1624 | - Profile.any_instance.expects(:environment) | ||
| 1625 | - Profile.any_instance.expects(:environment_id) | 1613 | + Person.any_instance.expects(:environment) |
| 1614 | + Person.any_instance.expects(:environment_id) | ||
| 1626 | article = fast_create(Article, :profile_id => profile.id) | 1615 | article = fast_create(Article, :profile_id => profile.id) |
| 1627 | article.environment | 1616 | article.environment |
| 1628 | article.environment_id | 1617 | article.environment_id |