Commit dd172119ee4cd20a0f9b3d87702fb9bacff4ff3a
1 parent
e201637a
Exists in
staging
and in
42 other branches
rails3: fix controller tests
Showing
7 changed files
with
13 additions
and
13 deletions
Show diff stats
app/controllers/public/content_viewer_controller.rb
@@ -32,7 +32,7 @@ class ContentViewerController < ApplicationController | @@ -32,7 +32,7 @@ class ContentViewerController < ApplicationController | ||
32 | return render_access_denied unless @page.display_versions? | 32 | return render_access_denied unless @page.display_versions? |
33 | @versioned_article = @page.versions.find_by_version(@version) | 33 | @versioned_article = @page.versions.find_by_version(@version) |
34 | if @versioned_article && @page.versions.latest.version != @versioned_article.version | 34 | if @versioned_article && @page.versions.latest.version != @versioned_article.version |
35 | - render :template => 'content_viewer/versioned_article.rhtml' | 35 | + render :template => 'content_viewer/versioned_article.html.erb' |
36 | return | 36 | return |
37 | end | 37 | end |
38 | end | 38 | end |
app/models/article.rb
@@ -2,7 +2,7 @@ require 'hpricot' | @@ -2,7 +2,7 @@ require 'hpricot' | ||
2 | 2 | ||
3 | class Article < ActiveRecord::Base | 3 | class Article < ActiveRecord::Base |
4 | 4 | ||
5 | - attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, :allow_members_to_edit, :translation_of_id, :language, :license_id, :parent_id, :display_posts_in_current_language, :category_ids, :posts_per_page, :moderate_comments, :accept_comments, :feed, :published, :source, :highlighted, :notify_comments, :display_hits, :slug, :external_feed_builder | 5 | + attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, :allow_members_to_edit, :translation_of_id, :language, :license_id, :parent_id, :display_posts_in_current_language, :category_ids, :posts_per_page, :moderate_comments, :accept_comments, :feed, :published, :source, :highlighted, :notify_comments, :display_hits, :slug, :external_feed_builder, :display_versions |
6 | 6 | ||
7 | acts_as_having_image | 7 | acts_as_having_image |
8 | 8 |
test/functional/cms_controller_test.rb
@@ -1353,7 +1353,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1353,7 +1353,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1353 | end | 1353 | end |
1354 | 1354 | ||
1355 | should 'back to forum after config forum' do | 1355 | should 'back to forum after config forum' do |
1356 | - assert_difference Forum, :count do | 1356 | + assert_difference 'Forum.count' do |
1357 | post :new, :type => Forum.name, :profile => profile.identifier, :article => { :name => 'my-forum' }, :back_to => 'control_panel' | 1357 | post :new, :type => Forum.name, :profile => profile.identifier, :article => { :name => 'my-forum' }, :back_to => 'control_panel' |
1358 | end | 1358 | end |
1359 | post :edit, :type => Forum.name, :profile => profile.identifier, :article => { :name => 'my forum' }, :id => profile.forum.id | 1359 | post :edit, :type => Forum.name, :profile => profile.identifier, :article => { :name => 'my forum' }, :id => profile.forum.id |
@@ -1738,11 +1738,11 @@ class CmsControllerTest < ActionController::TestCase | @@ -1738,11 +1738,11 @@ class CmsControllerTest < ActionController::TestCase | ||
1738 | end | 1738 | end |
1739 | 1739 | ||
1740 | should 'remove users that agreed with forum terms after removing terms' do | 1740 | should 'remove users that agreed with forum terms after removing terms' do |
1741 | - forum = Forum.create(:name => 'Forum test', :profile_id => profile.id, :has_terms_of_use => true) | 1741 | + forum = Forum.create(:name => 'Forum test', :profile => profile, :has_terms_of_use => true) |
1742 | person = fast_create(Person) | 1742 | person = fast_create(Person) |
1743 | forum.users_with_agreement << person | 1743 | forum.users_with_agreement << person |
1744 | 1744 | ||
1745 | - assert_difference Forum.find(forum.id).users_with_agreement, :count, -1 do | 1745 | + assert_difference 'Forum.find(forum.id).users_with_agreement.count', -1 do |
1746 | post :edit, :profile => profile.identifier, :id => forum.id, :article => { :has_terms_of_use => 'false' } | 1746 | post :edit, :profile => profile.identifier, :id => forum.id, :article => { :has_terms_of_use => 'false' } |
1747 | end | 1747 | end |
1748 | end | 1748 | end |
test/functional/content_viewer_controller_test.rb
@@ -1339,14 +1339,14 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1339,14 +1339,14 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1339 | should 'add extra content on article header from plugins' do | 1339 | should 'add extra content on article header from plugins' do |
1340 | class Plugin1 < Noosfero::Plugin | 1340 | class Plugin1 < Noosfero::Plugin |
1341 | def article_header_extra_contents(args) | 1341 | def article_header_extra_contents(args) |
1342 | - lambda { | 1342 | + proc { |
1343 | content_tag('div', '', :class => 'plugin1') | 1343 | content_tag('div', '', :class => 'plugin1') |
1344 | } | 1344 | } |
1345 | end | 1345 | end |
1346 | end | 1346 | end |
1347 | class Plugin2 < Noosfero::Plugin | 1347 | class Plugin2 < Noosfero::Plugin |
1348 | def article_header_extra_contents(args) | 1348 | def article_header_extra_contents(args) |
1349 | - lambda { | 1349 | + proc { |
1350 | content_tag('div', '', :class => 'plugin2') | 1350 | content_tag('div', '', :class => 'plugin2') |
1351 | } | 1351 | } |
1352 | end | 1352 | end |
test/functional/environment_themes_controller_test.rb
@@ -91,7 +91,7 @@ class EnvironmentThemesControllerTest < ActionController::TestCase | @@ -91,7 +91,7 @@ class EnvironmentThemesControllerTest < ActionController::TestCase | ||
91 | 91 | ||
92 | LayoutTemplate.expects(:all).returns(all) | 92 | LayoutTemplate.expects(:all).returns(all) |
93 | get :index | 93 | get :index |
94 | - assert_same all, assigns(:layout_templates) | 94 | + assert_equivalent all, assigns(:layout_templates) |
95 | end | 95 | end |
96 | 96 | ||
97 | should 'display links to set template' do | 97 | should 'display links to set template' do |
@@ -109,7 +109,7 @@ class EnvironmentThemesControllerTest < ActionController::TestCase | @@ -109,7 +109,7 @@ class EnvironmentThemesControllerTest < ActionController::TestCase | ||
109 | 109 | ||
110 | should 'highlight current template' do | 110 | should 'highlight current template' do |
111 | env = Environment.default | 111 | env = Environment.default |
112 | - env.update_attributes!(:layout_template => 'default') | 112 | + env.update_attribute(:layout_template, 'default') |
113 | env.layout_template = 'default' | 113 | env.layout_template = 'default' |
114 | 114 | ||
115 | t1 = LayoutTemplate.find('default') | 115 | t1 = LayoutTemplate.find('default') |
test/functional/profile_design_controller_test.rb
@@ -737,8 +737,8 @@ class ProfileDesignControllerTest < ActionController::TestCase | @@ -737,8 +737,8 @@ class ProfileDesignControllerTest < ActionController::TestCase | ||
737 | end | 737 | end |
738 | 738 | ||
739 | should 'clone a block' do | 739 | should 'clone a block' do |
740 | - block = ProfileImageBlock.create!(:box => profile.boxes.first) | ||
741 | - assert_difference ProfileImageBlock, :count, 1 do | 740 | + block = create(ProfileImageBlock, :box => profile.boxes.first) |
741 | + assert_difference 'ProfileImageBlock.count', 1 do | ||
742 | post :clone, :id => block.id, :profile => profile.identifier | 742 | post :clone, :id => block.id, :profile => profile.identifier |
743 | assert_response :redirect | 743 | assert_response :redirect |
744 | end | 744 | end |
test/functional/users_controller_test.rb
@@ -69,7 +69,7 @@ class UsersControllerTest < ActionController::TestCase | @@ -69,7 +69,7 @@ class UsersControllerTest < ActionController::TestCase | ||
69 | 69 | ||
70 | should 'set admin role' do | 70 | should 'set admin role' do |
71 | person = create_user.person | 71 | person = create_user.person |
72 | - Role.create!(:name => 'Admin', :key => 'environment_administrator', :environment_id => environment.id, :permissions => ['view_environment_admin_panel']) | 72 | + Role.create!(:name => 'Admin', :key => 'environment_administrator', :environment => environment, :permissions => ['view_environment_admin_panel']) |
73 | assert_equal false, person.is_admin? | 73 | assert_equal false, person.is_admin? |
74 | post :set_admin_role, :id => person.id, :q => '' | 74 | post :set_admin_role, :id => person.id, :q => '' |
75 | person.reload | 75 | person.reload |
@@ -78,7 +78,7 @@ class UsersControllerTest < ActionController::TestCase | @@ -78,7 +78,7 @@ class UsersControllerTest < ActionController::TestCase | ||
78 | 78 | ||
79 | should 'reset admin role' do | 79 | should 'reset admin role' do |
80 | person = create_user.person | 80 | person = create_user.person |
81 | - Role.create!(:name => 'Admin', :key => 'environment_administrator', :environment_id => environment.id, :permissions => ['view_environment_admin_panel']) | 81 | + Role.create!(:name => 'Admin', :key => 'environment_administrator', :environment => environment, :permissions => ['view_environment_admin_panel']) |
82 | 82 | ||
83 | environment.add_admin(person) | 83 | environment.add_admin(person) |
84 | assert person.is_admin? | 84 | assert person.is_admin? |