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