Commit 70ff8448ca2e6ebf5273623fa04728f8845ebf79
1 parent
c8cd03db
Exists in
master
and in
22 other branches
rails3: custom methods assert_difference and assert_no_difference removed
Showing
50 changed files
with
213 additions
and
232 deletions
Show diff stats
lib/authenticated_test_helper.rb
| @@ -28,25 +28,6 @@ module AuthenticatedTestHelper | @@ -28,25 +28,6 @@ module AuthenticatedTestHelper | ||
| 28 | end | 28 | end |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | - # http://project.ioni.st/post/217#post-217 | ||
| 32 | - # | ||
| 33 | - # def test_new_publication | ||
| 34 | - # assert_difference(Publication, :count) do | ||
| 35 | - # post :create, :publication => {...} | ||
| 36 | - # # ... | ||
| 37 | - # end | ||
| 38 | - # end | ||
| 39 | - # | ||
| 40 | - def assert_difference(object, method = nil, difference = 1) | ||
| 41 | - initial_value = object.send(method) | ||
| 42 | - yield | ||
| 43 | - assert_equal initial_value + difference, object.send(method), "#{object}##{method}" | ||
| 44 | - end | ||
| 45 | - | ||
| 46 | - def assert_no_difference(object, method, &block) | ||
| 47 | - assert_difference object, method, 0, &block | ||
| 48 | - end | ||
| 49 | - | ||
| 50 | # Assert the block redirects to the login | 31 | # Assert the block redirects to the login |
| 51 | # | 32 | # |
| 52 | # assert_requires_login(:bob) { |c| c.get :edit, :id => 1 } | 33 | # assert_requires_login(:bob) { |c| c.get :edit, :id => 1 } |
test/functional/account_controller_test.rb
| @@ -57,7 +57,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -57,7 +57,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 57 | end | 57 | end |
| 58 | 58 | ||
| 59 | def test_should_allow_signup | 59 | def test_should_allow_signup |
| 60 | - assert_difference User, :count do | 60 | + assert_difference 'User.count' do |
| 61 | new_user | 61 | new_user |
| 62 | assert_response :success | 62 | assert_response :success |
| 63 | assert_not_nil assigns(:register_pending) | 63 | assert_not_nil assigns(:register_pending) |
| @@ -65,7 +65,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -65,7 +65,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 65 | end | 65 | end |
| 66 | 66 | ||
| 67 | def test_should_require_login_on_signup | 67 | def test_should_require_login_on_signup |
| 68 | - assert_no_difference User, :count do | 68 | + assert_no_difference 'User.count' do |
| 69 | new_user(:login => nil) | 69 | new_user(:login => nil) |
| 70 | assert assigns(:user).errors.on(:login) | 70 | assert assigns(:user).errors.on(:login) |
| 71 | assert_response :success | 71 | assert_response :success |
| @@ -74,7 +74,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -74,7 +74,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 74 | end | 74 | end |
| 75 | 75 | ||
| 76 | def test_should_require_password_on_signup | 76 | def test_should_require_password_on_signup |
| 77 | - assert_no_difference User, :count do | 77 | + assert_no_difference 'User.count' do |
| 78 | new_user(:password => nil) | 78 | new_user(:password => nil) |
| 79 | assert assigns(:user).errors.on(:password) | 79 | assert assigns(:user).errors.on(:password) |
| 80 | assert_response :success | 80 | assert_response :success |
| @@ -83,7 +83,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -83,7 +83,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 83 | end | 83 | end |
| 84 | 84 | ||
| 85 | def test_should_require_password_confirmation_on_signup | 85 | def test_should_require_password_confirmation_on_signup |
| 86 | - assert_no_difference User, :count do | 86 | + assert_no_difference 'User.count' do |
| 87 | new_user(:password_confirmation => nil) | 87 | new_user(:password_confirmation => nil) |
| 88 | assert assigns(:user).errors.on(:password_confirmation) | 88 | assert assigns(:user).errors.on(:password_confirmation) |
| 89 | assert_response :success | 89 | assert_response :success |
| @@ -92,7 +92,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -92,7 +92,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 92 | end | 92 | end |
| 93 | 93 | ||
| 94 | def test_should_require_email_on_signup | 94 | def test_should_require_email_on_signup |
| 95 | - assert_no_difference User, :count do | 95 | + assert_no_difference 'User.count' do |
| 96 | new_user(:email => nil) | 96 | new_user(:email => nil) |
| 97 | assert assigns(:user).errors.on(:email) | 97 | assert assigns(:user).errors.on(:email) |
| 98 | assert_response :success | 98 | assert_response :success |
| @@ -101,7 +101,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -101,7 +101,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 101 | end | 101 | end |
| 102 | 102 | ||
| 103 | def test_shoud_not_save_without_acceptance_of_terms_of_use_on_signup | 103 | def test_shoud_not_save_without_acceptance_of_terms_of_use_on_signup |
| 104 | - assert_no_difference User, :count do | 104 | + assert_no_difference 'User.count' do |
| 105 | Environment.default.update_attributes(:terms_of_use => 'some terms ...') | 105 | Environment.default.update_attributes(:terms_of_use => 'some terms ...') |
| 106 | new_user | 106 | new_user |
| 107 | assert_response :success | 107 | assert_response :success |
| @@ -110,7 +110,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -110,7 +110,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 110 | end | 110 | end |
| 111 | 111 | ||
| 112 | def test_shoud_save_with_acceptance_of_terms_of_use_on_signup | 112 | def test_shoud_save_with_acceptance_of_terms_of_use_on_signup |
| 113 | - assert_difference User, :count do | 113 | + assert_difference 'User.count' do |
| 114 | Environment.default.update_attributes(:terms_of_use => 'some terms ...') | 114 | Environment.default.update_attributes(:terms_of_use => 'some terms ...') |
| 115 | new_user(:terms_accepted => '1') | 115 | new_user(:terms_accepted => '1') |
| 116 | assert_response :success | 116 | assert_response :success |
| @@ -295,7 +295,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -295,7 +295,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 295 | end | 295 | end |
| 296 | 296 | ||
| 297 | should 'restrict multiple users with the same e-mail' do | 297 | should 'restrict multiple users with the same e-mail' do |
| 298 | - assert_difference User, :count do | 298 | + assert_difference 'User.count' do |
| 299 | new_user(:login => 'user1', :email => 'user@example.com') | 299 | new_user(:login => 'user1', :email => 'user@example.com') |
| 300 | assert assigns(:user).valid? | 300 | assert assigns(:user).valid? |
| 301 | @controller.stubs(:logged_in?).returns(false) | 301 | @controller.stubs(:logged_in?).returns(false) |
| @@ -622,7 +622,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -622,7 +622,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 622 | 622 | ||
| 623 | should 'signup filling in mandatory person fields' do | 623 | should 'signup filling in mandatory person fields' do |
| 624 | Person.any_instance.stubs(:required_fields).returns(['organization']) | 624 | Person.any_instance.stubs(:required_fields).returns(['organization']) |
| 625 | - assert_difference User, :count do | 625 | + assert_difference 'User.count' do |
| 626 | post :signup, :user => { :login => 'testuser', :password => '123456', :password_confirmation => '123456', :email => 'testuser@example.com' }, :profile_data => { :organization => 'example.com' } | 626 | post :signup, :user => { :login => 'testuser', :password => '123456', :password_confirmation => '123456', :email => 'testuser@example.com' }, :profile_data => { :organization => 'example.com' } |
| 627 | assert_response :success | 627 | assert_response :success |
| 628 | end | 628 | end |
| @@ -910,7 +910,7 @@ class AccountControllerTest < ActionController::TestCase | @@ -910,7 +910,7 @@ class AccountControllerTest < ActionController::TestCase | ||
| 910 | 910 | ||
| 911 | should 'not sign in if the honeypot field is filled' do | 911 | should 'not sign in if the honeypot field is filled' do |
| 912 | Person.any_instance.stubs(:required_fields).returns(['organization']) | 912 | Person.any_instance.stubs(:required_fields).returns(['organization']) |
| 913 | - assert_no_difference User, :count do | 913 | + assert_no_difference 'User.count' do |
| 914 | post :signup, :user => { :login => 'testuser', :password => '123456', :password_confirmation => '123456', :email => 'testuser@example.com' }, :profile_data => { :organization => 'example.com' }, :honeypot => 'something' | 914 | post :signup, :user => { :login => 'testuser', :password => '123456', :password_confirmation => '123456', :email => 'testuser@example.com' }, :profile_data => { :organization => 'example.com' }, :honeypot => 'something' |
| 915 | end | 915 | end |
| 916 | assert @response.body.blank? | 916 | assert @response.body.blank? |
test/functional/categories_controller_test.rb
| @@ -67,7 +67,7 @@ class CategoriesControllerTest < ActionController::TestCase | @@ -67,7 +67,7 @@ class CategoriesControllerTest < ActionController::TestCase | ||
| 67 | end | 67 | end |
| 68 | 68 | ||
| 69 | def test_new_save | 69 | def test_new_save |
| 70 | - assert_difference Category, :count do | 70 | + assert_difference 'Category.count' do |
| 71 | post :new, :category => { :name => 'a new category' } | 71 | post :new, :category => { :name => 'a new category' } |
| 72 | assert_redirected_to :action => 'index' | 72 | assert_redirected_to :action => 'index' |
| 73 | end | 73 | end |
| @@ -83,7 +83,7 @@ class CategoriesControllerTest < ActionController::TestCase | @@ -83,7 +83,7 @@ class CategoriesControllerTest < ActionController::TestCase | ||
| 83 | end | 83 | end |
| 84 | 84 | ||
| 85 | should 'be able to upload a file' do | 85 | should 'be able to upload a file' do |
| 86 | - assert_difference Category, :count do | 86 | + assert_difference 'Category.count' do |
| 87 | post :new, :category => { :name => 'new category', :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') } } | 87 | post :new, :category => { :name => 'new category', :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') } } |
| 88 | assert_equal assigns(:category).image.filename, 'rails.png' | 88 | assert_equal assigns(:category).image.filename, 'rails.png' |
| 89 | end | 89 | end |
test/functional/cms_controller_test.rb
| @@ -80,7 +80,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -80,7 +80,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 80 | end | 80 | end |
| 81 | 81 | ||
| 82 | should 'be able to save a document' do | 82 | should 'be able to save a document' do |
| 83 | - assert_difference Article, :count do | 83 | + assert_difference 'Article.count' do |
| 84 | post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'a test article', :body => 'the text of the article ...' } | 84 | post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'a test article', :body => 'the text of the article ...' } |
| 85 | end | 85 | end |
| 86 | end | 86 | end |
| @@ -245,7 +245,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -245,7 +245,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 245 | should 'be able to remove article' do | 245 | should 'be able to remove article' do |
| 246 | a = profile.articles.build(:name => 'my-article') | 246 | a = profile.articles.build(:name => 'my-article') |
| 247 | a.save! | 247 | a.save! |
| 248 | - assert_difference Article, :count, -1 do | 248 | + assert_difference 'Article.count', -1 do |
| 249 | post :destroy, :profile => profile.identifier, :id => a.id | 249 | post :destroy, :profile => profile.identifier, :id => a.id |
| 250 | end | 250 | end |
| 251 | end | 251 | end |
| @@ -276,7 +276,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -276,7 +276,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 276 | 276 | ||
| 277 | should 'be able to create a RSS feed' do | 277 | should 'be able to create a RSS feed' do |
| 278 | login_as(profile.identifier) | 278 | login_as(profile.identifier) |
| 279 | - assert_difference RssFeed, :count do | 279 | + assert_difference 'RssFeed.count' do |
| 280 | post :new, :type => RssFeed.name, :profile => profile.identifier, :article => { :name => 'new-feed', :limit => 15, :include => 'all' } | 280 | post :new, :type => RssFeed.name, :profile => profile.identifier, :article => { :name => 'new-feed', :limit => 15, :include => 'all' } |
| 281 | assert_response :redirect | 281 | assert_response :redirect |
| 282 | end | 282 | end |
| @@ -294,7 +294,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -294,7 +294,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 294 | end | 294 | end |
| 295 | 295 | ||
| 296 | should 'be able to upload a file' do | 296 | should 'be able to upload a file' do |
| 297 | - assert_difference UploadedFile, :count do | 297 | + assert_difference 'UploadedFile.count' do |
| 298 | post :new, :type => UploadedFile.name, :profile => profile.identifier, :article => { :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')} | 298 | post :new, :type => UploadedFile.name, :profile => profile.identifier, :article => { :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')} |
| 299 | end | 299 | end |
| 300 | assert_not_nil profile.articles.find_by_path('test.txt') | 300 | assert_not_nil profile.articles.find_by_path('test.txt') |
| @@ -313,13 +313,13 @@ class CmsControllerTest < ActionController::TestCase | @@ -313,13 +313,13 @@ class CmsControllerTest < ActionController::TestCase | ||
| 313 | end | 313 | end |
| 314 | 314 | ||
| 315 | should 'be able to upload an image' do | 315 | should 'be able to upload an image' do |
| 316 | - assert_difference UploadedFile, :count do | 316 | + assert_difference 'UploadedFile.count' do |
| 317 | post :new, :type => UploadedFile.name, :profile => profile.identifier, :article => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')} | 317 | post :new, :type => UploadedFile.name, :profile => profile.identifier, :article => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')} |
| 318 | end | 318 | end |
| 319 | end | 319 | end |
| 320 | 320 | ||
| 321 | should 'be able to upload more than one file at once' do | 321 | should 'be able to upload more than one file at once' do |
| 322 | - assert_difference UploadedFile, :count, 2 do | 322 | + assert_difference 'UploadedFile.count', 2 do |
| 323 | post :upload_files, :profile => profile.identifier, :uploaded_files => [fixture_file_upload('/files/test.txt', 'text/plain'), fixture_file_upload('/files/rails.png', 'text/plain')] | 323 | post :upload_files, :profile => profile.identifier, :uploaded_files => [fixture_file_upload('/files/test.txt', 'text/plain'), fixture_file_upload('/files/rails.png', 'text/plain')] |
| 324 | end | 324 | end |
| 325 | assert_not_nil profile.articles.find_by_path('test.txt') | 325 | assert_not_nil profile.articles.find_by_path('test.txt') |
| @@ -439,7 +439,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -439,7 +439,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 439 | article.profile = profile | 439 | article.profile = profile |
| 440 | article.save! | 440 | article.save! |
| 441 | 441 | ||
| 442 | - assert_no_difference UploadedFile, :count do | 442 | + assert_no_difference 'UploadedFile.count' do |
| 443 | assert_raise ArgumentError do | 443 | assert_raise ArgumentError do |
| 444 | post :new, :type => UploadedFile.name, :parent_id => article.id, :profile => profile.identifier, :article => { :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')} | 444 | post :new, :type => UploadedFile.name, :parent_id => article.id, :profile => profile.identifier, :article => { :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')} |
| 445 | end | 445 | end |
| @@ -760,7 +760,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -760,7 +760,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 760 | c.affiliate(profile, Profile::Roles.all_roles(c.environment.id)) | 760 | c.affiliate(profile, Profile::Roles.all_roles(c.environment.id)) |
| 761 | article = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails') | 761 | article = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails') |
| 762 | 762 | ||
| 763 | - assert_difference article.class, :count do | 763 | + assert_difference 'article.class.count' do |
| 764 | post :publish, :profile => profile.identifier, :id => article.id, :marked_groups => {c.id.to_s => {:name => 'bli', :group_id => c.id.to_s}} | 764 | post :publish, :profile => profile.identifier, :id => article.id, :marked_groups => {c.id.to_s => {:name => 'bli', :group_id => c.id.to_s}} |
| 765 | assert_equal [{'group' => c, 'name' => 'bli'}], assigns(:marked_groups) | 765 | assert_equal [{'group' => c, 'name' => 'bli'}], assigns(:marked_groups) |
| 766 | end | 766 | end |
| @@ -771,7 +771,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -771,7 +771,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 771 | c.affiliate(profile, Profile::Roles.all_roles(c.environment.id)) | 771 | c.affiliate(profile, Profile::Roles.all_roles(c.environment.id)) |
| 772 | a = Event.create!(:name => "Some event", :profile => profile, :start_date => Date.today) | 772 | a = Event.create!(:name => "Some event", :profile => profile, :start_date => Date.today) |
| 773 | 773 | ||
| 774 | - assert_difference Event, :count do | 774 | + assert_difference 'Event.count' do |
| 775 | post :publish, :profile => profile.identifier, :id => a.id, :marked_groups => {c.id.to_s => {:name => 'bli', :group_id => c.id.to_s}} | 775 | post :publish, :profile => profile.identifier, :id => a.id, :marked_groups => {c.id.to_s => {:name => 'bli', :group_id => c.id.to_s}} |
| 776 | end | 776 | end |
| 777 | end | 777 | end |
| @@ -791,7 +791,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -791,7 +791,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 791 | Environment.any_instance.stubs(:portal_community).returns(portal_community) | 791 | Environment.any_instance.stubs(:portal_community).returns(portal_community) |
| 792 | article = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails') | 792 | article = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails') |
| 793 | 793 | ||
| 794 | - assert_difference article.class, :count do | 794 | + assert_difference 'article.class.count' do |
| 795 | post :publish_on_portal_community, :profile => profile.identifier, :id => article.id, :name => article.name | 795 | post :publish_on_portal_community, :profile => profile.identifier, :id => article.id, :name => article.name |
| 796 | end | 796 | end |
| 797 | end | 797 | end |
| @@ -801,9 +801,9 @@ class CmsControllerTest < ActionController::TestCase | @@ -801,9 +801,9 @@ class CmsControllerTest < ActionController::TestCase | ||
| 801 | c.affiliate(profile, Profile::Roles.all_roles(c.environment.id)) | 801 | c.affiliate(profile, Profile::Roles.all_roles(c.environment.id)) |
| 802 | a = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails') | 802 | a = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails') |
| 803 | 803 | ||
| 804 | - assert_no_difference a.class, :count do | ||
| 805 | - assert_difference ApproveArticle, :count do | ||
| 806 | - assert_difference c.tasks, :count do | 804 | + assert_no_difference 'a.class.count' do |
| 805 | + assert_difference 'ApproveArticle.count' do | ||
| 806 | + assert_difference 'c.tasks.count' do | ||
| 807 | post :publish, :profile => profile.identifier, :id => a.id, :marked_groups => {c.id.to_s => {:name => 'bli', :group_id => c.id.to_s}} | 807 | post :publish, :profile => profile.identifier, :id => a.id, :marked_groups => {c.id.to_s => {:name => 'bli', :group_id => c.id.to_s}} |
| 808 | assert_equal [{'group' => c, 'name' => 'bli'}], assigns(:marked_groups) | 808 | assert_equal [{'group' => c, 'name' => 'bli'}], assigns(:marked_groups) |
| 809 | end | 809 | end |
| @@ -818,9 +818,9 @@ class CmsControllerTest < ActionController::TestCase | @@ -818,9 +818,9 @@ class CmsControllerTest < ActionController::TestCase | ||
| 818 | Environment.any_instance.stubs(:portal_community).returns(portal_community) | 818 | Environment.any_instance.stubs(:portal_community).returns(portal_community) |
| 819 | article = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails') | 819 | article = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails') |
| 820 | 820 | ||
| 821 | - assert_no_difference article.class, :count do | ||
| 822 | - assert_difference ApproveArticle, :count do | ||
| 823 | - assert_difference portal_community.tasks, :count do | 821 | + assert_no_difference 'article.class.count' do |
| 822 | + assert_difference 'ApproveArticle.count' do | ||
| 823 | + assert_difference 'portal_community.tasks.count' do | ||
| 824 | post :publish_on_portal_community, :profile => profile.identifier, :id => article.id, :name => article.name | 824 | post :publish_on_portal_community, :profile => profile.identifier, :id => article.id, :name => article.name |
| 825 | end | 825 | end |
| 826 | end | 826 | end |
| @@ -961,7 +961,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -961,7 +961,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 961 | end | 961 | end |
| 962 | 962 | ||
| 963 | should 'go to blog after create it' do | 963 | should 'go to blog after create it' do |
| 964 | - assert_difference Blog, :count do | 964 | + assert_difference 'Blog.count' do |
| 965 | post :new, :type => Blog.name, :profile => profile.identifier, :article => { :name => 'my-blog' }, :back_to => 'control_panel' | 965 | post :new, :type => Blog.name, :profile => profile.identifier, :article => { :name => 'my-blog' }, :back_to => 'control_panel' |
| 966 | end | 966 | end |
| 967 | assert_redirected_to @profile.articles.find_by_name('my-blog').view_url | 967 | assert_redirected_to @profile.articles.find_by_name('my-blog').view_url |
| @@ -1317,7 +1317,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1317,7 +1317,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 1317 | end | 1317 | end |
| 1318 | 1318 | ||
| 1319 | should 'go to forum after create it' do | 1319 | should 'go to forum after create it' do |
| 1320 | - assert_difference Forum, :count do | 1320 | + assert_difference 'Forum.count' do |
| 1321 | post :new, :type => Forum.name, :profile => profile.identifier, :article => { :name => 'my-forum' }, :back_to => 'control_panel' | 1321 | post :new, :type => Forum.name, :profile => profile.identifier, :article => { :name => 'my-forum' }, :back_to => 'control_panel' |
| 1322 | end | 1322 | end |
| 1323 | assert_redirected_to @profile.articles.find_by_name('my-forum').view_url | 1323 | assert_redirected_to @profile.articles.find_by_name('my-forum').view_url |
| @@ -1369,7 +1369,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1369,7 +1369,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 1369 | should 'create a task suggest task to a profile' do | 1369 | should 'create a task suggest task to a profile' do |
| 1370 | c = Community.create!(:name => 'test comm', :identifier => 'test_comm', :moderated_articles => true) | 1370 | c = Community.create!(:name => 'test comm', :identifier => 'test_comm', :moderated_articles => true) |
| 1371 | 1371 | ||
| 1372 | - assert_difference SuggestArticle, :count do | 1372 | + assert_difference 'SuggestArticle.count' do |
| 1373 | post :suggest_an_article, :profile => c.identifier, :back_to => 'action_view', :task => {:article_name => 'some name', :article_body => 'some body', :email => 'some@localhost.com', :name => 'some name'} | 1373 | post :suggest_an_article, :profile => c.identifier, :back_to => 'action_view', :task => {:article_name => 'some name', :article_body => 'some body', :email => 'some@localhost.com', :name => 'some name'} |
| 1374 | end | 1374 | end |
| 1375 | end | 1375 | end |
| @@ -1404,7 +1404,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1404,7 +1404,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 1404 | 1404 | ||
| 1405 | should 'add translation to an article' do | 1405 | should 'add translation to an article' do |
| 1406 | textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'ru') | 1406 | textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'ru') |
| 1407 | - assert_difference Article, :count do | 1407 | + assert_difference 'Article.count' do |
| 1408 | post :new, :profile => @profile.identifier, :type => 'TextileArticle', :article => { :name => 'english translation', :translation_of_id => textile.id, :language => 'en' } | 1408 | post :new, :profile => @profile.identifier, :type => 'TextileArticle', :article => { :name => 'english translation', :translation_of_id => textile.id, :language => 'en' } |
| 1409 | end | 1409 | end |
| 1410 | end | 1410 | end |
test/functional/comment_controller_test.rb
| @@ -26,7 +26,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -26,7 +26,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 26 | comment = fast_create(Comment, :source_id => article, :title => 'a comment', :body => 'lalala') | 26 | comment = fast_create(Comment, :source_id => article, :title => 'a comment', :body => 'lalala') |
| 27 | 27 | ||
| 28 | login_as 'normaluser' # normaluser cannot remove other people's comments | 28 | login_as 'normaluser' # normaluser cannot remove other people's comments |
| 29 | - assert_no_difference Comment, :count do | 29 | + assert_no_difference 'Comment.count' do |
| 30 | post :destroy, :profile => profile.identifier, :id => comment.id | 30 | post :destroy, :profile => profile.identifier, :id => comment.id |
| 31 | end | 31 | end |
| 32 | end | 32 | end |
| @@ -41,7 +41,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -41,7 +41,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 41 | comment = fast_create(Comment, :source_id => article, :author_id => commenter, :title => 'a comment', :body => 'lalala') | 41 | comment = fast_create(Comment, :source_id => article, :author_id => commenter, :title => 'a comment', :body => 'lalala') |
| 42 | 42 | ||
| 43 | login_as 'normaluser' # normaluser cannot remove other people's comments | 43 | login_as 'normaluser' # normaluser cannot remove other people's comments |
| 44 | - assert_no_difference Comment, :count do | 44 | + assert_no_difference 'Comment.count' do |
| 45 | xhr :post, :destroy, :profile => profile.identifier, :id => comment.id | 45 | xhr :post, :destroy, :profile => profile.identifier, :id => comment.id |
| 46 | assert_response :success | 46 | assert_response :success |
| 47 | end | 47 | end |
| @@ -57,7 +57,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -57,7 +57,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 57 | comment = fast_create(Comment, :source_id => article, :author_id => commenter, :title => 'a comment', :body => 'lalala') | 57 | comment = fast_create(Comment, :source_id => article, :author_id => commenter, :title => 'a comment', :body => 'lalala') |
| 58 | 58 | ||
| 59 | login_as 'testuser' # testuser must be able to remove comments in his articles | 59 | login_as 'testuser' # testuser must be able to remove comments in his articles |
| 60 | - assert_difference Comment, :count, -1 do | 60 | + assert_difference 'Comment.count', -1 do |
| 61 | xhr :post, :destroy, :profile => profile.identifier, :id => comment.id | 61 | xhr :post, :destroy, :profile => profile.identifier, :id => comment.id |
| 62 | assert_response :success | 62 | assert_response :success |
| 63 | end | 63 | end |
| @@ -74,7 +74,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -74,7 +74,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 74 | comment = fast_create(Comment, :source_id => image, :author_id => commenter, :title => 'a comment', :body => 'lalala') | 74 | comment = fast_create(Comment, :source_id => image, :author_id => commenter, :title => 'a comment', :body => 'lalala') |
| 75 | 75 | ||
| 76 | login_as 'testuser' # testuser must be able to remove comments in his articles | 76 | login_as 'testuser' # testuser must be able to remove comments in his articles |
| 77 | - assert_difference Comment, :count, -1 do | 77 | + assert_difference 'Comment.count', -1 do |
| 78 | xhr :post, :destroy, :profile => profile.identifier, :id => comment.id | 78 | xhr :post, :destroy, :profile => profile.identifier, :id => comment.id |
| 79 | assert_response :success | 79 | assert_response :success |
| 80 | end | 80 | end |
| @@ -87,7 +87,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -87,7 +87,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 87 | comment = fast_create(Comment, :source_id => article, :author_id => commenter, :title => 'a comment', :body => 'lalala') | 87 | comment = fast_create(Comment, :source_id => article, :author_id => commenter, :title => 'a comment', :body => 'lalala') |
| 88 | community.add_moderator(profile) | 88 | community.add_moderator(profile) |
| 89 | login_as profile.identifier | 89 | login_as profile.identifier |
| 90 | - assert_difference Comment, :count, -1 do | 90 | + assert_difference 'Comment.count', -1 do |
| 91 | xhr :post, :destroy, :profile => community.identifier, :id => comment.id | 91 | xhr :post, :destroy, :profile => community.identifier, :id => comment.id |
| 92 | assert_response :success | 92 | assert_response :success |
| 93 | end | 93 | end |
| @@ -101,7 +101,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -101,7 +101,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 101 | comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala') | 101 | comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala') |
| 102 | 102 | ||
| 103 | login_as 'testuser' | 103 | login_as 'testuser' |
| 104 | - assert_difference Comment, :count, -1 do | 104 | + assert_difference 'Comment.count', -1 do |
| 105 | xhr :post, :destroy, :profile => profile.identifier, :id => comment.id | 105 | xhr :post, :destroy, :profile => profile.identifier, :id => comment.id |
| 106 | assert_response :success | 106 | assert_response :success |
| 107 | end | 107 | end |
| @@ -113,7 +113,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -113,7 +113,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 113 | other_person = create_user('otheruser').person | 113 | other_person = create_user('otheruser').person |
| 114 | other_page = other_person.articles.create!(:name => 'myarticle', :body => 'the body of the text') | 114 | other_page = other_person.articles.create!(:name => 'myarticle', :body => 'the body of the text') |
| 115 | 115 | ||
| 116 | - assert_no_difference Comment, :count do | 116 | + assert_no_difference 'Comment.count' do |
| 117 | xhr :post, :create, :profile => profile.identifier, :id => other_page.id, :comment => { :title => 'crap!', :body => 'I think that this article is crap' } | 117 | xhr :post, :create, :profile => profile.identifier, :id => other_page.id, :comment => { :title => 'crap!', :body => 'I think that this article is crap' } |
| 118 | end | 118 | end |
| 119 | assert_match /not found/, @response.body | 119 | assert_match /not found/, @response.body |
| @@ -122,7 +122,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -122,7 +122,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 122 | should 'not be able to post comment if article do not accept it' do | 122 | should 'not be able to post comment if article do not accept it' do |
| 123 | page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text', :accept_comments => false) | 123 | page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text', :accept_comments => false) |
| 124 | 124 | ||
| 125 | - assert_no_difference Comment, :count do | 125 | + assert_no_difference 'Comment.count' do |
| 126 | xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => { :title => 'crap!', :body => 'I think that this article is crap' } | 126 | xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => { :title => 'crap!', :body => 'I think that this article is crap' } |
| 127 | end | 127 | end |
| 128 | assert_match /Comment not allowed in this article/, @response.body | 128 | assert_match /Comment not allowed in this article/, @response.body |
| @@ -162,7 +162,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -162,7 +162,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 162 | end | 162 | end |
| 163 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestFilterPlugin.new]) | 163 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestFilterPlugin.new]) |
| 164 | page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text') | 164 | page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text') |
| 165 | - assert_no_difference Comment, :count do | 165 | + assert_no_difference 'Comment.count' do |
| 166 | xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => { :title => 'title', :body => 'body', :name => "Spammer", :email => 'damn@spammer.com' }, :confirm => 'true' | 166 | xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => { :title => 'title', :body => 'body', :name => "Spammer", :email => 'damn@spammer.com' }, :confirm => 'true' |
| 167 | end | 167 | end |
| 168 | end | 168 | end |
| @@ -175,7 +175,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -175,7 +175,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 175 | end | 175 | end |
| 176 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestFilterPlugin.new]) | 176 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([TestFilterPlugin.new]) |
| 177 | page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text') | 177 | page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text') |
| 178 | - assert_no_difference Comment, :count do | 178 | + assert_no_difference 'Comment.count' do |
| 179 | xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => { :title => 'title', :body => 'body', :name => "Spammer", :email => 'damn@spammer.com' }, :confirm => 'true' | 179 | xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => { :title => 'title', :body => 'body', :name => "Spammer", :email => 'damn@spammer.com' }, :confirm => 'true' |
| 180 | end | 180 | end |
| 181 | 181 | ||
| @@ -199,7 +199,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -199,7 +199,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 199 | article.save! | 199 | article.save! |
| 200 | login_as('testinguser') | 200 | login_as('testinguser') |
| 201 | 201 | ||
| 202 | - assert_no_difference Comment, :count do | 202 | + assert_no_difference 'Comment.count' do |
| 203 | xhr :post, :create, :profile => profile.identifier, :id =>article.id, :comment => {:body => ""}, :confirm => 'true' | 203 | xhr :post, :create, :profile => profile.identifier, :id =>article.id, :comment => {:body => ""}, :confirm => 'true' |
| 204 | end | 204 | end |
| 205 | assert_match /post_comment_box opened/, @response.body | 205 | assert_match /post_comment_box opened/, @response.body |
| @@ -224,14 +224,14 @@ class CommentControllerTest < ActionController::TestCase | @@ -224,14 +224,14 @@ class CommentControllerTest < ActionController::TestCase | ||
| 224 | login_as('testinguser') | 224 | login_as('testinguser') |
| 225 | @controller.stubs(:verify_recaptcha).returns(false) | 225 | @controller.stubs(:verify_recaptcha).returns(false) |
| 226 | 226 | ||
| 227 | - assert_difference Comment, :count, 1 do | 227 | + assert_difference 'Comment.count', 1 do |
| 228 | xhr :post, :create, :profile => profile.identifier, :id => article.id, :comment => {:body => "Some comment...", :author => profile}, :confirm => 'true' | 228 | xhr :post, :create, :profile => profile.identifier, :id => article.id, :comment => {:body => "Some comment...", :author => profile}, :confirm => 'true' |
| 229 | end | 229 | end |
| 230 | 230 | ||
| 231 | environment.enable('captcha_for_logged_users') | 231 | environment.enable('captcha_for_logged_users') |
| 232 | environment.save! | 232 | environment.save! |
| 233 | 233 | ||
| 234 | - assert_no_difference Comment, :count do | 234 | + assert_no_difference 'Comment.count' do |
| 235 | xhr :post, :create, :profile => profile.identifier, :id =>article.id, :comment => {:body => "Some comment...", :author => profile}, :confirm => 'true' | 235 | xhr :post, :create, :profile => profile.identifier, :id =>article.id, :comment => {:body => "Some comment...", :author => profile}, :confirm => 'true' |
| 236 | end | 236 | end |
| 237 | assert_not_nil assigns(:comment) | 237 | assert_not_nil assigns(:comment) |
| @@ -242,12 +242,12 @@ class CommentControllerTest < ActionController::TestCase | @@ -242,12 +242,12 @@ class CommentControllerTest < ActionController::TestCase | ||
| 242 | article.save! | 242 | article.save! |
| 243 | 243 | ||
| 244 | @controller.stubs(:verify_recaptcha).returns(false) | 244 | @controller.stubs(:verify_recaptcha).returns(false) |
| 245 | - assert_no_difference Comment, :count do | 245 | + assert_no_difference 'Comment.count' do |
| 246 | xhr :post, :create, :profile => profile.identifier, :id => article.id, :comment => {:body => "Some comment...", :author => profile}, :confirm => 'true' | 246 | xhr :post, :create, :profile => profile.identifier, :id => article.id, :comment => {:body => "Some comment...", :author => profile}, :confirm => 'true' |
| 247 | end | 247 | end |
| 248 | 248 | ||
| 249 | @controller.stubs(:verify_recaptcha).returns(true) | 249 | @controller.stubs(:verify_recaptcha).returns(true) |
| 250 | - assert_difference Comment, :count, 1 do | 250 | + assert_difference 'Comment.count', 1 do |
| 251 | xhr :post, :create, :profile => profile.identifier, :id => article.id, :comment => {:body => "Some comment...", :author => profile}, :confirm => 'true' | 251 | xhr :post, :create, :profile => profile.identifier, :id => article.id, :comment => {:body => "Some comment...", :author => profile}, :confirm => 'true' |
| 252 | end | 252 | end |
| 253 | end | 253 | end |
| @@ -258,7 +258,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -258,7 +258,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 258 | page = community.articles.create!(:name => 'myarticle', :moderate_comments => true) | 258 | page = community.articles.create!(:name => 'myarticle', :moderate_comments => true) |
| 259 | 259 | ||
| 260 | commenter = create_user('otheruser').person | 260 | commenter = create_user('otheruser').person |
| 261 | - assert_difference ApproveComment, :count, 1 do | 261 | + assert_difference 'ApproveComment.count', 1 do |
| 262 | xhr :post, :create, :profile => community.identifier, :id => page.id, :comment => {:body => 'Some comment...', :author => commenter}, :confirm => 'true' | 262 | xhr :post, :create, :profile => community.identifier, :id => page.id, :comment => {:body => 'Some comment...', :author => commenter}, :confirm => 'true' |
| 263 | end | 263 | end |
| 264 | end | 264 | end |
| @@ -269,7 +269,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -269,7 +269,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 269 | page = community.articles.create!(:name => 'myarticle', :moderate_comments => true, :last_changed_by => @profile) | 269 | page = community.articles.create!(:name => 'myarticle', :moderate_comments => true, :last_changed_by => @profile) |
| 270 | community.add_moderator(@profile) | 270 | community.add_moderator(@profile) |
| 271 | 271 | ||
| 272 | - assert_no_difference ApproveComment, :count do | 272 | + assert_no_difference 'ApproveComment.count' do |
| 273 | xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => {:body => 'Some comment...'}, :confirm => 'true' | 273 | xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => {:body => 'Some comment...'}, :confirm => 'true' |
| 274 | end | 274 | end |
| 275 | end | 275 | end |
| @@ -279,7 +279,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -279,7 +279,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 279 | page = community.articles.create!(:name => 'myarticle', :moderate_comments => true) | 279 | page = community.articles.create!(:name => 'myarticle', :moderate_comments => true) |
| 280 | 280 | ||
| 281 | commenter = create_user('otheruser').person | 281 | commenter = create_user('otheruser').person |
| 282 | - assert_difference ApproveComment, :count, 1 do | 282 | + assert_difference 'ApproveComment.count', 1 do |
| 283 | xhr :post, :create, :profile => community.identifier, :id => page.id, :comment => {:body => 'Some comment...', :author => commenter}, :confirm => 'true' | 283 | xhr :post, :create, :profile => community.identifier, :id => page.id, :comment => {:body => 'Some comment...', :author => commenter}, :confirm => 'true' |
| 284 | end | 284 | end |
| 285 | task = Task.last | 285 | task = Task.last |
| @@ -293,7 +293,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -293,7 +293,7 @@ class CommentControllerTest < ActionController::TestCase | ||
| 293 | page = community.articles.create!(:name => 'myarticle', :moderate_comments => true) | 293 | page = community.articles.create!(:name => 'myarticle', :moderate_comments => true) |
| 294 | 294 | ||
| 295 | commenter = create_user('otheruser').person | 295 | commenter = create_user('otheruser').person |
| 296 | - assert_difference ApproveComment, :count, 1 do | 296 | + assert_difference 'ApproveComment.count', 1 do |
| 297 | xhr :post, :create, :profile => community.identifier, :id => page.id, :comment => {:body => 'Some comment...', :author => commenter}, :confirm => 'true' | 297 | xhr :post, :create, :profile => community.identifier, :id => page.id, :comment => {:body => 'Some comment...', :author => commenter}, :confirm => 'true' |
| 298 | end | 298 | end |
| 299 | task = Task.last | 299 | task = Task.last |
test/functional/favorite_enterprises_controller_test.rb
| @@ -44,7 +44,7 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase | @@ -44,7 +44,7 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase | ||
| 44 | end | 44 | end |
| 45 | 45 | ||
| 46 | should 'actually add favorite_enterprise' do | 46 | should 'actually add favorite_enterprise' do |
| 47 | - assert_difference profile.favorite_enterprises, :count do | 47 | + assert_difference 'profile.favorite_enterprises.count' do |
| 48 | post :add, :id => favorite_enterprise.id, :confirmation => '1' | 48 | post :add, :id => favorite_enterprise.id, :confirmation => '1' |
| 49 | assert_response :redirect | 49 | assert_response :redirect |
| 50 | 50 | ||
| @@ -64,7 +64,7 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase | @@ -64,7 +64,7 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase | ||
| 64 | should 'actually remove favorite_enterprise' do | 64 | should 'actually remove favorite_enterprise' do |
| 65 | profile.favorite_enterprises << favorite_enterprise | 65 | profile.favorite_enterprises << favorite_enterprise |
| 66 | 66 | ||
| 67 | - assert_difference profile.favorite_enterprises, :count, -1 do | 67 | + assert_difference 'profile.favorite_enterprises.count', -1 do |
| 68 | post :remove, :id => favorite_enterprise.id, :confirmation => '1' | 68 | post :remove, :id => favorite_enterprise.id, :confirmation => '1' |
| 69 | assert_redirected_to :action => 'index' | 69 | assert_redirected_to :action => 'index' |
| 70 | 70 |
test/functional/friends_controller_test.rb
| @@ -45,7 +45,7 @@ class FriendsControllerTest < ActionController::TestCase | @@ -45,7 +45,7 @@ class FriendsControllerTest < ActionController::TestCase | ||
| 45 | should 'actually remove friend' do | 45 | should 'actually remove friend' do |
| 46 | profile.add_friend(friend) | 46 | profile.add_friend(friend) |
| 47 | 47 | ||
| 48 | - assert_difference Friendship, :count, -1 do | 48 | + assert_difference 'Friendship.count', -1 do |
| 49 | post :remove, :id => friend.id, :confirmation => '1' | 49 | post :remove, :id => friend.id, :confirmation => '1' |
| 50 | assert_redirected_to :action => 'index' | 50 | assert_redirected_to :action => 'index' |
| 51 | end | 51 | end |
test/functional/invite_controller_test.rb
| @@ -12,72 +12,72 @@ class InviteControllerTest < ActionController::TestCase | @@ -12,72 +12,72 @@ class InviteControllerTest < ActionController::TestCase | ||
| 12 | 12 | ||
| 13 | should 'add manually invitation of an added address with friend object on a queue and process it later' do | 13 | should 'add manually invitation of an added address with friend object on a queue and process it later' do |
| 14 | contact_list = ContactList.create | 14 | contact_list = ContactList.create |
| 15 | - assert_difference Delayed::Job, :count, 1 do | 15 | + assert_difference 'Delayed::Job.count', 1 do |
| 16 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "#{friend.name} <#{friend.email}>", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id | 16 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "#{friend.name} <#{friend.email}>", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id |
| 17 | assert_redirected_to :controller => 'profile', :action => 'friends' | 17 | assert_redirected_to :controller => 'profile', :action => 'friends' |
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | - assert_difference InviteFriend, :count, 1 do | 20 | + assert_difference 'InviteFriend.count', 1 do |
| 21 | process_delayed_job_queue | 21 | process_delayed_job_queue |
| 22 | end | 22 | end |
| 23 | end | 23 | end |
| 24 | 24 | ||
| 25 | should 'add manually invitation of an added address with only email on a queue and process it later' do | 25 | should 'add manually invitation of an added address with only email on a queue and process it later' do |
| 26 | contact_list = ContactList.create | 26 | contact_list = ContactList.create |
| 27 | - assert_difference Delayed::Job, :count, 1 do | 27 | + assert_difference 'Delayed::Job.count', 1 do |
| 28 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "test@test.com", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id | 28 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "test@test.com", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id |
| 29 | assert_redirected_to :controller => 'profile', :action => 'friends' | 29 | assert_redirected_to :controller => 'profile', :action => 'friends' |
| 30 | end | 30 | end |
| 31 | 31 | ||
| 32 | - assert_difference InviteFriend, :count, 1 do | 32 | + assert_difference 'InviteFriend.count', 1 do |
| 33 | process_delayed_job_queue | 33 | process_delayed_job_queue |
| 34 | end | 34 | end |
| 35 | end | 35 | end |
| 36 | 36 | ||
| 37 | should 'add manually invitation of an added address with email and other format on a queue and process it later' do | 37 | should 'add manually invitation of an added address with email and other format on a queue and process it later' do |
| 38 | contact_list = ContactList.create | 38 | contact_list = ContactList.create |
| 39 | - assert_difference Delayed::Job, :count, 1 do | 39 | + assert_difference 'Delayed::Job.count', 1 do |
| 40 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "test@test.cz.com", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id | 40 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "test@test.cz.com", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id |
| 41 | assert_redirected_to :controller => 'profile', :action => 'friends' | 41 | assert_redirected_to :controller => 'profile', :action => 'friends' |
| 42 | end | 42 | end |
| 43 | 43 | ||
| 44 | - assert_difference InviteFriend, :count, 1 do | 44 | + assert_difference 'InviteFriend.count', 1 do |
| 45 | process_delayed_job_queue | 45 | process_delayed_job_queue |
| 46 | end | 46 | end |
| 47 | end | 47 | end |
| 48 | 48 | ||
| 49 | should 'add manually invitation of more than one added address on a queue and process it later' do | 49 | should 'add manually invitation of more than one added address on a queue and process it later' do |
| 50 | contact_list = ContactList.create | 50 | contact_list = ContactList.create |
| 51 | - assert_difference Delayed::Job, :count, 1 do | 51 | + assert_difference 'Delayed::Job.count', 1 do |
| 52 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "Some Friend <somefriend@email.com>\r\notherperson@bleble.net\r\n", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id | 52 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "Some Friend <somefriend@email.com>\r\notherperson@bleble.net\r\n", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id |
| 53 | assert_redirected_to :controller => 'profile', :action => 'friends' | 53 | assert_redirected_to :controller => 'profile', :action => 'friends' |
| 54 | end | 54 | end |
| 55 | 55 | ||
| 56 | - assert_difference InviteFriend, :count, 2 do | 56 | + assert_difference 'InviteFriend.count', 2 do |
| 57 | process_delayed_job_queue | 57 | process_delayed_job_queue |
| 58 | end | 58 | end |
| 59 | end | 59 | end |
| 60 | 60 | ||
| 61 | should 'add manually invitation of an added address with name and e-mail on a queue and process it later' do | 61 | should 'add manually invitation of an added address with name and e-mail on a queue and process it later' do |
| 62 | contact_list = ContactList.create | 62 | contact_list = ContactList.create |
| 63 | - assert_difference Delayed::Job, :count, 1 do | 63 | + assert_difference 'Delayed::Job.count', 1 do |
| 64 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "Test Name <test@test.com>", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id | 64 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "Test Name <test@test.com>", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id |
| 65 | assert_redirected_to :controller => 'profile', :action => 'friends' | 65 | assert_redirected_to :controller => 'profile', :action => 'friends' |
| 66 | end | 66 | end |
| 67 | 67 | ||
| 68 | - assert_difference InviteFriend, :count, 1 do | 68 | + assert_difference 'InviteFriend.count', 1 do |
| 69 | process_delayed_job_queue | 69 | process_delayed_job_queue |
| 70 | end | 70 | end |
| 71 | end | 71 | end |
| 72 | 72 | ||
| 73 | should 'add invitation of yourself on a queue and not process it later' do | 73 | should 'add invitation of yourself on a queue and not process it later' do |
| 74 | contact_list = ContactList.create | 74 | contact_list = ContactList.create |
| 75 | - assert_difference Delayed::Job, :count, 1 do | 75 | + assert_difference 'Delayed::Job.count', 1 do |
| 76 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "#{profile.name} <#{profile.user.email}>", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id | 76 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "#{profile.name} <#{profile.user.email}>", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id |
| 77 | assert_redirected_to :controller => 'profile', :action => 'friends' | 77 | assert_redirected_to :controller => 'profile', :action => 'friends' |
| 78 | end | 78 | end |
| 79 | 79 | ||
| 80 | - assert_no_difference InviteFriend, :count do | 80 | + assert_no_difference 'InviteFriend.count' do |
| 81 | process_delayed_job_queue | 81 | process_delayed_job_queue |
| 82 | end | 82 | end |
| 83 | end | 83 | end |
| @@ -87,12 +87,12 @@ class InviteControllerTest < ActionController::TestCase | @@ -87,12 +87,12 @@ class InviteControllerTest < ActionController::TestCase | ||
| 87 | friend.person.add_friend(profile) | 87 | friend.person.add_friend(profile) |
| 88 | 88 | ||
| 89 | contact_list = ContactList.create | 89 | contact_list = ContactList.create |
| 90 | - assert_difference Delayed::Job, :count, 1 do | 90 | + assert_difference 'Delayed::Job.count', 1 do |
| 91 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "#{friend.name} <#{friend.email}>", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id | 91 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "#{friend.name} <#{friend.email}>", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id |
| 92 | assert_redirected_to :controller => 'profile', :action => 'friends' | 92 | assert_redirected_to :controller => 'profile', :action => 'friends' |
| 93 | end | 93 | end |
| 94 | 94 | ||
| 95 | - assert_no_difference InviteFriend, :count do | 95 | + assert_no_difference 'InviteFriend.count' do |
| 96 | process_delayed_job_queue | 96 | process_delayed_job_queue |
| 97 | end | 97 | end |
| 98 | end | 98 | end |
| @@ -153,7 +153,7 @@ class InviteControllerTest < ActionController::TestCase | @@ -153,7 +153,7 @@ class InviteControllerTest < ActionController::TestCase | ||
| 153 | should 'create a job to get emails after choose address book' do | 153 | should 'create a job to get emails after choose address book' do |
| 154 | community.add_admin(profile) | 154 | community.add_admin(profile) |
| 155 | contact_list = ContactList.create | 155 | contact_list = ContactList.create |
| 156 | - assert_difference Delayed::Job, :count, 1 do | 156 | + assert_difference 'Delayed::Job.count', 1 do |
| 157 | post :select_address_book, :profile => community.identifier, :contact_list => contact_list.id, :import_from => 'gmail' | 157 | post :select_address_book, :profile => community.identifier, :contact_list => contact_list.id, :import_from => 'gmail' |
| 158 | end | 158 | end |
| 159 | end | 159 | end |
| @@ -219,7 +219,7 @@ class InviteControllerTest < ActionController::TestCase | @@ -219,7 +219,7 @@ class InviteControllerTest < ActionController::TestCase | ||
| 219 | should 'destroy contact_list when cancel_fetching_emails' do | 219 | should 'destroy contact_list when cancel_fetching_emails' do |
| 220 | contact_list = ContactList.create | 220 | contact_list = ContactList.create |
| 221 | 221 | ||
| 222 | - assert_difference ContactList, :count, -1 do | 222 | + assert_difference 'ContactList.count', -1 do |
| 223 | get :cancel_fetching_emails, :profile => profile.identifier, :contact_list => contact_list.id | 223 | get :cancel_fetching_emails, :profile => profile.identifier, :contact_list => contact_list.id |
| 224 | end | 224 | end |
| 225 | assert_redirected_to :action => 'select_address_book' | 225 | assert_redirected_to :action => 'select_address_book' |
test/functional/licenses_controller_test.rb
| @@ -39,7 +39,7 @@ class LicensesControllerTest < ActionController::TestCase | @@ -39,7 +39,7 @@ class LicensesControllerTest < ActionController::TestCase | ||
| 39 | end | 39 | end |
| 40 | 40 | ||
| 41 | should 'create a new license' do | 41 | should 'create a new license' do |
| 42 | - assert_difference License, :count, 1 do | 42 | + assert_difference 'License.count', 1 do |
| 43 | post :create, :license => {:name => 'GPLv3'} | 43 | post :create, :license => {:name => 'GPLv3'} |
| 44 | end | 44 | end |
| 45 | end | 45 | end |
test/functional/mailconf_controller_test.rb
| @@ -84,7 +84,7 @@ class MailconfControllerTest < ActionController::TestCase | @@ -84,7 +84,7 @@ class MailconfControllerTest < ActionController::TestCase | ||
| 84 | 84 | ||
| 85 | should 'create task to environment admin when enable email' do | 85 | should 'create task to environment admin when enable email' do |
| 86 | login_as('ze') | 86 | login_as('ze') |
| 87 | - assert_difference EmailActivation, :count do | 87 | + assert_difference 'EmailActivation.count' do |
| 88 | post :enable, :profile => 'ze' | 88 | post :enable, :profile => 'ze' |
| 89 | end | 89 | end |
| 90 | end | 90 | end |
test/functional/manage_products_controller_test.rb
| @@ -49,7 +49,7 @@ class ManageProductsControllerTest < ActionController::TestCase | @@ -49,7 +49,7 @@ class ManageProductsControllerTest < ActionController::TestCase | ||
| 49 | end | 49 | end |
| 50 | 50 | ||
| 51 | should "create new product" do | 51 | should "create new product" do |
| 52 | - assert_difference Product, :count do | 52 | + assert_difference 'Product.count' do |
| 53 | post 'new', :profile => @enterprise.identifier, :product => {:name => 'test product'}, :selected_category_id => @product_category.id | 53 | post 'new', :profile => @enterprise.identifier, :product => {:name => 'test product'}, :selected_category_id => @product_category.id |
| 54 | assert assigns(:product) | 54 | assert assigns(:product) |
| 55 | assert !assigns(:product).new_record? | 55 | assert !assigns(:product).new_record? |
| @@ -57,7 +57,7 @@ class ManageProductsControllerTest < ActionController::TestCase | @@ -57,7 +57,7 @@ class ManageProductsControllerTest < ActionController::TestCase | ||
| 57 | end | 57 | end |
| 58 | 58 | ||
| 59 | should "not create invalid product" do | 59 | should "not create invalid product" do |
| 60 | - assert_no_difference Product, :count do | 60 | + assert_no_difference 'Product.count' do |
| 61 | post 'new', :profile => @enterprise.identifier, :product => {:name => 'test product'} | 61 | post 'new', :profile => @enterprise.identifier, :product => {:name => 'test product'} |
| 62 | assert_response :success | 62 | assert_response :success |
| 63 | assert assigns(:product) | 63 | assert assigns(:product) |
| @@ -132,7 +132,7 @@ class ManageProductsControllerTest < ActionController::TestCase | @@ -132,7 +132,7 @@ class ManageProductsControllerTest < ActionController::TestCase | ||
| 132 | 132 | ||
| 133 | should "destroy product" do | 133 | should "destroy product" do |
| 134 | product = fast_create(Product, :name => 'test product', :enterprise_id => @enterprise.id, :product_category_id => @product_category.id) | 134 | product = fast_create(Product, :name => 'test product', :enterprise_id => @enterprise.id, :product_category_id => @product_category.id) |
| 135 | - assert_difference Product, :count, -1 do | 135 | + assert_difference 'Product.count', -1 do |
| 136 | post 'destroy', :profile => @enterprise.identifier, :id => product.id | 136 | post 'destroy', :profile => @enterprise.identifier, :id => product.id |
| 137 | assert_response :redirect | 137 | assert_response :redirect |
| 138 | assert_redirected_to :action => 'index' | 138 | assert_redirected_to :action => 'index' |
| @@ -144,7 +144,7 @@ class ManageProductsControllerTest < ActionController::TestCase | @@ -144,7 +144,7 @@ class ManageProductsControllerTest < ActionController::TestCase | ||
| 144 | should "fail to destroy product" do | 144 | should "fail to destroy product" do |
| 145 | product = fast_create(Product, :name => 'test product', :enterprise_id => @enterprise.id, :product_category_id => @product_category.id) | 145 | product = fast_create(Product, :name => 'test product', :enterprise_id => @enterprise.id, :product_category_id => @product_category.id) |
| 146 | Product.any_instance.stubs(:destroy).returns(false) | 146 | Product.any_instance.stubs(:destroy).returns(false) |
| 147 | - assert_no_difference Product, :count do | 147 | + assert_no_difference 'Product.count' do |
| 148 | post 'destroy', :profile => @enterprise.identifier, :id => product.id | 148 | post 'destroy', :profile => @enterprise.identifier, :id => product.id |
| 149 | assert_response :redirect | 149 | assert_response :redirect |
| 150 | assert_redirected_to :controller => "manage_products", :profile => @enterprise.identifier, :action => 'show', :id => product.id | 150 | assert_redirected_to :controller => "manage_products", :profile => @enterprise.identifier, :action => 'show', :id => product.id |
| @@ -164,7 +164,7 @@ class ManageProductsControllerTest < ActionController::TestCase | @@ -164,7 +164,7 @@ class ManageProductsControllerTest < ActionController::TestCase | ||
| 164 | should "create new product categorized" do | 164 | should "create new product categorized" do |
| 165 | category1 = fast_create(ProductCategory, :name => 'Category 1') | 165 | category1 = fast_create(ProductCategory, :name => 'Category 1') |
| 166 | category2 = fast_create(ProductCategory, :name => 'Category 2', :parent_id => category1) | 166 | category2 = fast_create(ProductCategory, :name => 'Category 2', :parent_id => category1) |
| 167 | - assert_difference Product, :count do | 167 | + assert_difference 'Product.count' do |
| 168 | post 'new', :profile => @enterprise.identifier, :product => { :name => 'test product' }, :selected_category_id => category2.id | 168 | post 'new', :profile => @enterprise.identifier, :product => { :name => 'test product' }, :selected_category_id => category2.id |
| 169 | assert_equal category2, assigns(:product).product_category | 169 | assert_equal category2, assigns(:product).product_category |
| 170 | end | 170 | end |
| @@ -248,7 +248,7 @@ class ManageProductsControllerTest < ActionController::TestCase | @@ -248,7 +248,7 @@ class ManageProductsControllerTest < ActionController::TestCase | ||
| 248 | end | 248 | end |
| 249 | 249 | ||
| 250 | should 'render redirect_via_javascript template after save' do | 250 | should 'render redirect_via_javascript template after save' do |
| 251 | - assert_difference Product, :count do | 251 | + assert_difference 'Product.count' do |
| 252 | post :new, :profile => @enterprise.identifier, :product => { :name => 'Invalid product' }, :selected_category_id => @product_category.id | 252 | post :new, :profile => @enterprise.identifier, :product => { :name => 'Invalid product' }, :selected_category_id => @product_category.id |
| 253 | assert_template 'shared/_redirect_via_javascript' | 253 | assert_template 'shared/_redirect_via_javascript' |
| 254 | end | 254 | end |
test/functional/memberships_controller_test.rb
| @@ -40,7 +40,7 @@ class MembershipsControllerTest < ActionController::TestCase | @@ -40,7 +40,7 @@ class MembershipsControllerTest < ActionController::TestCase | ||
| 40 | end | 40 | end |
| 41 | 41 | ||
| 42 | should 'be able to create a new community' do | 42 | should 'be able to create a new community' do |
| 43 | - assert_difference Community, :count do | 43 | + assert_difference 'Community.count' do |
| 44 | post :new_community, :profile => profile.identifier, :community => { :name => 'My shiny new community', :description => 'This is a community devoted to anything interesting we find in the internet '} | 44 | post :new_community, :profile => profile.identifier, :community => { :name => 'My shiny new community', :description => 'This is a community devoted to anything interesting we find in the internet '} |
| 45 | assert_response :redirect | 45 | assert_response :redirect |
| 46 | assert_redirected_to :action => 'index' | 46 | assert_redirected_to :action => 'index' |
test/functional/profile_controller_test.rb
| @@ -90,7 +90,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -90,7 +90,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 90 | should 'actually add friend' do | 90 | should 'actually add friend' do |
| 91 | login_as(@profile.identifier) | 91 | login_as(@profile.identifier) |
| 92 | person = fast_create(Person) | 92 | person = fast_create(Person) |
| 93 | - assert_difference AddFriend, :count do | 93 | + assert_difference 'AddFriend.count' do |
| 94 | post :add, :profile => person.identifier | 94 | post :add, :profile => person.identifier |
| 95 | end | 95 | end |
| 96 | end | 96 | end |
| @@ -408,7 +408,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -408,7 +408,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 408 | community.add_member(admin) | 408 | community.add_member(admin) |
| 409 | 409 | ||
| 410 | login_as profile.identifier | 410 | login_as profile.identifier |
| 411 | - assert_difference AddMember, :count do | 411 | + assert_difference 'AddMember.count' do |
| 412 | post :join, :profile => community.identifier | 412 | post :join, :profile => community.identifier |
| 413 | end | 413 | end |
| 414 | end | 414 | end |
| @@ -418,7 +418,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -418,7 +418,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 418 | community.update_attribute(:closed, true) | 418 | community.update_attribute(:closed, true) |
| 419 | 419 | ||
| 420 | login_as profile.identifier | 420 | login_as profile.identifier |
| 421 | - assert_no_difference AddMember, :count do | 421 | + assert_no_difference 'AddMember.count' do |
| 422 | post :join, :profile => community.identifier | 422 | post :join, :profile => community.identifier |
| 423 | end | 423 | end |
| 424 | end | 424 | end |
| @@ -630,7 +630,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -630,7 +630,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 630 | login_as(profile.identifier) | 630 | login_as(profile.identifier) |
| 631 | scrap = fast_create(Scrap, :sender_id => profile.id) | 631 | scrap = fast_create(Scrap, :sender_id => profile.id) |
| 632 | count = Scrap | 632 | count = Scrap |
| 633 | - assert_difference Scrap, :count, -1 do | 633 | + assert_difference 'Scrap.count', -1 do |
| 634 | post :remove_scrap, :profile => profile.identifier, :scrap_id => scrap.id | 634 | post :remove_scrap, :profile => profile.identifier, :scrap_id => scrap.id |
| 635 | end | 635 | end |
| 636 | end | 636 | end |
| @@ -639,7 +639,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -639,7 +639,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 639 | login_as(profile.identifier) | 639 | login_as(profile.identifier) |
| 640 | scrap = fast_create(Scrap, :receiver_id => profile.id) | 640 | scrap = fast_create(Scrap, :receiver_id => profile.id) |
| 641 | count = Scrap | 641 | count = Scrap |
| 642 | - assert_difference Scrap, :count, -1 do | 642 | + assert_difference 'Scrap.count', -1 do |
| 643 | post :remove_scrap, :profile => profile.identifier, :scrap_id => scrap.id | 643 | post :remove_scrap, :profile => profile.identifier, :scrap_id => scrap.id |
| 644 | end | 644 | end |
| 645 | end | 645 | end |
| @@ -649,7 +649,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -649,7 +649,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 649 | person = fast_create(Person) | 649 | person = fast_create(Person) |
| 650 | scrap = fast_create(Scrap, :sender_id => person.id, :receiver_id => person.id) | 650 | scrap = fast_create(Scrap, :sender_id => person.id, :receiver_id => person.id) |
| 651 | count = Scrap | 651 | count = Scrap |
| 652 | - assert_difference Scrap, :count, 0 do | 652 | + assert_difference 'Scrap.count', 0 do |
| 653 | post :remove_scrap, :profile => profile.identifier, :scrap_id => scrap.id | 653 | post :remove_scrap, :profile => profile.identifier, :scrap_id => scrap.id |
| 654 | end | 654 | end |
| 655 | end | 655 | end |
| @@ -1023,7 +1023,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1023,7 +1023,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 1023 | should "the owner of activity could remove it" do | 1023 | should "the owner of activity could remove it" do |
| 1024 | login_as(profile.identifier) | 1024 | login_as(profile.identifier) |
| 1025 | at = fast_create(ActionTracker::Record, :user_id => profile.id) | 1025 | at = fast_create(ActionTracker::Record, :user_id => profile.id) |
| 1026 | - assert_difference ActionTracker::Record, :count, -1 do | 1026 | + assert_difference 'ActionTracker::Record.count', -1 do |
| 1027 | post :remove_activity, :profile => profile.identifier, :activity_id => at.id | 1027 | post :remove_activity, :profile => profile.identifier, :activity_id => at.id |
| 1028 | end | 1028 | end |
| 1029 | end | 1029 | end |
| @@ -1034,7 +1034,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1034,7 +1034,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 1034 | at = fast_create(ActionTracker::Record, :user_id => profile.id) | 1034 | at = fast_create(ActionTracker::Record, :user_id => profile.id) |
| 1035 | atn = fast_create(ActionTrackerNotification, :profile_id => person.id, :action_tracker_id => at.id) | 1035 | atn = fast_create(ActionTrackerNotification, :profile_id => person.id, :action_tracker_id => at.id) |
| 1036 | count = ActionTrackerNotification | 1036 | count = ActionTrackerNotification |
| 1037 | - assert_difference ActionTrackerNotification, :count, -1 do | 1037 | + assert_difference 'ActionTrackerNotification.count', -1 do |
| 1038 | post :remove_activity, :profile => profile.identifier, :activity_id => at.id | 1038 | post :remove_activity, :profile => profile.identifier, :activity_id => at.id |
| 1039 | end | 1039 | end |
| 1040 | end | 1040 | end |
| @@ -1056,13 +1056,13 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1056,13 +1056,13 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 1056 | @controller.stubs(:user).returns(user) | 1056 | @controller.stubs(:user).returns(user) |
| 1057 | @controller.stubs(:profile).returns(owner) | 1057 | @controller.stubs(:profile).returns(owner) |
| 1058 | 1058 | ||
| 1059 | - assert_no_difference ActionTracker::Record, :count do | 1059 | + assert_no_difference 'ActionTracker::Record.count' do |
| 1060 | post :remove_activity, :profile => owner.identifier, :activity_id => activity.id | 1060 | post :remove_activity, :profile => owner.identifier, :activity_id => activity.id |
| 1061 | end | 1061 | end |
| 1062 | 1062 | ||
| 1063 | owner.environment.add_admin(user) | 1063 | owner.environment.add_admin(user) |
| 1064 | 1064 | ||
| 1065 | - assert_difference ActionTracker::Record, :count, -1 do | 1065 | + assert_difference 'ActionTracker::Record.count', -1 do |
| 1066 | post :remove_activity, :profile => owner.identifier, :activity_id => activity.id | 1066 | post :remove_activity, :profile => owner.identifier, :activity_id => activity.id |
| 1067 | end | 1067 | end |
| 1068 | end | 1068 | end |
| @@ -1076,13 +1076,13 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1076,13 +1076,13 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 1076 | @controller.stubs(:user).returns(user) | 1076 | @controller.stubs(:user).returns(user) |
| 1077 | @controller.stubs(:profile).returns(profile) | 1077 | @controller.stubs(:profile).returns(profile) |
| 1078 | 1078 | ||
| 1079 | - assert_no_difference ActionTrackerNotification, :count do | 1079 | + assert_no_difference 'ActionTrackerNotification.count' do |
| 1080 | post :remove_notification, :profile => profile.identifier, :activity_id => activity.id | 1080 | post :remove_notification, :profile => profile.identifier, :activity_id => activity.id |
| 1081 | end | 1081 | end |
| 1082 | 1082 | ||
| 1083 | profile.environment.add_admin(user) | 1083 | profile.environment.add_admin(user) |
| 1084 | 1084 | ||
| 1085 | - assert_difference ActionTrackerNotification, :count, -1 do | 1085 | + assert_difference 'ActionTrackerNotification.count', -1 do |
| 1086 | post :remove_activity, :profile => profile.identifier, :activity_id => activity.id | 1086 | post :remove_activity, :profile => profile.identifier, :activity_id => activity.id |
| 1087 | end | 1087 | end |
| 1088 | end | 1088 | end |
| @@ -1300,7 +1300,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1300,7 +1300,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 1300 | login_as(profile.identifier) | 1300 | login_as(profile.identifier) |
| 1301 | @controller.stubs(:verify_recaptcha).returns(true) | 1301 | @controller.stubs(:verify_recaptcha).returns(true) |
| 1302 | 1302 | ||
| 1303 | - assert_difference AbuseReport, :count, 1 do | 1303 | + assert_difference 'AbuseReport.count', 1 do |
| 1304 | post :register_report, :profile => reported.identifier, :abuse_report => {:reason => 'some reason'} | 1304 | post :register_report, :profile => reported.identifier, :abuse_report => {:reason => 'some reason'} |
| 1305 | end | 1305 | end |
| 1306 | end | 1306 | end |
| @@ -1312,7 +1312,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1312,7 +1312,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 1312 | environment.add_admin(profile) | 1312 | environment.add_admin(profile) |
| 1313 | @controller.expects(:verify_recaptcha).never | 1313 | @controller.expects(:verify_recaptcha).never |
| 1314 | 1314 | ||
| 1315 | - assert_difference AbuseReport, :count, 1 do | 1315 | + assert_difference 'AbuseReport.count', 1 do |
| 1316 | post :register_report, :profile => reported.identifier, :abuse_report => {:reason => 'some reason'} | 1316 | post :register_report, :profile => reported.identifier, :abuse_report => {:reason => 'some reason'} |
| 1317 | end | 1317 | end |
| 1318 | end | 1318 | end |
| @@ -1432,7 +1432,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1432,7 +1432,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 1432 | create_user_with_permission('profile_moderator_user', 'send_mail_to_members', community) | 1432 | create_user_with_permission('profile_moderator_user', 'send_mail_to_members', community) |
| 1433 | login_as('profile_moderator_user') | 1433 | login_as('profile_moderator_user') |
| 1434 | @controller.stubs(:locale).returns('pt') | 1434 | @controller.stubs(:locale).returns('pt') |
| 1435 | - assert_difference Delayed::Job, :count, 1 do | 1435 | + assert_difference 'Delayed::Job.count', 1 do |
| 1436 | post :send_mail, :profile => community.identifier, :mailing => {:subject => 'Hello', :body => 'We have some news'} | 1436 | post :send_mail, :profile => community.identifier, :mailing => {:subject => 'Hello', :body => 'We have some news'} |
| 1437 | end | 1437 | end |
| 1438 | end | 1438 | end |
test/functional/profile_design_controller_test.rb
| @@ -163,7 +163,7 @@ class ProfileDesignControllerTest < ActionController::TestCase | @@ -163,7 +163,7 @@ class ProfileDesignControllerTest < ActionController::TestCase | ||
| 163 | end | 163 | end |
| 164 | 164 | ||
| 165 | def test_should_remove_block | 165 | def test_should_remove_block |
| 166 | - assert_difference Block, :count, -1 do | 166 | + assert_difference 'Block.count', -1 do |
| 167 | post :remove, :profile => 'designtestuser', :id => @b2.id | 167 | post :remove, :profile => 'designtestuser', :id => @b2.id |
| 168 | assert_response :redirect | 168 | assert_response :redirect |
| 169 | assert_redirected_to :action => 'index' | 169 | assert_redirected_to :action => 'index' |
| @@ -315,14 +315,14 @@ class ProfileDesignControllerTest < ActionController::TestCase | @@ -315,14 +315,14 @@ class ProfileDesignControllerTest < ActionController::TestCase | ||
| 315 | end | 315 | end |
| 316 | 316 | ||
| 317 | should 'actually add a new block' do | 317 | should 'actually add a new block' do |
| 318 | - assert_difference Block, :count do | 318 | + assert_difference 'Block.count' do |
| 319 | post :add_block, :profile => 'designtestuser', :box_id => @box1.id, :type => RecentDocumentsBlock.name | 319 | post :add_block, :profile => 'designtestuser', :box_id => @box1.id, :type => RecentDocumentsBlock.name |
| 320 | assert_redirected_to :action => 'index' | 320 | assert_redirected_to :action => 'index' |
| 321 | end | 321 | end |
| 322 | end | 322 | end |
| 323 | 323 | ||
| 324 | should 'not allow to create unknown types' do | 324 | should 'not allow to create unknown types' do |
| 325 | - assert_no_difference Block, :count do | 325 | + assert_no_difference 'Block.count' do |
| 326 | assert_raise ArgumentError do | 326 | assert_raise ArgumentError do |
| 327 | post :add_block, :profile => 'designtestuser', :box_id => @box1.id, :type => "PleaseLetMeCrackYourSite" | 327 | post :add_block, :profile => 'designtestuser', :box_id => @box1.id, :type => "PleaseLetMeCrackYourSite" |
| 328 | end | 328 | end |
test/functional/profile_editor_controller_test.rb
| @@ -802,7 +802,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -802,7 +802,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
| 802 | should 'be able to destroy a person' do | 802 | should 'be able to destroy a person' do |
| 803 | person = fast_create(Person) | 803 | person = fast_create(Person) |
| 804 | 804 | ||
| 805 | - assert_difference Person, :count, -1 do | 805 | + assert_difference 'Person.count', -1 do |
| 806 | post :destroy_profile, :profile => person.identifier | 806 | post :destroy_profile, :profile => person.identifier |
| 807 | end | 807 | end |
| 808 | end | 808 | end |
| @@ -813,7 +813,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -813,7 +813,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
| 813 | person = create_user('foo').person | 813 | person = create_user('foo').person |
| 814 | community.add_admin(person) | 814 | community.add_admin(person) |
| 815 | 815 | ||
| 816 | - assert_difference Community, :count, -1 do | 816 | + assert_difference 'Community.count', -1 do |
| 817 | post :destroy_profile, :profile => community.identifier | 817 | post :destroy_profile, :profile => community.identifier |
| 818 | end | 818 | end |
| 819 | end | 819 | end |
| @@ -826,7 +826,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -826,7 +826,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
| 826 | community.add_member(person) | 826 | community.add_member(person) |
| 827 | 827 | ||
| 828 | login_as 'foo' | 828 | login_as 'foo' |
| 829 | - assert_difference Community, :count, 0 do | 829 | + assert_difference 'Community.count', 0 do |
| 830 | post :destroy_profile, :profile => community.identifier | 830 | post :destroy_profile, :profile => community.identifier |
| 831 | end | 831 | end |
| 832 | end | 832 | end |
| @@ -837,7 +837,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -837,7 +837,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
| 837 | person = create_user('foo').person | 837 | person = create_user('foo').person |
| 838 | enterprise.add_admin(person) | 838 | enterprise.add_admin(person) |
| 839 | 839 | ||
| 840 | - assert_difference Enterprise, :count, -1 do | 840 | + assert_difference 'Enterprise.count', -1 do |
| 841 | post :destroy_profile, :profile => enterprise.identifier | 841 | post :destroy_profile, :profile => enterprise.identifier |
| 842 | end | 842 | end |
| 843 | end | 843 | end |
| @@ -850,7 +850,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -850,7 +850,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
| 850 | enterprise.add_member(person) | 850 | enterprise.add_member(person) |
| 851 | 851 | ||
| 852 | login_as('foo') | 852 | login_as('foo') |
| 853 | - assert_difference Enterprise, :count, 0 do | 853 | + assert_difference 'Enterprise.count', 0 do |
| 854 | post :destroy_profile, :profile => enterprise.identifier | 854 | post :destroy_profile, :profile => enterprise.identifier |
| 855 | end | 855 | end |
| 856 | end | 856 | end |
test/functional/role_controller_test.rb
| @@ -66,14 +66,14 @@ class RoleControllerTest < ActionController::TestCase | @@ -66,14 +66,14 @@ class RoleControllerTest < ActionController::TestCase | ||
| 66 | end | 66 | end |
| 67 | 67 | ||
| 68 | def test_should_create_new_role | 68 | def test_should_create_new_role |
| 69 | - assert_difference Role, :count do | 69 | + assert_difference 'Role.count' do |
| 70 | post 'create', :role => { :name => 'Test Role', :permissions => ["test"] } | 70 | post 'create', :role => { :name => 'Test Role', :permissions => ["test"] } |
| 71 | end | 71 | end |
| 72 | assert_redirected_to :action => 'show', :id => Role.last.id | 72 | assert_redirected_to :action => 'show', :id => Role.last.id |
| 73 | end | 73 | end |
| 74 | 74 | ||
| 75 | def test_should_not_create_new_role | 75 | def test_should_not_create_new_role |
| 76 | - assert_no_difference Role, :count do | 76 | + assert_no_difference 'Role.count' do |
| 77 | post 'create', :role => { } | 77 | post 'create', :role => { } |
| 78 | end | 78 | end |
| 79 | assert_template :new | 79 | assert_template :new |
test/functional/tasks_controller_test.rb
| @@ -144,7 +144,7 @@ class TasksControllerTest < ActionController::TestCase | @@ -144,7 +144,7 @@ class TasksControllerTest < ActionController::TestCase | ||
| 144 | end | 144 | end |
| 145 | 145 | ||
| 146 | should 'create a ticket' do | 146 | should 'create a ticket' do |
| 147 | - assert_difference Ticket, :count do | 147 | + assert_difference 'Ticket.count' do |
| 148 | post :new, :profile => profile.identifier, :ticket => {:name => 'test ticket'} | 148 | post :new, :profile => profile.identifier, :ticket => {:name => 'test ticket'} |
| 149 | end | 149 | end |
| 150 | end | 150 | end |
| @@ -244,7 +244,7 @@ class TasksControllerTest < ActionController::TestCase | @@ -244,7 +244,7 @@ class TasksControllerTest < ActionController::TestCase | ||
| 244 | a = ApproveArticle.create!(:article => article, :target => c, :requestor => person) | 244 | a = ApproveArticle.create!(:article => article, :target => c, :requestor => person) |
| 245 | assert_includes c.tasks, a | 245 | assert_includes c.tasks, a |
| 246 | 246 | ||
| 247 | - assert_difference article.class, :count do | 247 | + assert_difference 'article.class.count' do |
| 248 | post :close, :tasks => {a.id => {:decision => 'finish', :task => {:name => "", :highlighted => "0", :article_parent_id => c_blog2.id.to_s}}} | 248 | post :close, :tasks => {a.id => {:decision => 'finish', :task => {:name => "", :highlighted => "0", :article_parent_id => c_blog2.id.to_s}}} |
| 249 | end | 249 | end |
| 250 | assert p_article = article.class.find_by_reference_article_id(article.id) | 250 | assert p_article = article.class.find_by_reference_article_id(article.id) |
test/integration/enterprise_registration_test.rb
| @@ -37,7 +37,7 @@ class EnterpriseRegistrationTest < ActionController::IntegrationTest | @@ -37,7 +37,7 @@ class EnterpriseRegistrationTest < ActionController::IntegrationTest | ||
| 37 | assert_response :success | 37 | assert_response :success |
| 38 | assert_tag :tag => 'form', :attributes => { :action => '/enterprise_registration', :method => 'post' }, :descendant => { :tag => 'input', :attributes => { :type => 'radio', :name => 'create_enterprise[target_id]', :value => org.id } } | 38 | assert_tag :tag => 'form', :attributes => { :action => '/enterprise_registration', :method => 'post' }, :descendant => { :tag => 'input', :attributes => { :type => 'radio', :name => 'create_enterprise[target_id]', :value => org.id } } |
| 39 | 39 | ||
| 40 | - assert_difference CreateEnterprise, :count do | 40 | + assert_difference 'CreateEnterprise.count' do |
| 41 | post '/enterprise_registration', :create_enterprise => data.merge(:target_id => org.id) | 41 | post '/enterprise_registration', :create_enterprise => data.merge(:target_id => org.id) |
| 42 | end | 42 | end |
| 43 | 43 |
test/integration/exception_notification_test.rb
| @@ -16,7 +16,7 @@ begin | @@ -16,7 +16,7 @@ begin | ||
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | should 'deliver mail notification about exceptions' do | 18 | should 'deliver mail notification about exceptions' do |
| 19 | - assert_difference ActionMailer::Base.deliveries, :size do | 19 | + assert_difference 'ActionMailer::Base.deliveries.size' do |
| 20 | get '/account/signup' | 20 | get '/account/signup' |
| 21 | end | 21 | end |
| 22 | end | 22 | end |
test/integration/manage_documents_test.rb
| @@ -23,7 +23,7 @@ class ManageDocumentsTest < ActionController::IntegrationTest | @@ -23,7 +23,7 @@ class ManageDocumentsTest < ActionController::IntegrationTest | ||
| 23 | assert_response :success | 23 | assert_response :success |
| 24 | assert_tag :tag => 'form', :attributes => { :action => '/myprofile/myuser/cms/new', :method => /post/i } | 24 | assert_tag :tag => 'form', :attributes => { :action => '/myprofile/myuser/cms/new', :method => /post/i } |
| 25 | 25 | ||
| 26 | - assert_difference Article, :count do | 26 | + assert_difference 'Article.count' do |
| 27 | post '/myprofile/myuser/cms/new', :type => 'TinyMceArticle', :article => { :name => 'my article', :body => 'this is the body of ther article'} | 27 | post '/myprofile/myuser/cms/new', :type => 'TinyMceArticle', :article => { :name => 'my article', :body => 'this is the body of ther article'} |
| 28 | end | 28 | end |
| 29 | 29 | ||
| @@ -54,7 +54,7 @@ class ManageDocumentsTest < ActionController::IntegrationTest | @@ -54,7 +54,7 @@ class ManageDocumentsTest < ActionController::IntegrationTest | ||
| 54 | assert_response :success | 54 | assert_response :success |
| 55 | assert_tag :tag => 'form', :attributes => { :action => "/myprofile/myuser/cms/edit/#{article.id}", :method => /post/i } | 55 | assert_tag :tag => 'form', :attributes => { :action => "/myprofile/myuser/cms/edit/#{article.id}", :method => /post/i } |
| 56 | 56 | ||
| 57 | - assert_no_difference Article, :count do | 57 | + assert_no_difference 'Article.count' do |
| 58 | post "/myprofile/myuser/cms/edit/#{article.id}", :article => { :name => 'my article', :body => 'this is the body of the article'} | 58 | post "/myprofile/myuser/cms/edit/#{article.id}", :article => { :name => 'my article', :body => 'this is the body of the article'} |
| 59 | end | 59 | end |
| 60 | 60 |
test/integration/signup_test.rb
| @@ -8,7 +8,7 @@ class SignupTest < ActionController::IntegrationTest | @@ -8,7 +8,7 @@ class SignupTest < ActionController::IntegrationTest | ||
| 8 | end | 8 | end |
| 9 | 9 | ||
| 10 | def test_signup_form_submission_must_be_blocked_for_fast_bots | 10 | def test_signup_form_submission_must_be_blocked_for_fast_bots |
| 11 | - assert_no_difference User, :count do | 11 | + assert_no_difference 'User.count' do |
| 12 | registering_with_bot_test 5, 1 | 12 | registering_with_bot_test 5, 1 |
| 13 | end | 13 | end |
| 14 | assert_template 'signup' | 14 | assert_template 'signup' |
| @@ -16,7 +16,7 @@ class SignupTest < ActionController::IntegrationTest | @@ -16,7 +16,7 @@ class SignupTest < ActionController::IntegrationTest | ||
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | def test_signup_form_submission_must_not_block_after_min_signup_delay | 18 | def test_signup_form_submission_must_not_block_after_min_signup_delay |
| 19 | - assert_difference User, :count, 1 do | 19 | + assert_difference 'User.count', 1 do |
| 20 | registering_with_bot_test 1, 2 | 20 | registering_with_bot_test 1, 2 |
| 21 | end | 21 | end |
| 22 | end | 22 | end |
test/unit/add_friend_test.rb
| @@ -16,7 +16,7 @@ class AddFriendTest < ActiveSupport::TestCase | @@ -16,7 +16,7 @@ class AddFriendTest < ActiveSupport::TestCase | ||
| 16 | 16 | ||
| 17 | task = fast_create(AddFriend, :requestor_id => person1.id, :target_id => person2.id, :target_type => 'Person') | 17 | task = fast_create(AddFriend, :requestor_id => person1.id, :target_id => person2.id, :target_type => 'Person') |
| 18 | 18 | ||
| 19 | - assert_difference Friendship, :count, 2 do | 19 | + assert_difference 'Friendship.count', 2 do |
| 20 | task.finish | 20 | task.finish |
| 21 | end | 21 | end |
| 22 | person1.friends.reload | 22 | person1.friends.reload |
| @@ -32,7 +32,7 @@ class AddFriendTest < ActiveSupport::TestCase | @@ -32,7 +32,7 @@ class AddFriendTest < ActiveSupport::TestCase | ||
| 32 | task.group_for_friend = 'friend2' | 32 | task.group_for_friend = 'friend2' |
| 33 | assert task.save | 33 | assert task.save |
| 34 | 34 | ||
| 35 | - assert_difference Friendship, :count, 2 do | 35 | + assert_difference 'Friendship.count', 2 do |
| 36 | task.finish | 36 | task.finish |
| 37 | end | 37 | end |
| 38 | 38 |
test/unit/approve_article_test.rb
| @@ -28,7 +28,7 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -28,7 +28,7 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
| 28 | should 'create an article with the same class as original when finished' do | 28 | should 'create an article with the same class as original when finished' do |
| 29 | a = create(ApproveArticle, :article => article, :target => community, :requestor => profile) | 29 | a = create(ApproveArticle, :article => article, :target => community, :requestor => profile) |
| 30 | 30 | ||
| 31 | - assert_difference article.class, :count do | 31 | + assert_difference 'article.class.count' do |
| 32 | a.finish | 32 | a.finish |
| 33 | end | 33 | end |
| 34 | end | 34 | end |
| @@ -74,7 +74,7 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -74,7 +74,7 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
| 74 | should 'handle blank names' do | 74 | should 'handle blank names' do |
| 75 | a = create(ApproveArticle, :name => '', :article => article, :target => community, :requestor => profile) | 75 | a = create(ApproveArticle, :name => '', :article => article, :target => community, :requestor => profile) |
| 76 | 76 | ||
| 77 | - assert_difference article.class, :count do | 77 | + assert_difference 'article.class.count' do |
| 78 | a.finish | 78 | a.finish |
| 79 | end | 79 | end |
| 80 | end | 80 | end |
| @@ -280,7 +280,7 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -280,7 +280,7 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
| 280 | a.finish | 280 | a.finish |
| 281 | assert_equal 2, ActionTracker::Record.count | 281 | assert_equal 2, ActionTracker::Record.count |
| 282 | 282 | ||
| 283 | - assert_no_difference ActionTracker::Record, :count do | 283 | + assert_no_difference 'ActionTracker::Record.count' do |
| 284 | published = article1.class.last | 284 | published = article1.class.last |
| 285 | published.name = 'foo';published.save! | 285 | published.name = 'foo';published.save! |
| 286 | 286 | ||
| @@ -374,18 +374,18 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -374,18 +374,18 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
| 374 | should 'approve an event' do | 374 | should 'approve an event' do |
| 375 | event = fast_create(Event, :profile_id => profile.id, :name => 'Event test', :slug => 'event-test', :abstract => 'Lead of article', :body => 'This is my event') | 375 | event = fast_create(Event, :profile_id => profile.id, :name => 'Event test', :slug => 'event-test', :abstract => 'Lead of article', :body => 'This is my event') |
| 376 | task = create(ApproveArticle, :name => 'Event test', :article => event, :target => community, :requestor => profile) | 376 | task = create(ApproveArticle, :name => 'Event test', :article => event, :target => community, :requestor => profile) |
| 377 | - assert_difference event.class, :count do | 377 | + assert_difference 'event.class.count' do |
| 378 | task.finish | 378 | task.finish |
| 379 | end | 379 | end |
| 380 | end | 380 | end |
| 381 | 381 | ||
| 382 | should 'approve same article twice changing its name' do | 382 | should 'approve same article twice changing its name' do |
| 383 | task1 = create(ApproveArticle, :article => article, :target => community, :requestor => profile) | 383 | task1 = create(ApproveArticle, :article => article, :target => community, :requestor => profile) |
| 384 | - assert_difference article.class, :count do | 384 | + assert_difference 'article.class.count' do |
| 385 | task1.finish | 385 | task1.finish |
| 386 | end | 386 | end |
| 387 | task2 = create(ApproveArticle, :name => article.name + ' v2', :article => article, :target => community, :requestor => profile) | 387 | task2 = create(ApproveArticle, :name => article.name + ' v2', :article => article, :target => community, :requestor => profile) |
| 388 | - assert_difference article.class, :count do | 388 | + assert_difference 'article.class.count' do |
| 389 | assert_nothing_raised ActiveRecord::RecordInvalid do | 389 | assert_nothing_raised ActiveRecord::RecordInvalid do |
| 390 | task2.finish | 390 | task2.finish |
| 391 | end | 391 | end |
| @@ -394,11 +394,11 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -394,11 +394,11 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
| 394 | 394 | ||
| 395 | should 'not approve same article twice if not changing its name' do | 395 | should 'not approve same article twice if not changing its name' do |
| 396 | task1 = create(ApproveArticle, :article => article, :target => community, :requestor => profile) | 396 | task1 = create(ApproveArticle, :article => article, :target => community, :requestor => profile) |
| 397 | - assert_difference article.class, :count do | 397 | + assert_difference 'article.class.count' do |
| 398 | task1.finish | 398 | task1.finish |
| 399 | end | 399 | end |
| 400 | task2 = create(ApproveArticle, :article => article, :target => community, :requestor => profile) | 400 | task2 = create(ApproveArticle, :article => article, :target => community, :requestor => profile) |
| 401 | - assert_no_difference article.class, :count do | 401 | + assert_no_difference 'article.class.count' do |
| 402 | assert_raises ActiveRecord::RecordInvalid do | 402 | assert_raises ActiveRecord::RecordInvalid do |
| 403 | task2.finish | 403 | task2.finish |
| 404 | end | 404 | end |
test/unit/approve_comment_test.rb
| @@ -71,7 +71,7 @@ class ApproveCommentTest < ActiveSupport::TestCase | @@ -71,7 +71,7 @@ class ApproveCommentTest < ActiveSupport::TestCase | ||
| 71 | 71 | ||
| 72 | should 'create comment when finishing task' do | 72 | should 'create comment when finishing task' do |
| 73 | approve_comment = ApproveComment.create!(:target => @community, :comment_attributes => @comment.attributes.to_json, :requestor => @profile) | 73 | approve_comment = ApproveComment.create!(:target => @community, :comment_attributes => @comment.attributes.to_json, :requestor => @profile) |
| 74 | - assert_difference @article.comments, :count, 1 do | 74 | + assert_difference '@article.comments.count', 1 do |
| 75 | approve_comment.finish | 75 | approve_comment.finish |
| 76 | end | 76 | end |
| 77 | end | 77 | end |
| @@ -80,7 +80,7 @@ class ApproveCommentTest < ActiveSupport::TestCase | @@ -80,7 +80,7 @@ class ApproveCommentTest < ActiveSupport::TestCase | ||
| 80 | now = Time.now.in_time_zone - 10 | 80 | now = Time.now.in_time_zone - 10 |
| 81 | @comment.created_at = now | 81 | @comment.created_at = now |
| 82 | approve_comment = ApproveComment.create!(:target => @community, :comment_attributes => @comment.attributes.to_json, :requestor => @profile) | 82 | approve_comment = ApproveComment.create!(:target => @community, :comment_attributes => @comment.attributes.to_json, :requestor => @profile) |
| 83 | - assert_difference @article.comments, :count, 1 do | 83 | + assert_difference '@article.comments.count', 1 do |
| 84 | approve_comment.finish | 84 | approve_comment.finish |
| 85 | end | 85 | end |
| 86 | comment = Comment.last | 86 | comment = Comment.last |
test/unit/article_categorization_test.rb
| @@ -28,7 +28,7 @@ class ArticleCategorizationTest < ActiveSupport::TestCase | @@ -28,7 +28,7 @@ class ArticleCategorizationTest < ActiveSupport::TestCase | ||
| 28 | p = create_user('testuser').person | 28 | p = create_user('testuser').person |
| 29 | a = p.articles.create!(:name => 'test') | 29 | a = p.articles.create!(:name => 'test') |
| 30 | 30 | ||
| 31 | - assert_difference ArticleCategorization, :count, 2 do | 31 | + assert_difference 'ArticleCategorization.count(:category_id)', 2 do |
| 32 | ArticleCategorization.add_category_to_article(c2, a) | 32 | ArticleCategorization.add_category_to_article(c2, a) |
| 33 | end | 33 | end |
| 34 | 34 | ||
| @@ -43,7 +43,7 @@ class ArticleCategorizationTest < ActiveSupport::TestCase | @@ -43,7 +43,7 @@ class ArticleCategorizationTest < ActiveSupport::TestCase | ||
| 43 | p = create_user('testuser').person | 43 | p = create_user('testuser').person |
| 44 | a = p.articles.create!(:name => 'test') | 44 | a = p.articles.create!(:name => 'test') |
| 45 | 45 | ||
| 46 | - assert_difference ArticleCategorization, :count, 3 do | 46 | + assert_difference 'ArticleCategorization.count(:category_id)', 3 do |
| 47 | ArticleCategorization.add_category_to_article(c2, a) | 47 | ArticleCategorization.add_category_to_article(c2, a) |
| 48 | ArticleCategorization.add_category_to_article(c3, a) | 48 | ArticleCategorization.add_category_to_article(c3, a) |
| 49 | end | 49 | end |
| @@ -60,7 +60,7 @@ class ArticleCategorizationTest < ActiveSupport::TestCase | @@ -60,7 +60,7 @@ class ArticleCategorizationTest < ActiveSupport::TestCase | ||
| 60 | ArticleCategorization.add_category_to_article(c2, a) | 60 | ArticleCategorization.add_category_to_article(c2, a) |
| 61 | ArticleCategorization.add_category_to_article(c3, a) | 61 | ArticleCategorization.add_category_to_article(c3, a) |
| 62 | 62 | ||
| 63 | - assert_difference ArticleCategorization, :count, -3 do | 63 | + assert_difference 'ArticleCategorization.count(:category_id)', -3 do |
| 64 | ArticleCategorization.remove_all_for(a) | 64 | ArticleCategorization.remove_all_for(a) |
| 65 | end | 65 | end |
| 66 | end | 66 | end |
| @@ -72,7 +72,7 @@ class ArticleCategorizationTest < ActiveSupport::TestCase | @@ -72,7 +72,7 @@ class ArticleCategorizationTest < ActiveSupport::TestCase | ||
| 72 | p = create_user('testuser').person | 72 | p = create_user('testuser').person |
| 73 | a = p.articles.create!(:name => 'test') | 73 | a = p.articles.create!(:name => 'test') |
| 74 | 74 | ||
| 75 | - assert_difference ArticleCategorization, :count, 2 do | 75 | + assert_difference 'ArticleCategorization.count(:category_id)', 2 do |
| 76 | ArticleCategorization.add_category_to_article(c2, a) | 76 | ArticleCategorization.add_category_to_article(c2, a) |
| 77 | ArticleCategorization.add_category_to_article(c1, a) | 77 | ArticleCategorization.add_category_to_article(c1, a) |
| 78 | end | 78 | end |
test/unit/article_test.rb
| @@ -308,10 +308,10 @@ class ArticleTest < ActiveSupport::TestCase | @@ -308,10 +308,10 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 308 | end | 308 | end |
| 309 | 309 | ||
| 310 | should 'remove comments when removing article' do | 310 | should 'remove comments when removing article' do |
| 311 | - assert_no_difference Comment, :count do | 311 | + assert_no_difference 'Comment.count' do |
| 312 | a = create(Article, :name => 'test article', :profile_id => profile.id) | 312 | a = create(Article, :name => 'test article', :profile_id => profile.id) |
| 313 | 313 | ||
| 314 | - assert_difference Comment, :count, 1 do | 314 | + assert_difference 'Comment.count', 1 do |
| 315 | comment = a.comments.build | 315 | comment = a.comments.build |
| 316 | comment.author = profile | 316 | comment.author = profile |
| 317 | comment.title = 'test comment' | 317 | comment.title = 'test comment' |
| @@ -975,7 +975,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -975,7 +975,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 975 | 975 | ||
| 976 | should 'destroy activity when a published article is removed' do | 976 | should 'destroy activity when a published article is removed' do |
| 977 | a = create(TinyMceArticle, :profile_id => profile.id) | 977 | a = create(TinyMceArticle, :profile_id => profile.id) |
| 978 | - assert_difference ActionTracker::Record, :count, -1 do | 978 | + assert_difference 'ActionTracker::Record.count', -1 do |
| 979 | a.destroy | 979 | a.destroy |
| 980 | end | 980 | end |
| 981 | end | 981 | end |
| @@ -1124,7 +1124,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1124,7 +1124,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1124 | process_delayed_job_queue | 1124 | process_delayed_job_queue |
| 1125 | assert_equal 2, ActionTrackerNotification.find_all_by_action_tracker_id(activity.id).count | 1125 | assert_equal 2, ActionTrackerNotification.find_all_by_action_tracker_id(activity.id).count |
| 1126 | 1126 | ||
| 1127 | - assert_difference ActionTrackerNotification, :count, -2 do | 1127 | + assert_difference 'ActionTrackerNotification.count', -2 do |
| 1128 | article.destroy | 1128 | article.destroy |
| 1129 | end | 1129 | end |
| 1130 | 1130 | ||
| @@ -1147,7 +1147,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1147,7 +1147,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1147 | process_delayed_job_queue | 1147 | process_delayed_job_queue |
| 1148 | assert_equal 3, ActionTrackerNotification.find_all_by_action_tracker_id(activity.id).count | 1148 | assert_equal 3, ActionTrackerNotification.find_all_by_action_tracker_id(activity.id).count |
| 1149 | 1149 | ||
| 1150 | - assert_difference ActionTrackerNotification, :count, -3 do | 1150 | + assert_difference 'ActionTrackerNotification.count', -3 do |
| 1151 | article.destroy | 1151 | article.destroy |
| 1152 | end | 1152 | end |
| 1153 | 1153 | ||
| @@ -1767,7 +1767,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1767,7 +1767,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
| 1767 | end | 1767 | end |
| 1768 | 1768 | ||
| 1769 | should 'save image on create article' do | 1769 | should 'save image on create article' do |
| 1770 | - assert_difference Article, :count do | 1770 | + assert_difference 'Article.count' do |
| 1771 | p = create(Article, :name => 'test', :image_builder => { | 1771 | p = create(Article, :name => 'test', :image_builder => { |
| 1772 | :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') | 1772 | :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') |
| 1773 | }, :profile_id => @profile.id) | 1773 | }, :profile_id => @profile.id) |
test/unit/blog_test.rb
| @@ -125,7 +125,7 @@ class BlogTest < ActiveSupport::TestCase | @@ -125,7 +125,7 @@ class BlogTest < ActiveSupport::TestCase | ||
| 125 | p = create_user('testuser').person | 125 | p = create_user('testuser').person |
| 126 | blog = create(Blog, :name => 'Blog test', :profile => p, :external_feed_builder => {:enabled => true, :address => "http://bli.org/feed"}) | 126 | blog = create(Blog, :name => 'Blog test', :profile => p, :external_feed_builder => {:enabled => true, :address => "http://bli.org/feed"}) |
| 127 | assert blog.external_feed | 127 | assert blog.external_feed |
| 128 | - assert_difference ExternalFeed, :count, -1 do | 128 | + assert_difference 'ExternalFeed.count', -1 do |
| 129 | blog.destroy | 129 | blog.destroy |
| 130 | end | 130 | end |
| 131 | end | 131 | end |
test/unit/category_test.rb
| @@ -400,7 +400,7 @@ class CategoryTest < ActiveSupport::TestCase | @@ -400,7 +400,7 @@ class CategoryTest < ActiveSupport::TestCase | ||
| 400 | end | 400 | end |
| 401 | 401 | ||
| 402 | should 'have image' do | 402 | should 'have image' do |
| 403 | - assert_difference Category, :count do | 403 | + assert_difference 'Category.count' do |
| 404 | c = create(Category, :name => 'test category1', :environment => Environment.default, :image_builder => { | 404 | c = create(Category, :name => 'test category1', :environment => Environment.default, :image_builder => { |
| 405 | :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') | 405 | :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') |
| 406 | }) | 406 | }) |
test/unit/comment_notifier_test.rb
| @@ -14,7 +14,7 @@ class CommentNotifierTest < ActiveSupport::TestCase | @@ -14,7 +14,7 @@ class CommentNotifierTest < ActiveSupport::TestCase | ||
| 14 | end | 14 | end |
| 15 | 15 | ||
| 16 | should 'deliver mail after make an article comment' do | 16 | should 'deliver mail after make an article comment' do |
| 17 | - assert_difference ActionMailer::Base.deliveries, :size do | 17 | + assert_difference 'ActionMailer::Base.deliveries.size' do |
| 18 | create_comment_and_notify(:author => @author, :title => 'test comment', :body => 'you suck!', :source => @article ) | 18 | create_comment_and_notify(:author => @author, :title => 'test comment', :body => 'you suck!', :source => @article ) |
| 19 | end | 19 | end |
| 20 | end | 20 | end |
| @@ -40,7 +40,7 @@ class CommentNotifierTest < ActiveSupport::TestCase | @@ -40,7 +40,7 @@ class CommentNotifierTest < ActiveSupport::TestCase | ||
| 40 | 40 | ||
| 41 | should 'not deliver mail if notify comments is false' do | 41 | should 'not deliver mail if notify comments is false' do |
| 42 | @article.update_attribute(:notify_comments, false) | 42 | @article.update_attribute(:notify_comments, false) |
| 43 | - assert_no_difference ActionMailer::Base.deliveries, :size do | 43 | + assert_no_difference 'ActionMailer::Base.deliveries.size' do |
| 44 | create_comment_and_notify(:author => @author, :title => 'test comment', :body => 'you suck!', :source => @article) | 44 | create_comment_and_notify(:author => @author, :title => 'test comment', :body => 'you suck!', :source => @article) |
| 45 | end | 45 | end |
| 46 | end | 46 | end |
| @@ -61,7 +61,7 @@ class CommentNotifierTest < ActiveSupport::TestCase | @@ -61,7 +61,7 @@ class CommentNotifierTest < ActiveSupport::TestCase | ||
| 61 | community = fast_create(Community) | 61 | community = fast_create(Community) |
| 62 | assert_equal [], community.notification_emails | 62 | assert_equal [], community.notification_emails |
| 63 | article = fast_create(Article, :name => 'Article test', :profile_id => community.id, :notify_comments => true) | 63 | article = fast_create(Article, :name => 'Article test', :profile_id => community.id, :notify_comments => true) |
| 64 | - assert_no_difference ActionMailer::Base.deliveries, :size do | 64 | + assert_no_difference 'ActionMailer::Base.deliveries.size' do |
| 65 | create_comment_and_notify(:author => @author, :title => 'test comment', :body => 'there is no addresses to send notification', :source => article) | 65 | create_comment_and_notify(:author => @author, :title => 'test comment', :body => 'there is no addresses to send notification', :source => article) |
| 66 | end | 66 | end |
| 67 | end | 67 | end |
test/unit/community_test.rb
| @@ -170,11 +170,11 @@ class CommunityTest < ActiveSupport::TestCase | @@ -170,11 +170,11 @@ class CommunityTest < ActiveSupport::TestCase | ||
| 170 | env.enable('admin_must_approve_new_communities') | 170 | env.enable('admin_must_approve_new_communities') |
| 171 | person.stubs(:notification_emails).returns(['sample@example.org']) | 171 | person.stubs(:notification_emails).returns(['sample@example.org']) |
| 172 | 172 | ||
| 173 | - assert_difference CreateCommunity, :count do | 173 | + assert_difference 'CreateCommunity.count' do |
| 174 | Community.create_after_moderation(person, {:environment => env, :name => 'Example'}) | 174 | Community.create_after_moderation(person, {:environment => env, :name => 'Example'}) |
| 175 | end | 175 | end |
| 176 | 176 | ||
| 177 | - assert_no_difference Community, :count do | 177 | + assert_no_difference 'Community.count' do |
| 178 | Community.create_after_moderation(person, {:environment => env, :name => 'Example'}) | 178 | Community.create_after_moderation(person, {:environment => env, :name => 'Example'}) |
| 179 | end | 179 | end |
| 180 | end | 180 | end |
| @@ -183,11 +183,11 @@ class CommunityTest < ActiveSupport::TestCase | @@ -183,11 +183,11 @@ class CommunityTest < ActiveSupport::TestCase | ||
| 183 | env = Environment.default | 183 | env = Environment.default |
| 184 | env.disable('admin_must_approve_new_communities') | 184 | env.disable('admin_must_approve_new_communities') |
| 185 | 185 | ||
| 186 | - assert_difference Community, :count do | 186 | + assert_difference 'Community.count' do |
| 187 | Community.create_after_moderation(person, {:environment => env, :name => 'Example 1'}) | 187 | Community.create_after_moderation(person, {:environment => env, :name => 'Example 1'}) |
| 188 | end | 188 | end |
| 189 | 189 | ||
| 190 | - assert_no_difference CreateCommunity, :count do | 190 | + assert_no_difference 'CreateCommunity.count' do |
| 191 | Community.create_after_moderation(person, {:environment => env, :name => 'Example 2'}) | 191 | Community.create_after_moderation(person, {:environment => env, :name => 'Example 2'}) |
| 192 | end | 192 | end |
| 193 | end | 193 | end |
| @@ -197,7 +197,7 @@ class CommunityTest < ActiveSupport::TestCase | @@ -197,7 +197,7 @@ class CommunityTest < ActiveSupport::TestCase | ||
| 197 | community.closed = true | 197 | community.closed = true |
| 198 | community.save | 198 | community.save |
| 199 | 199 | ||
| 200 | - assert_no_difference AddMember, :count do | 200 | + assert_no_difference 'AddMember.count' do |
| 201 | community.add_member(person) | 201 | community.add_member(person) |
| 202 | end | 202 | end |
| 203 | assert person.is_member_of?(community) | 203 | assert person.is_member_of?(community) |
| @@ -206,7 +206,7 @@ class CommunityTest < ActiveSupport::TestCase | @@ -206,7 +206,7 @@ class CommunityTest < ActiveSupport::TestCase | ||
| 206 | should 'set as member without task if organization is not closed and has no members' do | 206 | should 'set as member without task if organization is not closed and has no members' do |
| 207 | community = fast_create(Community) | 207 | community = fast_create(Community) |
| 208 | 208 | ||
| 209 | - assert_no_difference AddMember, :count do | 209 | + assert_no_difference 'AddMember.count' do |
| 210 | community.add_member(person) | 210 | community.add_member(person) |
| 211 | end | 211 | end |
| 212 | assert person.is_member_of?(community) | 212 | assert person.is_member_of?(community) |
| @@ -221,11 +221,11 @@ class CommunityTest < ActiveSupport::TestCase | @@ -221,11 +221,11 @@ class CommunityTest < ActiveSupport::TestCase | ||
| 221 | 221 | ||
| 222 | community.stubs(:notification_emails).returns(['sample@example.org']) | 222 | community.stubs(:notification_emails).returns(['sample@example.org']) |
| 223 | 223 | ||
| 224 | - assert_difference AddMember, :count do | 224 | + assert_difference 'AddMember.count' do |
| 225 | community.add_member(person) | 225 | community.add_member(person) |
| 226 | end | 226 | end |
| 227 | 227 | ||
| 228 | - assert_no_difference AddMember, :count do | 228 | + assert_no_difference 'AddMember.count' do |
| 229 | community.add_member(person) | 229 | community.add_member(person) |
| 230 | end | 230 | end |
| 231 | end | 231 | end |
| @@ -271,7 +271,7 @@ class CommunityTest < ActiveSupport::TestCase | @@ -271,7 +271,7 @@ class CommunityTest < ActiveSupport::TestCase | ||
| 271 | 271 | ||
| 272 | RoleAssignment.delete_all | 272 | RoleAssignment.delete_all |
| 273 | ActionTrackerNotification.delete_all | 273 | ActionTrackerNotification.delete_all |
| 274 | - assert_difference(ActionTrackerNotification, :count, 5) do | 274 | + assert_difference 'ActionTrackerNotification.count', 5 do |
| 275 | community.add_member(p1) | 275 | community.add_member(p1) |
| 276 | process_delayed_job_queue | 276 | process_delayed_job_queue |
| 277 | community.add_member(p3) | 277 | community.add_member(p3) |
| @@ -364,7 +364,7 @@ class CommunityTest < ActiveSupport::TestCase | @@ -364,7 +364,7 @@ class CommunityTest < ActiveSupport::TestCase | ||
| 364 | community = fast_create(Community) | 364 | community = fast_create(Community) |
| 365 | 365 | ||
| 366 | UserStampSweeper.any_instance.expects(:current_user).returns(person).at_least_once | 366 | UserStampSweeper.any_instance.expects(:current_user).returns(person).at_least_once |
| 367 | - assert_difference ActionTracker::Record, :count, 1 do | 367 | + assert_difference 'ActionTracker::Record.count', 1 do |
| 368 | article = create(TinyMceArticle, :profile => community, :name => 'An article about free software') | 368 | article = create(TinyMceArticle, :profile => community, :name => 'An article about free software') |
| 369 | end | 369 | end |
| 370 | 370 |
test/unit/create_community_test.rb
| @@ -34,7 +34,7 @@ class CreateCommunityTest < ActiveSupport::TestCase | @@ -34,7 +34,7 @@ class CreateCommunityTest < ActiveSupport::TestCase | ||
| 34 | :target => Environment.default, | 34 | :target => Environment.default, |
| 35 | }) | 35 | }) |
| 36 | 36 | ||
| 37 | - assert_difference Community, :count do | 37 | + assert_difference 'Community.count' do |
| 38 | task.finish | 38 | task.finish |
| 39 | end | 39 | end |
| 40 | 40 | ||
| @@ -76,7 +76,7 @@ class CreateCommunityTest < ActiveSupport::TestCase | @@ -76,7 +76,7 @@ class CreateCommunityTest < ActiveSupport::TestCase | ||
| 76 | }) | 76 | }) |
| 77 | 77 | ||
| 78 | assert_equal 'rails.png', task.image.filename | 78 | assert_equal 'rails.png', task.image.filename |
| 79 | - assert_difference Community, :count do | 79 | + assert_difference 'Community.count' do |
| 80 | task.finish | 80 | task.finish |
| 81 | end | 81 | end |
| 82 | 82 |
test/unit/enterprise_test.rb
| @@ -66,7 +66,7 @@ class EnterpriseTest < ActiveSupport::TestCase | @@ -66,7 +66,7 @@ class EnterpriseTest < ActiveSupport::TestCase | ||
| 66 | create(Product, :enterprise => e, :name => 'One product', :product_category => @product_category) | 66 | create(Product, :enterprise => e, :name => 'One product', :product_category => @product_category) |
| 67 | create(Product, :enterprise => e, :name => 'Another product', :product_category => @product_category) | 67 | create(Product, :enterprise => e, :name => 'Another product', :product_category => @product_category) |
| 68 | 68 | ||
| 69 | - assert_difference Product, :count, -2 do | 69 | + assert_difference 'Product.count', -2 do |
| 70 | e.destroy | 70 | e.destroy |
| 71 | end | 71 | end |
| 72 | end | 72 | end |
| @@ -215,7 +215,7 @@ class EnterpriseTest < ActiveSupport::TestCase | @@ -215,7 +215,7 @@ class EnterpriseTest < ActiveSupport::TestCase | ||
| 215 | end | 215 | end |
| 216 | 216 | ||
| 217 | should 'not create activation task when enabled = true' do | 217 | should 'not create activation task when enabled = true' do |
| 218 | - assert_no_difference EnterpriseActivation, :count do | 218 | + assert_no_difference 'EnterpriseActivation.count' do |
| 219 | fast_create(Enterprise, :name => 'test enteprise', :identifier => 'test_ent', :enabled => true) | 219 | fast_create(Enterprise, :name => 'test enteprise', :identifier => 'test_ent', :enabled => true) |
| 220 | end | 220 | end |
| 221 | end | 221 | end |
test/unit/environment_mailing_test.rb
| @@ -61,7 +61,7 @@ class EnvironmentMailingTest < ActiveSupport::TestCase | @@ -61,7 +61,7 @@ class EnvironmentMailingTest < ActiveSupport::TestCase | ||
| 61 | 61 | ||
| 62 | should 'create mailing sent to each recipient after delivering mailing' do | 62 | should 'create mailing sent to each recipient after delivering mailing' do |
| 63 | mailing = create_mailing(environment, :person => person_1) | 63 | mailing = create_mailing(environment, :person => person_1) |
| 64 | - assert_difference MailingSent, :count, 2 do | 64 | + assert_difference 'MailingSent.count', 2 do |
| 65 | process_delayed_job_queue | 65 | process_delayed_job_queue |
| 66 | end | 66 | end |
| 67 | end | 67 | end |
test/unit/image_test.rb
| @@ -92,7 +92,7 @@ class ImageTest < ActiveSupport::TestCase | @@ -92,7 +92,7 @@ class ImageTest < ActiveSupport::TestCase | ||
| 92 | should 'not create a background job for an image that is not thumbnailable' do | 92 | should 'not create a background job for an image that is not thumbnailable' do |
| 93 | # this test verifies whether it created background jobs also for the | 93 | # this test verifies whether it created background jobs also for the |
| 94 | # thumbnails! | 94 | # thumbnails! |
| 95 | - assert_no_difference Delayed::Job, :count do | 95 | + assert_no_difference 'Delayed::Job.count' do |
| 96 | image = build(Image, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | 96 | image = build(Image, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) |
| 97 | image.stubs(:thumbnailable?).returns(false) | 97 | image.stubs(:thumbnailable?).returns(false) |
| 98 | image.save! | 98 | image.save! |
test/unit/invitation_test.rb
| @@ -45,7 +45,7 @@ class InvitationTest < ActiveSupport::TestCase | @@ -45,7 +45,7 @@ class InvitationTest < ActiveSupport::TestCase | ||
| 45 | person = fast_create(Person) | 45 | person = fast_create(Person) |
| 46 | person.user = User.new(:email => 'current_user@email.invalid') | 46 | person.user = User.new(:email => 'current_user@email.invalid') |
| 47 | 47 | ||
| 48 | - assert_difference InviteFriend, :count do | 48 | + assert_difference 'InviteFriend.count' do |
| 49 | Invitation.invite(person, ['sadam@garotos.podres'], 'hello friend <url>', person) | 49 | Invitation.invite(person, ['sadam@garotos.podres'], 'hello friend <url>', person) |
| 50 | end | 50 | end |
| 51 | end | 51 | end |
| @@ -55,7 +55,7 @@ class InvitationTest < ActiveSupport::TestCase | @@ -55,7 +55,7 @@ class InvitationTest < ActiveSupport::TestCase | ||
| 55 | person.user = User.new(:email => 'current_user@email.invalid') | 55 | person.user = User.new(:email => 'current_user@email.invalid') |
| 56 | community = fast_create(Community) | 56 | community = fast_create(Community) |
| 57 | 57 | ||
| 58 | - assert_difference InviteMember, :count do | 58 | + assert_difference 'InviteMember.count' do |
| 59 | Invitation.invite(person, ['sadam@garotos.podres'], 'hello friend <url>', community) | 59 | Invitation.invite(person, ['sadam@garotos.podres'], 'hello friend <url>', community) |
| 60 | end | 60 | end |
| 61 | end | 61 | end |
test/unit/invite_friend_test.rb
| @@ -12,7 +12,7 @@ class InviteFriendTest < ActiveSupport::TestCase | @@ -12,7 +12,7 @@ class InviteFriendTest < ActiveSupport::TestCase | ||
| 12 | 12 | ||
| 13 | task = InviteFriend.create!(:person => p1, :friend => p2) | 13 | task = InviteFriend.create!(:person => p1, :friend => p2) |
| 14 | 14 | ||
| 15 | - assert_difference Friendship, :count, 2 do | 15 | + assert_difference 'Friendship.count', 2 do |
| 16 | task.finish | 16 | task.finish |
| 17 | end | 17 | end |
| 18 | 18 |
test/unit/mailing_job_test.rb
| @@ -10,7 +10,7 @@ class MailingJobTest < ActiveSupport::TestCase | @@ -10,7 +10,7 @@ class MailingJobTest < ActiveSupport::TestCase | ||
| 10 | attr_reader :environment | 10 | attr_reader :environment |
| 11 | 11 | ||
| 12 | should 'create delayed job' do | 12 | should 'create delayed job' do |
| 13 | - assert_difference Delayed::Job, :count, 1 do | 13 | + assert_difference 'Delayed::Job.count', 1 do |
| 14 | mailing = @environment.mailings.build(:subject => 'Hello', :body => 'We have some news') | 14 | mailing = @environment.mailings.build(:subject => 'Hello', :body => 'We have some news') |
| 15 | mailing.person = @person_1 | 15 | mailing.person = @person_1 |
| 16 | mailing.save! | 16 | mailing.save! |
test/unit/organization_mailing_test.rb
| @@ -74,7 +74,7 @@ class OrganizationMailingTest < ActiveSupport::TestCase | @@ -74,7 +74,7 @@ class OrganizationMailingTest < ActiveSupport::TestCase | ||
| 74 | 74 | ||
| 75 | should 'create mailing sent to each recipient after delivering mailing' do | 75 | should 'create mailing sent to each recipient after delivering mailing' do |
| 76 | mailing = create(OrganizationMailing, :source => community, :subject => 'Hello', :body => 'We have some news', :person => person) | 76 | mailing = create(OrganizationMailing, :source => community, :subject => 'Hello', :body => 'We have some news', :person => person) |
| 77 | - assert_difference MailingSent, :count, 2 do | 77 | + assert_difference 'MailingSent.count', 2 do |
| 78 | process_delayed_job_queue | 78 | process_delayed_job_queue |
| 79 | end | 79 | end |
| 80 | end | 80 | end |
test/unit/person_test.rb
| @@ -260,7 +260,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -260,7 +260,7 @@ class PersonTest < ActiveSupport::TestCase | ||
| 260 | p2 = create_user('testuser2').person | 260 | p2 = create_user('testuser2').person |
| 261 | p1.add_friend(p2, 'friends') | 261 | p1.add_friend(p2, 'friends') |
| 262 | 262 | ||
| 263 | - assert_difference Friendship, :count, -1 do | 263 | + assert_difference 'Friendship.count', -1 do |
| 264 | p1.remove_friend(p2) | 264 | p1.remove_friend(p2) |
| 265 | end | 265 | end |
| 266 | assert_not_includes p1.friends(true), p2 | 266 | assert_not_includes p1.friends(true), p2 |
| @@ -272,7 +272,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -272,7 +272,7 @@ class PersonTest < ActiveSupport::TestCase | ||
| 272 | p1.add_friend(p2, 'friends') | 272 | p1.add_friend(p2, 'friends') |
| 273 | p2.add_friend(p1, 'friends') | 273 | p2.add_friend(p1, 'friends') |
| 274 | 274 | ||
| 275 | - assert_difference Friendship, :count, -2 do | 275 | + assert_difference 'Friendship.count', -2 do |
| 276 | p1.destroy | 276 | p1.destroy |
| 277 | end | 277 | end |
| 278 | assert_not_includes p2.friends(true), p1 | 278 | assert_not_includes p2.friends(true), p1 |
| @@ -280,7 +280,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -280,7 +280,7 @@ class PersonTest < ActiveSupport::TestCase | ||
| 280 | 280 | ||
| 281 | should 'destroy use when person is destroyed' do | 281 | should 'destroy use when person is destroyed' do |
| 282 | person = create_user('testuser').person | 282 | person = create_user('testuser').person |
| 283 | - assert_difference User, :count, -1 do | 283 | + assert_difference 'User.count', -1 do |
| 284 | person.destroy | 284 | person.destroy |
| 285 | end | 285 | end |
| 286 | end | 286 | end |
| @@ -374,7 +374,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -374,7 +374,7 @@ class PersonTest < ActiveSupport::TestCase | ||
| 374 | should 'destroy all task that it requested when destroyed' do | 374 | should 'destroy all task that it requested when destroyed' do |
| 375 | p = create_user('test_profile').person | 375 | p = create_user('test_profile').person |
| 376 | 376 | ||
| 377 | - assert_no_difference Task, :count do | 377 | + assert_no_difference 'Task.count' do |
| 378 | create(Task, :requestor => p) | 378 | create(Task, :requestor => p) |
| 379 | p.destroy | 379 | p.destroy |
| 380 | end | 380 | end |
| @@ -835,7 +835,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -835,7 +835,7 @@ class PersonTest < ActiveSupport::TestCase | ||
| 835 | action_tracker = fast_create(ActionTracker::Record, :user_id => p1.id) | 835 | action_tracker = fast_create(ActionTracker::Record, :user_id => p1.id) |
| 836 | ActionTrackerNotification.delete_all | 836 | ActionTrackerNotification.delete_all |
| 837 | Delayed::Job.destroy_all | 837 | Delayed::Job.destroy_all |
| 838 | - assert_difference ActionTrackerNotification, :count, 3 do | 838 | + assert_difference 'ActionTrackerNotification.count', 3 do |
| 839 | Person.notify_activity(action_tracker) | 839 | Person.notify_activity(action_tracker) |
| 840 | process_delayed_job_queue | 840 | process_delayed_job_queue |
| 841 | end | 841 | end |
| @@ -858,7 +858,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -858,7 +858,7 @@ class PersonTest < ActiveSupport::TestCase | ||
| 858 | 858 | ||
| 859 | action_tracker = fast_create(ActionTracker::Record) | 859 | action_tracker = fast_create(ActionTracker::Record) |
| 860 | 860 | ||
| 861 | - assert_difference(Delayed::Job, :count, 1) do | 861 | + assert_difference 'Delayed::Job.count', 1 do |
| 862 | Person.notify_activity(action_tracker) | 862 | Person.notify_activity(action_tracker) |
| 863 | end | 863 | end |
| 864 | end | 864 | end |
| @@ -878,10 +878,10 @@ class PersonTest < ActiveSupport::TestCase | @@ -878,10 +878,10 @@ class PersonTest < ActiveSupport::TestCase | ||
| 878 | action_tracker = fast_create(ActionTracker::Record, :user_id => p1.id) | 878 | action_tracker = fast_create(ActionTracker::Record, :user_id => p1.id) |
| 879 | 879 | ||
| 880 | Delayed::Job.delete_all | 880 | Delayed::Job.delete_all |
| 881 | - assert_difference(Delayed::Job, :count, 1) do | 881 | + assert_difference 'Delayed::Job.count', 1 do |
| 882 | Person.notify_activity(action_tracker) | 882 | Person.notify_activity(action_tracker) |
| 883 | end | 883 | end |
| 884 | - assert_difference(ActionTrackerNotification, :count, 3) do | 884 | + assert_difference 'ActionTrackerNotification.count', 3 do |
| 885 | process_delayed_job_queue | 885 | process_delayed_job_queue |
| 886 | end | 886 | end |
| 887 | end | 887 | end |
| @@ -904,7 +904,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -904,7 +904,7 @@ class PersonTest < ActiveSupport::TestCase | ||
| 904 | action_tracker.target = community | 904 | action_tracker.target = community |
| 905 | action_tracker.save! | 905 | action_tracker.save! |
| 906 | ActionTrackerNotification.delete_all | 906 | ActionTrackerNotification.delete_all |
| 907 | - assert_difference(ActionTrackerNotification, :count, 3) do | 907 | + assert_difference 'ActionTrackerNotification.count', 3 do |
| 908 | Person.notify_activity(action_tracker) | 908 | Person.notify_activity(action_tracker) |
| 909 | process_delayed_job_queue | 909 | process_delayed_job_queue |
| 910 | end | 910 | end |
| @@ -937,7 +937,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -937,7 +937,7 @@ class PersonTest < ActiveSupport::TestCase | ||
| 937 | article.stubs(:profile).returns(community) | 937 | article.stubs(:profile).returns(community) |
| 938 | ActionTrackerNotification.delete_all | 938 | ActionTrackerNotification.delete_all |
| 939 | 939 | ||
| 940 | - assert_difference(Delayed::Job, :count, 1) do | 940 | + assert_difference 'Delayed::Job.count', 1 do |
| 941 | Person.notify_activity(action_tracker) | 941 | Person.notify_activity(action_tracker) |
| 942 | end | 942 | end |
| 943 | ActionTrackerNotification.all.map{|a|a.profile}.map do |profile| | 943 | ActionTrackerNotification.all.map{|a|a.profile}.map do |profile| |
| @@ -1186,12 +1186,12 @@ class PersonTest < ActiveSupport::TestCase | @@ -1186,12 +1186,12 @@ class PersonTest < ActiveSupport::TestCase | ||
| 1186 | profile = fast_create(Profile) | 1186 | profile = fast_create(Profile) |
| 1187 | 1187 | ||
| 1188 | abuse_report1 = build(AbuseReport, :reason => 'some reason') | 1188 | abuse_report1 = build(AbuseReport, :reason => 'some reason') |
| 1189 | - assert_difference AbuseComplaint, :count, 1 do | 1189 | + assert_difference 'AbuseComplaint.count', 1 do |
| 1190 | p1.register_report(abuse_report1, profile) | 1190 | p1.register_report(abuse_report1, profile) |
| 1191 | end | 1191 | end |
| 1192 | 1192 | ||
| 1193 | abuse_report2 = build(AbuseReport, :reason => 'some reason') | 1193 | abuse_report2 = build(AbuseReport, :reason => 'some reason') |
| 1194 | - assert_no_difference AbuseComplaint, :count do | 1194 | + assert_no_difference 'AbuseComplaint.count' do |
| 1195 | p2.register_report(abuse_report2, profile) | 1195 | p2.register_report(abuse_report2, profile) |
| 1196 | end | 1196 | end |
| 1197 | 1197 |
test/unit/product_test.rb
| @@ -24,7 +24,7 @@ class ProductTest < ActiveSupport::TestCase | @@ -24,7 +24,7 @@ class ProductTest < ActiveSupport::TestCase | ||
| 24 | end | 24 | end |
| 25 | 25 | ||
| 26 | should 'create product' do | 26 | should 'create product' do |
| 27 | - assert_difference Product, :count do | 27 | + assert_difference 'Product.count' do |
| 28 | p = build(Product, :name => 'test product1', :product_category => @product_category, :enterprise_id => @profile.id) | 28 | p = build(Product, :name => 'test product1', :product_category => @product_category, :enterprise_id => @profile.id) |
| 29 | assert p.save | 29 | assert p.save |
| 30 | end | 30 | end |
| @@ -32,7 +32,7 @@ class ProductTest < ActiveSupport::TestCase | @@ -32,7 +32,7 @@ class ProductTest < ActiveSupport::TestCase | ||
| 32 | 32 | ||
| 33 | should 'destroy product' do | 33 | should 'destroy product' do |
| 34 | p = fast_create(Product, :name => 'test product2', :product_category_id => @product_category.id) | 34 | p = fast_create(Product, :name => 'test product2', :product_category_id => @product_category.id) |
| 35 | - assert_difference Product, :count, -1 do | 35 | + assert_difference 'Product.count', -1 do |
| 36 | p.destroy | 36 | p.destroy |
| 37 | end | 37 | end |
| 38 | end | 38 | end |
| @@ -81,7 +81,7 @@ class ProductTest < ActiveSupport::TestCase | @@ -81,7 +81,7 @@ class ProductTest < ActiveSupport::TestCase | ||
| 81 | end | 81 | end |
| 82 | 82 | ||
| 83 | should 'save image on create product' do | 83 | should 'save image on create product' do |
| 84 | - assert_difference Product, :count do | 84 | + assert_difference 'Product.count' do |
| 85 | p = create(Product, :name => 'test product1', :product_category => @product_category, :image_builder => { | 85 | p = create(Product, :name => 'test product1', :product_category => @product_category, :image_builder => { |
| 86 | :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') | 86 | :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') |
| 87 | }, :enterprise_id => @profile.id) | 87 | }, :enterprise_id => @profile.id) |
| @@ -270,7 +270,7 @@ class ProductTest < ActiveSupport::TestCase | @@ -270,7 +270,7 @@ class ProductTest < ActiveSupport::TestCase | ||
| 270 | services_category = fast_create(ProductCategory, :name => 'Services') | 270 | services_category = fast_create(ProductCategory, :name => 'Services') |
| 271 | input2 = fast_create(Input, :product_id => product.id, :product_category_id => services_category.id) | 271 | input2 = fast_create(Input, :product_id => product.id, :product_category_id => services_category.id) |
| 272 | 272 | ||
| 273 | - assert_difference Input, :count, -2 do | 273 | + assert_difference 'Input.count', -2 do |
| 274 | product.destroy | 274 | product.destroy |
| 275 | end | 275 | end |
| 276 | end | 276 | end |
| @@ -402,7 +402,7 @@ class ProductTest < ActiveSupport::TestCase | @@ -402,7 +402,7 @@ class ProductTest < ActiveSupport::TestCase | ||
| 402 | cost = fast_create(ProductionCost, :owner_id => Environment.default.id, :owner_type => 'Environment') | 402 | cost = fast_create(ProductionCost, :owner_id => Environment.default.id, :owner_type => 'Environment') |
| 403 | price_detail = product.price_details.create(:production_cost_id => cost.id, :price => 10) | 403 | price_detail = product.price_details.create(:production_cost_id => cost.id, :price => 10) |
| 404 | 404 | ||
| 405 | - assert_difference PriceDetail, :count, -1 do | 405 | + assert_difference 'PriceDetail.count', -1 do |
| 406 | product.destroy | 406 | product.destroy |
| 407 | end | 407 | end |
| 408 | end | 408 | end |
test/unit/profile_categorization_test.rb
| @@ -20,7 +20,7 @@ class ProfileCategorizationTest < ActiveSupport::TestCase | @@ -20,7 +20,7 @@ class ProfileCategorizationTest < ActiveSupport::TestCase | ||
| 20 | 20 | ||
| 21 | p = create_user('testuser').person | 21 | p = create_user('testuser').person |
| 22 | 22 | ||
| 23 | - assert_difference ProfileCategorization, :count, 2 do | 23 | + assert_difference 'ProfileCategorization.count', 2 do |
| 24 | ProfileCategorization.add_category_to_profile(c2, p) | 24 | ProfileCategorization.add_category_to_profile(c2, p) |
| 25 | end | 25 | end |
| 26 | 26 | ||
| @@ -38,7 +38,7 @@ class ProfileCategorizationTest < ActiveSupport::TestCase | @@ -38,7 +38,7 @@ class ProfileCategorizationTest < ActiveSupport::TestCase | ||
| 38 | 38 | ||
| 39 | p = create_user('testuser').person | 39 | p = create_user('testuser').person |
| 40 | 40 | ||
| 41 | - assert_difference ProfileCategorization, :count, 3 do | 41 | + assert_difference 'ProfileCategorization.count', 3 do |
| 42 | ProfileCategorization.add_category_to_profile(c2, p) | 42 | ProfileCategorization.add_category_to_profile(c2, p) |
| 43 | ProfileCategorization.add_category_to_profile(c3, p) | 43 | ProfileCategorization.add_category_to_profile(c3, p) |
| 44 | end | 44 | end |
| @@ -58,7 +58,7 @@ class ProfileCategorizationTest < ActiveSupport::TestCase | @@ -58,7 +58,7 @@ class ProfileCategorizationTest < ActiveSupport::TestCase | ||
| 58 | ProfileCategorization.add_category_to_profile(c2, p) | 58 | ProfileCategorization.add_category_to_profile(c2, p) |
| 59 | ProfileCategorization.add_category_to_profile(c3, p) | 59 | ProfileCategorization.add_category_to_profile(c3, p) |
| 60 | 60 | ||
| 61 | - assert_difference ProfileCategorization, :count, -3 do | 61 | + assert_difference 'ProfileCategorization.count', -3 do |
| 62 | ProfileCategorization.remove_all_for(p) | 62 | ProfileCategorization.remove_all_for(p) |
| 63 | end | 63 | end |
| 64 | end | 64 | end |
test/unit/profile_test.rb
| @@ -1134,7 +1134,7 @@ class ProfileTest < ActiveSupport::TestCase | @@ -1134,7 +1134,7 @@ class ProfileTest < ActiveSupport::TestCase | ||
| 1134 | should 'destroy tasks requested to it when destroyed' do | 1134 | should 'destroy tasks requested to it when destroyed' do |
| 1135 | p = Profile.create!(:name => 'test_profile', :identifier => 'test_profile') | 1135 | p = Profile.create!(:name => 'test_profile', :identifier => 'test_profile') |
| 1136 | 1136 | ||
| 1137 | - assert_no_difference Task, :count do | 1137 | + assert_no_difference 'Task.count' do |
| 1138 | Task.create(:target => p) | 1138 | Task.create(:target => p) |
| 1139 | p.destroy | 1139 | p.destroy |
| 1140 | end | 1140 | end |
test/unit/scrap_notifier_test.rb
| @@ -13,14 +13,14 @@ class ScrapNotifierTest < ActiveSupport::TestCase | @@ -13,14 +13,14 @@ class ScrapNotifierTest < ActiveSupport::TestCase | ||
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | should 'deliver mail after leave scrap' do | 15 | should 'deliver mail after leave scrap' do |
| 16 | - assert_difference ActionMailer::Base.deliveries, :size do | 16 | + assert_difference 'ActionMailer::Base.deliveries.size' do |
| 17 | Scrap.create!(:sender_id => @sender.id, :receiver_id => @receiver.id, :content => 'Hi man!') | 17 | Scrap.create!(:sender_id => @sender.id, :receiver_id => @receiver.id, :content => 'Hi man!') |
| 18 | end | 18 | end |
| 19 | end | 19 | end |
| 20 | 20 | ||
| 21 | should 'deliver mail even if it is a reply' do | 21 | should 'deliver mail even if it is a reply' do |
| 22 | s = Scrap.create!(:sender_id => @sender.id, :receiver_id => @receiver.id, :content => 'Hi man!') | 22 | s = Scrap.create!(:sender_id => @sender.id, :receiver_id => @receiver.id, :content => 'Hi man!') |
| 23 | - assert_difference ActionMailer::Base.deliveries, :size do | 23 | + assert_difference 'ActionMailer::Base.deliveries.size' do |
| 24 | s.replies << Scrap.new(:sender_id => @sender.id, :receiver_id => @receiver.id, :content => 'Hi again man!') | 24 | s.replies << Scrap.new(:sender_id => @sender.id, :receiver_id => @receiver.id, :content => 'Hi again man!') |
| 25 | end | 25 | end |
| 26 | end | 26 | end |
| @@ -50,7 +50,7 @@ class ScrapNotifierTest < ActiveSupport::TestCase | @@ -50,7 +50,7 @@ class ScrapNotifierTest < ActiveSupport::TestCase | ||
| 50 | end | 50 | end |
| 51 | 51 | ||
| 52 | should 'not deliver mail if notify receiver and sender are the same person' do | 52 | should 'not deliver mail if notify receiver and sender are the same person' do |
| 53 | - assert_no_difference ActionMailer::Base.deliveries, :size do | 53 | + assert_no_difference 'ActionMailer::Base.deliveries.size' do |
| 54 | Scrap.create!(:sender_id => @sender.id, :receiver_id => @sender.id, :content => 'Hi myself!') | 54 | Scrap.create!(:sender_id => @sender.id, :receiver_id => @sender.id, :content => 'Hi myself!') |
| 55 | end | 55 | end |
| 56 | end | 56 | end |
| @@ -59,7 +59,7 @@ class ScrapNotifierTest < ActiveSupport::TestCase | @@ -59,7 +59,7 @@ class ScrapNotifierTest < ActiveSupport::TestCase | ||
| 59 | community = fast_create(Community) | 59 | community = fast_create(Community) |
| 60 | person = fast_create(Person) | 60 | person = fast_create(Person) |
| 61 | scrap = fast_create(Scrap, :receiver_id => community.id, :sender_id => @sender.id) | 61 | scrap = fast_create(Scrap, :receiver_id => community.id, :sender_id => @sender.id) |
| 62 | - assert_no_difference ActionMailer::Base.deliveries, :size do | 62 | + assert_no_difference 'ActionMailer::Base.deliveries.size' do |
| 63 | Scrap.create!(:sender_id => person, :receiver_id => @sender.id, :scrap_id => scrap.id, :content => 'Hi myself!') | 63 | Scrap.create!(:sender_id => person, :receiver_id => @sender.id, :scrap_id => scrap.id, :content => 'Hi myself!') |
| 64 | end | 64 | end |
| 65 | end | 65 | end |
test/unit/scrap_test.rb
| @@ -288,7 +288,7 @@ class ScrapTest < ActiveSupport::TestCase | @@ -288,7 +288,7 @@ class ScrapTest < ActiveSupport::TestCase | ||
| 288 | should 'create activity with reply_scrap_on_self when top_root scrap receiver is the same as sender' do | 288 | should 'create activity with reply_scrap_on_self when top_root scrap receiver is the same as sender' do |
| 289 | s, r = fast_create(Person), fast_create(Person) | 289 | s, r = fast_create(Person), fast_create(Person) |
| 290 | root = fast_create(Scrap, :sender_id => s.id, :receiver_id => r.id) | 290 | root = fast_create(Scrap, :sender_id => s.id, :receiver_id => r.id) |
| 291 | - assert_difference ActionTracker::Record, :count, 1 do | 291 | + assert_difference 'ActionTracker::Record.count', 1 do |
| 292 | reply = create(Scrap, :sender => r, :receiver => s, :scrap_id => root.id, :content => 'sample') | 292 | reply = create(Scrap, :sender => r, :receiver => s, :scrap_id => root.id, :content => 'sample') |
| 293 | end | 293 | end |
| 294 | activity = ActionTracker::Record.last | 294 | activity = ActionTracker::Record.last |
test/unit/task_test.rb
| @@ -202,7 +202,7 @@ class TaskTest < ActiveSupport::TestCase | @@ -202,7 +202,7 @@ class TaskTest < ActiveSupport::TestCase | ||
| 202 | 202 | ||
| 203 | should 'be destroyed when requestor destroyed' do | 203 | should 'be destroyed when requestor destroyed' do |
| 204 | user = create_user('test_user').person | 204 | user = create_user('test_user').person |
| 205 | - assert_no_difference Task, :count do | 205 | + assert_no_difference 'Task.count' do |
| 206 | create(Task, :requestor => user) | 206 | create(Task, :requestor => user) |
| 207 | user.destroy | 207 | user.destroy |
| 208 | end | 208 | end |
test/unit/textile_article_test.rb
| @@ -41,7 +41,7 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -41,7 +41,7 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
| 41 | 41 | ||
| 42 | should 'not group trackers activity of article\'s creation' do | 42 | should 'not group trackers activity of article\'s creation' do |
| 43 | profile = fast_create(Profile) | 43 | profile = fast_create(Profile) |
| 44 | - assert_difference ActionTracker::Record, :count, 3 do | 44 | + assert_difference 'ActionTracker::Record.count', 3 do |
| 45 | create TextileArticle, :name => 'bar', :profile_id => profile.id, :published => true | 45 | create TextileArticle, :name => 'bar', :profile_id => profile.id, :published => true |
| 46 | create TextileArticle, :name => 'another bar', :profile_id => profile.id, :published => true | 46 | create TextileArticle, :name => 'another bar', :profile_id => profile.id, :published => true |
| 47 | create TextileArticle, :name => 'another bar', :profile_id => fast_create(Profile).id, :published => true | 47 | create TextileArticle, :name => 'another bar', :profile_id => fast_create(Profile).id, :published => true |
| @@ -54,7 +54,7 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -54,7 +54,7 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
| 54 | article = create(TextileArticle, :profile_id => profile.id) | 54 | article = create(TextileArticle, :profile_id => profile.id) |
| 55 | time = article.activity.updated_at | 55 | time = article.activity.updated_at |
| 56 | Time.stubs(:now).returns(time + 1.day) | 56 | Time.stubs(:now).returns(time + 1.day) |
| 57 | - assert_no_difference ActionTracker::Record, :count do | 57 | + assert_no_difference 'ActionTracker::Record.count' do |
| 58 | article.name = 'foo' | 58 | article.name = 'foo' |
| 59 | article.save! | 59 | article.save! |
| 60 | end | 60 | end |
| @@ -65,7 +65,7 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -65,7 +65,7 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
| 65 | ActionTracker::Record.delete_all | 65 | ActionTracker::Record.delete_all |
| 66 | a1 = create TextileArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true | 66 | a1 = create TextileArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true |
| 67 | a2 = create TextileArticle, :name => 'another bar', :profile_id => fast_create(Profile).id, :published => true | 67 | a2 = create TextileArticle, :name => 'another bar', :profile_id => fast_create(Profile).id, :published => true |
| 68 | - assert_no_difference ActionTracker::Record, :count do | 68 | + assert_no_difference 'ActionTracker::Record.count' do |
| 69 | a1.name = 'foo';a1.save! | 69 | a1.name = 'foo';a1.save! |
| 70 | a2.name = 'another foo';a2.save! | 70 | a2.name = 'another foo';a2.save! |
| 71 | end | 71 | end |
| @@ -74,7 +74,7 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -74,7 +74,7 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
| 74 | should 'remove activity after destroying article' do | 74 | should 'remove activity after destroying article' do |
| 75 | ActionTracker::Record.delete_all | 75 | ActionTracker::Record.delete_all |
| 76 | a = create TextileArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true | 76 | a = create TextileArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true |
| 77 | - assert_difference ActionTracker::Record, :count, -1 do | 77 | + assert_difference 'ActionTracker::Record.count', -1 do |
| 78 | a.destroy | 78 | a.destroy |
| 79 | end | 79 | end |
| 80 | end | 80 | end |
| @@ -84,7 +84,7 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -84,7 +84,7 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
| 84 | a1 = create TextileArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true | 84 | a1 = create TextileArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true |
| 85 | a2 = create TextileArticle, :name => 'another bar', :profile_id => fast_create(Profile).id, :published => true | 85 | a2 = create TextileArticle, :name => 'another bar', :profile_id => fast_create(Profile).id, :published => true |
| 86 | assert_equal 2, ActionTracker::Record.count | 86 | assert_equal 2, ActionTracker::Record.count |
| 87 | - assert_difference ActionTracker::Record, :count, -2 do | 87 | + assert_difference 'ActionTracker::Record.count', -2 do |
| 88 | a1.destroy | 88 | a1.destroy |
| 89 | a2.destroy | 89 | a2.destroy |
| 90 | end | 90 | end |
test/unit/tiny_mce_article_test.rb
| @@ -145,7 +145,7 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -145,7 +145,7 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
| 145 | article = create(TinyMceArticle, :profile_id => profile.id) | 145 | article = create(TinyMceArticle, :profile_id => profile.id) |
| 146 | time = article.activity.updated_at | 146 | time = article.activity.updated_at |
| 147 | Time.stubs(:now).returns(time + 1.day) | 147 | Time.stubs(:now).returns(time + 1.day) |
| 148 | - assert_no_difference ActionTracker::Record, :count do | 148 | + assert_no_difference 'ActionTracker::Record.count' do |
| 149 | article.name = 'foo' | 149 | article.name = 'foo' |
| 150 | article.save! | 150 | article.save! |
| 151 | end | 151 | end |
| @@ -156,7 +156,7 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -156,7 +156,7 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
| 156 | ActionTracker::Record.delete_all | 156 | ActionTracker::Record.delete_all |
| 157 | a1 = create TinyMceArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true | 157 | a1 = create TinyMceArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true |
| 158 | a2 = create TinyMceArticle, :name => 'another bar', :profile_id => fast_create(Profile).id, :published => true | 158 | a2 = create TinyMceArticle, :name => 'another bar', :profile_id => fast_create(Profile).id, :published => true |
| 159 | - assert_no_difference ActionTracker::Record, :count do | 159 | + assert_no_difference 'ActionTracker::Record.count' do |
| 160 | a1.name = 'foo';a1.save! | 160 | a1.name = 'foo';a1.save! |
| 161 | a2.name = 'another foo';a2.save! | 161 | a2.name = 'another foo';a2.save! |
| 162 | end | 162 | end |
| @@ -166,7 +166,7 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -166,7 +166,7 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
| 166 | ActionTracker::Record.delete_all | 166 | ActionTracker::Record.delete_all |
| 167 | a1 = create TinyMceArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true | 167 | a1 = create TinyMceArticle, :name => 'bar', :profile_id => fast_create(Profile).id, :published => true |
| 168 | a2 = create TinyMceArticle, :name => 'another bar', :profile_id => fast_create(Profile).id, :published => true | 168 | a2 = create TinyMceArticle, :name => 'another bar', :profile_id => fast_create(Profile).id, :published => true |
| 169 | - assert_difference ActionTracker::Record, :count, -2 do | 169 | + assert_difference 'ActionTracker::Record.count', -2 do |
| 170 | a1.destroy | 170 | a1.destroy |
| 171 | a2.destroy | 171 | a2.destroy |
| 172 | end | 172 | end |
test/unit/user_activation_job_test.rb
| @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper' | @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper' | ||
| 3 | class NotifyActivityToProfilesJobTest < ActiveSupport::TestCase | 3 | class NotifyActivityToProfilesJobTest < ActiveSupport::TestCase |
| 4 | 4 | ||
| 5 | should 'create job on user creation' do | 5 | should 'create job on user creation' do |
| 6 | - assert_difference Delayed::Job, :count, 1 do | 6 | + assert_difference 'Delayed::Job.count', 1 do |
| 7 | user = new_user :login => 'test1' | 7 | user = new_user :login => 'test1' |
| 8 | assert_equal user.id, YAML.load(Delayed::Job.last.handler).user_id | 8 | assert_equal user.id, YAML.load(Delayed::Job.last.handler).user_id |
| 9 | end | 9 | end |
| @@ -13,7 +13,7 @@ class NotifyActivityToProfilesJobTest < ActiveSupport::TestCase | @@ -13,7 +13,7 @@ class NotifyActivityToProfilesJobTest < ActiveSupport::TestCase | ||
| 13 | should 'destroy user if not activated' do | 13 | should 'destroy user if not activated' do |
| 14 | user = new_user :login => 'test2' | 14 | user = new_user :login => 'test2' |
| 15 | job = UserActivationJob.new(user.id) | 15 | job = UserActivationJob.new(user.id) |
| 16 | - assert_difference User, :count, -1 do | 16 | + assert_difference 'User.count', -1 do |
| 17 | job.perform | 17 | job.perform |
| 18 | process_delayed_job_queue | 18 | process_delayed_job_queue |
| 19 | end | 19 | end |
| @@ -23,7 +23,7 @@ class NotifyActivityToProfilesJobTest < ActiveSupport::TestCase | @@ -23,7 +23,7 @@ class NotifyActivityToProfilesJobTest < ActiveSupport::TestCase | ||
| 23 | user = new_user :login => 'test3' | 23 | user = new_user :login => 'test3' |
| 24 | user.activate | 24 | user.activate |
| 25 | job = UserActivationJob.new(user.id) | 25 | job = UserActivationJob.new(user.id) |
| 26 | - assert_no_difference User, :count do | 26 | + assert_no_difference 'User.count' do |
| 27 | job.perform | 27 | job.perform |
| 28 | process_delayed_job_queue | 28 | process_delayed_job_queue |
| 29 | end | 29 | end |
test/unit/user_mailer_test.rb
| @@ -12,7 +12,7 @@ class UserMailerTest < ActiveSupport::TestCase | @@ -12,7 +12,7 @@ class UserMailerTest < ActiveSupport::TestCase | ||
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | should 'deliver activation email notify' do | 14 | should 'deliver activation email notify' do |
| 15 | - assert_difference ActionMailer::Base.deliveries, :size do | 15 | + assert_difference 'ActionMailer::Base.deliveries.size' do |
| 16 | u = create_user('some-user') | 16 | u = create_user('some-user') |
| 17 | UserMailer.activation_email_notify(u).deliver | 17 | UserMailer.activation_email_notify(u).deliver |
| 18 | end | 18 | end |
test/unit/user_test.rb
| @@ -8,35 +8,35 @@ class UserTest < ActiveSupport::TestCase | @@ -8,35 +8,35 @@ class UserTest < ActiveSupport::TestCase | ||
| 8 | fixtures :users, :environments | 8 | fixtures :users, :environments |
| 9 | 9 | ||
| 10 | def test_should_create_user | 10 | def test_should_create_user |
| 11 | - assert_difference User, :count do | 11 | + assert_difference 'User.count' do |
| 12 | user = new_user | 12 | user = new_user |
| 13 | assert !user.new_record?, "#{user.errors.full_messages.to_sentence}" | 13 | assert !user.new_record?, "#{user.errors.full_messages.to_sentence}" |
| 14 | end | 14 | end |
| 15 | end | 15 | end |
| 16 | 16 | ||
| 17 | def test_should_require_login | 17 | def test_should_require_login |
| 18 | - assert_no_difference User, :count do | 18 | + assert_no_difference 'User.count' do |
| 19 | u = new_user(:login => nil) | 19 | u = new_user(:login => nil) |
| 20 | assert u.errors[:login].present? | 20 | assert u.errors[:login].present? |
| 21 | end | 21 | end |
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | def test_should_require_password | 24 | def test_should_require_password |
| 25 | - assert_no_difference User, :count do | 25 | + assert_no_difference 'User.count' do |
| 26 | u = new_user(:password => nil) | 26 | u = new_user(:password => nil) |
| 27 | assert u.errors[:password].present? | 27 | assert u.errors[:password].present? |
| 28 | end | 28 | end |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | def test_should_require_password_confirmation | 31 | def test_should_require_password_confirmation |
| 32 | - assert_no_difference User, :count do | 32 | + assert_no_difference 'User.count' do |
| 33 | u = new_user(:password_confirmation => nil) | 33 | u = new_user(:password_confirmation => nil) |
| 34 | assert u.errors[:password_confirmation].present? | 34 | assert u.errors[:password_confirmation].present? |
| 35 | end | 35 | end |
| 36 | end | 36 | end |
| 37 | 37 | ||
| 38 | def test_should_require_email | 38 | def test_should_require_email |
| 39 | - assert_no_difference User, :count do | 39 | + assert_no_difference 'User.count' do |
| 40 | u = new_user(:email => nil) | 40 | u = new_user(:email => nil) |
| 41 | assert u.errors[:email].present? | 41 | assert u.errors[:email].present? |
| 42 | end | 42 | end |
| @@ -470,7 +470,7 @@ class UserTest < ActiveSupport::TestCase | @@ -470,7 +470,7 @@ class UserTest < ActiveSupport::TestCase | ||
| 470 | end | 470 | end |
| 471 | 471 | ||
| 472 | should 'deliver e-mail with activation code after creation' do | 472 | should 'deliver e-mail with activation code after creation' do |
| 473 | - assert_difference(ActionMailer::Base.deliveries, :size, 1) do | 473 | + assert_difference 'ActionMailer::Base.deliveries.size', 1 do |
| 474 | new_user :email => 'pending@activation.com' | 474 | new_user :email => 'pending@activation.com' |
| 475 | end | 475 | end |
| 476 | assert_equal 'pending@activation.com', ActionMailer::Base.deliveries.last['to'].to_s | 476 | assert_equal 'pending@activation.com', ActionMailer::Base.deliveries.last['to'].to_s |
| @@ -478,7 +478,7 @@ class UserTest < ActiveSupport::TestCase | @@ -478,7 +478,7 @@ class UserTest < ActiveSupport::TestCase | ||
| 478 | 478 | ||
| 479 | should 'not try to deliver email to template users' do | 479 | should 'not try to deliver email to template users' do |
| 480 | Person.any_instance.stubs(:is_template?).returns(true) | 480 | Person.any_instance.stubs(:is_template?).returns(true) |
| 481 | - assert_no_difference ActionMailer::Base.deliveries, :size do | 481 | + assert_no_difference 'ActionMailer::Base.deliveries.size' do |
| 482 | new_user | 482 | new_user |
| 483 | end | 483 | end |
| 484 | end | 484 | end |
| @@ -517,7 +517,7 @@ class UserTest < ActiveSupport::TestCase | @@ -517,7 +517,7 @@ class UserTest < ActiveSupport::TestCase | ||
| 517 | end | 517 | end |
| 518 | 518 | ||
| 519 | should 'delay activation check' do | 519 | should 'delay activation check' do |
| 520 | - assert_difference Delayed::Job, :count, 1 do | 520 | + assert_difference 'Delayed::Job.count', 1 do |
| 521 | user = new_user | 521 | user = new_user |
| 522 | end | 522 | end |
| 523 | end | 523 | end |
| @@ -568,7 +568,7 @@ class UserTest < ActiveSupport::TestCase | @@ -568,7 +568,7 @@ class UserTest < ActiveSupport::TestCase | ||
| 568 | env.save | 568 | env.save |
| 569 | 569 | ||
| 570 | user = new_user :email => 'pending@activation.com' | 570 | user = new_user :email => 'pending@activation.com' |
| 571 | - assert_no_difference(ActionMailer::Base.deliveries, :size) do | 571 | + assert_no_difference 'ActionMailer::Base.deliveries.size' do |
| 572 | user.activate | 572 | user.activate |
| 573 | end | 573 | end |
| 574 | end | 574 | end |
| @@ -583,7 +583,7 @@ class UserTest < ActiveSupport::TestCase | @@ -583,7 +583,7 @@ class UserTest < ActiveSupport::TestCase | ||
| 583 | env.save | 583 | env.save |
| 584 | 584 | ||
| 585 | user = new_user :email => 'pending@activation.com' | 585 | user = new_user :email => 'pending@activation.com' |
| 586 | - assert_difference(ActionMailer::Base.deliveries, :size, 1) do | 586 | + assert_difference 'ActionMailer::Base.deliveries.size', 1 do |
| 587 | user.activate | 587 | user.activate |
| 588 | process_delayed_job_queue | 588 | process_delayed_job_queue |
| 589 | end | 589 | end |
| @@ -603,7 +603,7 @@ class UserTest < ActiveSupport::TestCase | @@ -603,7 +603,7 @@ class UserTest < ActiveSupport::TestCase | ||
| 603 | env.save | 603 | env.save |
| 604 | 604 | ||
| 605 | user = new_user :email => 'pending@activation.com' | 605 | user = new_user :email => 'pending@activation.com' |
| 606 | - assert_difference(ActionMailer::Base.deliveries, :size, 1) do | 606 | + assert_difference 'ActionMailer::Base.deliveries.size', 1 do |
| 607 | user.activate | 607 | user.activate |
| 608 | end | 608 | end |
| 609 | 609 | ||
| @@ -621,7 +621,7 @@ class UserTest < ActiveSupport::TestCase | @@ -621,7 +621,7 @@ class UserTest < ActiveSupport::TestCase | ||
| 621 | env.save | 621 | env.save |
| 622 | 622 | ||
| 623 | user = new_user :name => 'John Doe', :email => 'pending@activation.com' | 623 | user = new_user :name => 'John Doe', :email => 'pending@activation.com' |
| 624 | - assert_difference(ActionMailer::Base.deliveries, :size, 1) do | 624 | + assert_difference 'ActionMailer::Base.deliveries.size', 1 do |
| 625 | user.activate | 625 | user.activate |
| 626 | end | 626 | end |
| 627 | 627 | ||
| @@ -638,7 +638,7 @@ class UserTest < ActiveSupport::TestCase | @@ -638,7 +638,7 @@ class UserTest < ActiveSupport::TestCase | ||
| 638 | env.save | 638 | env.save |
| 639 | 639 | ||
| 640 | user = new_user :email => 'pending@activation.com' | 640 | user = new_user :email => 'pending@activation.com' |
| 641 | - assert_no_difference(ActionMailer::Base.deliveries, :size) do | 641 | + assert_no_difference 'ActionMailer::Base.deliveries.size' do |
| 642 | user.activate | 642 | user.activate |
| 643 | end | 643 | end |
| 644 | end | 644 | end |
| @@ -649,7 +649,7 @@ class UserTest < ActiveSupport::TestCase | @@ -649,7 +649,7 @@ class UserTest < ActiveSupport::TestCase | ||
| 649 | env.save | 649 | env.save |
| 650 | 650 | ||
| 651 | user = new_user :email => 'pending@activation.com' | 651 | user = new_user :email => 'pending@activation.com' |
| 652 | - assert_no_difference(ActionMailer::Base.deliveries, :size) do | 652 | + assert_no_difference 'ActionMailer::Base.deliveries.size' do |
| 653 | user.activate | 653 | user.activate |
| 654 | end | 654 | end |
| 655 | end | 655 | end |