Changeset 1275

Show
Ignore:
Timestamp:
09/29/06 01:15:28 (2 years ago)
Author:
pdcawley
Message:

Got rid of all the deprecation warnings except for one that's thrown by image_path
which, frankly, shouldn't be thrown by Rails at all. One test is failing, but again
that appears to be a Rails bug.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • experimental/restful/app/apis/movable_type_service.rb

    r1269 r1275  
    9494 
    9595  def getPostCategories(postid, username, password) 
    96     this_blog.articles.find(postid).categories.collect do |c| 
     96    this_blog.articles.find(postid).categorizations.collect do |c| 
    9797      MovableTypeStructs::CategoryPerPost.new( 
    98           :categoryName => c.name, 
    99           :categoryId   => c.id.to_i, 
     98          :categoryName => c.category.name, 
     99          :categoryId   => c.category_id.to_i, 
    100100          :isPrimary    => c.is_primary.to_i 
    101101        ) 
  • experimental/restful/app/controllers/admin/content_controller.rb

    r1188 r1275  
    3232 
    3333  def category_add; do_add_or_remove_fu; end 
    34   alias_method :category_remove, :category_add 
    3534  alias_method :resource_add,    :category_add 
    3635  alias_method :resource_remove, :category_add 
     36 
     37  def category_remove 
     38    @article  = Article.find(params[:id]) 
     39    @category = @article.categories.find(params['category_id']) 
     40    setup_categories 
     41    @article.categorizations.delete(@article.categorizations.find_by_category_id(params['category_id'])) 
     42    @article.save 
     43    render :partial => 'show_categories' 
     44  end 
    3745 
    3846  def preview 
     
    120128 
    121129  def set_article_categories 
    122     @article.categories.clear 
    123     @article.categories = Category.find(params[:categories]) if params[:categories] 
     130    @article.categorizations.clear 
     131    if params[:categories] 
     132      Category.find(params[:categories]).each do |cat| 
     133        @article.categories << cat 
     134      end 
     135    end 
    124136    @selected = params[:categories] || [] 
    125137  end 
  • experimental/restful/app/controllers/admin/feedback_controller.rb

    r1218 r1275  
    1  
     1require 'comment' 
     2require 'trackback' 
    23 
    34class Admin::FeedbackController < Admin::BaseController 
    4   model :comment, :trackback 
    55 
    66  def index 
  • experimental/restful/app/controllers/articles_controller.rb

    r1245 r1275  
    212212    return list_groupings(klass) unless params[:id] 
    213213 
    214     @page_title = "#{this_blog.blog_name} - #{klass.to_s.underscore} #{params[:id]}" 
     214    @page_title = "#{klass.to_s.underscore} #{params[:id]}" 
    215215    @articles = klass.find_by_permalink(params[:id]).articles.find_already_published rescue [] 
    216216    auto_discovery_feed :type => klass.to_s.underscore, :id => params[:id] 
  • experimental/restful/app/controllers/content_controller.rb

    r1086 r1275  
    2020 
    2121  include LoginSystem 
    22   model :user 
     22#  model :user 
    2323  helper :theme 
    2424  before_filter :auto_discovery_defaults 
  • experimental/restful/app/controllers/theme_controller.rb

    r1242 r1275  
    2424  private 
    2525 
    26   def render_theme_item(type, file, mime = mime_for(file)) 
     26  def render_theme_item(type, file, mime = nil) 
     27    mime ||= mime_for(file) 
    2728    render :text => "Not Found", :status => 404 and return if file.split(%r{[\\/]}).include?("..") 
    2829    send_file this_blog.current_theme.path + "/#{type}/#{file}", :type => mime, :disposition => 'inline', :stream => false 
  • experimental/restful/app/models/article.rb

    r1265 r1275  
    77  content_fields :body, :extended 
    88 
    9   has_many :pings, :dependent => true, :order => "created_at ASC" 
    10   has_many :comments, :dependent => true, :order => "created_at ASC" 
    11   has_many :trackbacks, :dependent => true, :order => "created_at ASC" 
     9  has_many :pings, :dependent => :destroy, :order => "created_at ASC" 
     10  has_many :comments, :dependent => :destroy, :order => "created_at ASC" 
     11  has_many :trackbacks, :dependent => :destroy, :order => "created_at ASC" 
    1212  has_many :resources, :order => "created_at DESC", 
    1313           :class_name => "Resource", :foreign_key => 'article_id' 
    14   has_and_belongs_to_many :categories, :foreign_key => 'article_id' 
     14  has_many :categorizations 
     15  has_many :categories, :through => :categorizations, :uniq => true do 
     16    def push_with_attributes(cat, join_attrs = { :is_primary => false }) 
     17      Categorization.with_scope(:create => join_attrs) { self << cat } 
     18    end 
     19  end 
    1520  has_and_belongs_to_many :tags, :foreign_key => 'article_id' 
    1621  belongs_to :user 
     
    263268 
    264269  def add_notifications 
    265     # Grr, how do I do :conditions => 'notify_on_new_articles = true' when on MySQL boolean DB tables 
    266     # are integers, Postgres booleans are booleans, and sqlite is basically just a string? 
    267     # 
    268     # I'm punting for now and doing the test in Ruby.  Feel free to rewrite. 
    269  
    270270    self.notify_users = User.find_boolean(:all, :notify_on_new_articles) 
    271271    self.notify_users << self.user if (self.user.notify_watch_my_articles? rescue false) 
  • experimental/restful/app/models/category.rb

    r1237 r1275  
    11class Category < ActiveRecord::Base 
    22  acts_as_list 
    3   has_and_belongs_to_many(:articles, 
    4                           :order => "published_at DESC, created_at DESC") 
     3  has_many :categorizations 
     4  has_many :articles, :through => :categorizations, 
     5    :order => "published_at DESC, created_at DESC" 
    56 
    67  def self.find_all_with_article_counters(maxcount=nil) 
     
    89      SELECT categories.id, categories.name, categories.permalink, categories.position, COUNT(articles.id) AS article_counter 
    910      FROM #{Category.table_name} categories 
    10         LEFT OUTER JOIN #{Category.table_name_prefix}articles_categories#{Category.table_name_suffix} articles_categories 
     11        LEFT OUTER JOIN #{Category.table_name_prefix}categorizations#{Category.table_name_suffix} articles_categories 
    1112          ON articles_categories.category_id = categories.id 
    1213        LEFT OUTER JOIN #{Article.table_name} articles 
  • experimental/restful/app/models/comment.rb

    r1241 r1275  
    5252      :permalink  => permalink } 
    5353  end 
     54 
     55  def self.html_map(field=nil) 
     56    html_map = { :body => true } 
     57    if field 
     58      html_map[field.to_sym] 
     59    else 
     60      html_map 
     61    end 
     62  end 
     63 
     64  def content_fields 
     65    [:body] 
     66  end 
    5467end 
  • experimental/restful/app/models/content.rb

    r1265 r1275  
    1212    :mapping => %w{ state memento } 
    1313 
    14   has_and_belongs_to_many :notify_users, :class_name => 'User', 
    15     :join_table => 'notifications', :foreign_key => 'notify_content_id', 
    16     :association_foreign_key => 'notify_user_id', :uniq => true 
     14  has_many :notifications, :foreign_key => 'content_id' 
     15  has_many :notify_users, :through => :notifications, 
     16    :source => 'notify_user', 
     17    :uniq => true 
     18 
     19  def notify_users=(collection) 
     20    return notify_users.clear if collection.empty? 
     21    self.class.transaction do 
     22      self.notifications.clear 
     23      collection.uniq.each do |u| 
     24        self.notifications.build(:notify_user => u) 
     25      end 
     26      notify_users.target = collection 
     27    end 
     28  end 
    1729 
    1830  has_many :triggers, :as => :pending_item, :dependent => :delete_all 
  • experimental/restful/app/models/user.rb

    r1245 r1275  
    33# this model expects a certain database layout and its based on the name/login pattern. 
    44class User < ActiveRecord::Base 
    5   has_and_belongs_to_many :notify_contents, :class_name => 'Content', 
    6     :join_table => 'notifications', :foreign_key => 'notify_user_id', 
    7     :association_foreign_key => 'notify_content_id', :uniq => true 
     5  has_many :notifications, :foreign_key => 'notify_user_id' 
     6  has_many :notify_contents, :through => :notifications, 
     7    :source => 'notify_content', 
     8    :uniq => true 
    89 
    910  has_many :articles, :order => 'created_at DESC' do 
  • experimental/restful/app/views/admin/users/_user.rhtml

    r787 r1275  
    11<div class="user"> 
    22  <h4><%= link_to h(user.login), {:action => "show", :id => user.id} %></h4> 
    3        <p>Number of Articles: <%= Article.count "user_id = #{user.id}"  %></p> 
    4        <p>Number of Comments: <%= Comment.count "user_id = #{user.id}"  %></p> 
    5         <p>Notified<% if user.notify_via_email? %> via email<% end %>:  
    6          <%= "new articles" if user.notify_on_new_articles? %> 
    7          <%= "comments" if user.notify_on_comments? %></p> 
     3        <p>Number of Articles: <%= Article.count :conditions => "user_id = #{user.id}"  %></p> 
     4        <p>Number of Comments: <%= Comment.count :conditions => "user_id = #{user.id}"  %></p> 
     5        <p>Notified<% if user.notify_via_email? %> via email<% end %>: 
     6          <%= "new articles" if user.notify_on_new_articles? %> 
     7          <%= "comments" if user.notify_on_comments? %></p> 
    88  <p><%= link_to 'Edit', :action => 'edit', :id => user  %><strong> |</strong> <%= link_to 'Delete', :action => 'destroy', :id => user %></p> 
    99</div> 
  • experimental/restful/app/views/articles/read.rhtml

    r1265 r1275  
    5757<p class="postmetadata alt"> 
    5858  <small> 
    59   <a href="<%= xml_url :action=>'feed', :type=>'article', :format => 'rss20', :id => @article %>" title="RSS Feed">RSS feed for this post</a> 
     59  <a href="<%= url_for :controller => 'xml', :action=>'feed', :type=>'article', :format => 'rss20', :id => @article %>" title="RSS Feed">RSS feed for this post</a> 
    6060<% if @article.allow_pings? -%> 
    6161  <a href="<%= @article.trackback_url %>" >trackback uri</a> 
  • experimental/restful/app/views/articles/_comment.rhtml

    r1265 r1275  
    44  <%= gravatar_tag(comment.email) if this_blog.use_gravatar and comment.email %> 
    55  <cite><strong><%= link_to_unless(comment.url.blank?, h(comment.author), comment.url) %></strong> </cite> said <%= distance_of_time_in_words comment.article.published_at, comment.created_at %> later:<br /> 
    6   <%= html(comment) %> 
     6  <%= comment.generate_html(:body) %> 
    77  <% unless comment.published -%> 
    88    <div class="spamwarning">This comment has been flagged for moderator approval.  It won't appear on this blog until the author approves it.</div> 
  • experimental/restful/config/routes.rb

    r1245 r1275  
    7272 
    7373  map.connect 'stylesheets/theme/:filename', 
    74     :controller => 'theme', :action => 'stylesheets' 
    75   map.connect 'javascript/theme/:filename', 
    76     :controller => 'theme', :action => 'javascript' 
     74    :controller => 'theme', :action => 'stylesheets', :filename => /.*/ 
     75  map.connect 'javascripts/theme/:filename', 
     76    :controller => 'theme', :action => 'javascript', :filename => /.*/ 
    7777  map.connect 'images/theme/:filename', 
    78     :controller => 'theme', :action => 'images' 
     78    :controller => 'theme', :action => 'images', :filename => /.*/ 
    7979 
    8080  # For the tests 
  • experimental/restful/test/functional/accounts_controller_test.rb

    r915 r1275  
    2525 
    2626    assert_equal users(:bob), @response.session[:user] 
    27  
    28     assert_redirect_url "http://localhost/bogus/location" 
     27    assert @response.redirect_url_match?("http://localhost/bogus/location") 
    2928  end 
    3029 
     
    3433    assert_session_has :user 
    3534 
    36     assert_redirect 
    37     assert_redirected_to :controller => "admin/general", :action => "index" 
     35    assert_response :redirect, :controller => "admin/general", :action => "index" 
    3836  end 
    3937 
    4038  def test_disable_signup_after_user_exists 
    4139    get :signup 
    42     assert_redirect 
    43     assert_redirected_to :action => "login" 
     40    assert_response :redirect, :action => "login" 
    4441  end 
    4542 
     
    5148    post :signup, :user => { :login => "newbob", :password => "newpassword", :password_confirmation => "wrong" } 
    5249    assert_invalid_column_on_record "user", :password 
    53     assert_success 
     50    assert_response :success 
    5451 
    5552    post :signup, :user => { :login => "yo", :password => "newpassword", :password_confirmation => "newpassword" } 
    5653    assert_invalid_column_on_record "user", :login 
    57     assert_success 
     54    assert_response :success 
    5855 
    5956    post :signup, :user => { :login => "yo", :password => "newpassword", :password_confirmation => "wrong" } 
    6057    assert_invalid_column_on_record "user", [:login, :password] 
    61     assert_success 
     58    assert_response :success 
    6259  end 
    6360 
     
    7976 
    8077  end 
    81  
    8278end 
  • experimental/restful/test/functional/admin/article_preview_test.rb

    r915 r1275  
    2424    post :preview, 'article' => { :title => 'A title' } 
    2525    assert_response :success 
    26     assert_rendered_file 'preview' 
     26    assert_template 'preview' 
    2727    assert_tag :tag => 'h4', :content => 'A title' 
    2828    assert_no_tag :tag => 'p' 
  • experimental/restful/test/functional/admin/blacklist_controller_test.rb

    r1245 r1275  
    1818  def test_index 
    1919    get :index 
    20     assert_rendered_file 'list' 
     20    assert_template 'list' 
    2121  end 
    2222 
    2323  def test_list 
    2424    get :list 
    25     assert_rendered_file 'list' 
     25    assert_template 'list' 
    2626    assert_template_has 'blacklist_patterns' 
    2727  end 
     
    3131 
    3232    post :new, 'blacklist_pattern' => { } 
    33     assert_redirected_to :action => 'list' 
     33    assert_response :redirect, :action => 'list' 
    3434 
    3535    assert_equal num_blacklist_patterns + 1, BlacklistPattern.count 
     
    3838  def test_edit 
    3939    get :edit, 'id' => 1 
    40     assert_rendered_file 'edit' 
    41     assert_template_has 'blacklist_pattern' 
    42     assert_valid_record 'blacklist_pattern' 
     40    assert_template 'edit' 
     41    assert_template_has('blacklist_pattern') 
     42    assert_valid assigns(:blacklist_pattern) 
    4343  end 
    4444 
    4545  def test_update 
    4646    post :edit, 'id' => 1 
    47     assert_redirected_to :action => 'list' 
     47    assert_response :redirect, :action => 'list' 
    4848  end 
    4949 
     
    5252 
    5353    get :destroy, 'id' => 1 
    54     assert_success 
     54    assert_response :success 
    5555 
    5656    post :destroy, 'id' => 1 
    57     assert_redirected_to :action => 'list' 
     57    assert_response :redirect, :action => 'list' 
    5858 
    5959    assert_raise(ActiveRecord::RecordNotFound) { 
  • experimental/restful/test/functional/admin/categories_controller_test.rb

    r1245 r1275  
    1818  def test_index 
    1919    get :index 
    20     assert_rendered_file 'list' 
     20    assert_template 'list' 
    2121    assert_template_has 'categories' 
    2222  end 
     
    2424  def test_list 
    2525    get :list 
    26     assert_rendered_file 'list' 
     26    assert_template 'list' 
    2727    assert_template_has 'categories' 
    2828    assert_tag :tag => "div", 
     
    3232  def test_show 
    3333    get :show, 'id' => 1 
    34     assert_rendered_file 'show' 
     34    assert_template 'show' 
    3535    assert_template_has 'category' 
    36     assert_valid_record 'category' 
     36    assert_valid assigns(:category) 
    3737  end 
    3838 
     
    4141 
    4242    post :new, 'category' => { :name => "test category" } 
    43     assert_redirected_to :action => 'list' 
     43    assert_response :redirect, :action => 'list' 
    4444 
    4545    assert_equal num_categories + 1, Category.count 
     
    4848  def test_edit 
    4949    get :edit, :id => 1 
    50     assert_rendered_file 'edit' 
     50    assert_template 'edit' 
    5151    assert_template_has 'category' 
    52     assert_valid_record 'category' 
     52    assert_valid assigns(:category) 
    5353  end 
    5454 
    5555  def test_update 
    5656    post :edit, :id => 1 
    57     assert_redirected_to :action => 'list' 
     57    assert_response :redirect, :action => 'list' 
    5858  end 
    5959 
     
    6262 
    6363    get :destroy, :id => 1 
    64     assert_success 
    65     assert_rendered_file 'destroy' 
     64    assert_response :success 
     65    assert_template 'destroy' 
    6666 
    6767    post :destroy, :id => 1 
    68     assert_redirected_to :action => 'list' 
     68    assert_response :redirect, :action => 'list' 
    6969 
    7070    assert_raise(ActiveRecord::RecordNotFound) { Category.find(1) } 
  • experimental/restful/test/functional/admin/comments_controller_test.rb

    r1245 r1275  
    77 
    88class Admin::CommentsControllerTest < Test::Unit::TestCase 
    9   fixtures :contents, :users 
     9  fixtures :contents, :users, :notifications 
    1010 
    1111  def setup 
     
    1919  def test_index 
    2020    get :index, :article_id => 2 
    21     assert_rendered_file 'list' 
     21    assert_template 'list' 
    2222  end 
    2323 
    2424  def test_list 
    2525    get :list, :article_id => 2 
    26     assert_rendered_file 'list' 
     26    assert_template 'list' 
    2727    assert_template_has 'comments' 
    2828  end 
     
    3030  def test_show 
    3131    get :show, :id => 5, :article_id => 2 
    32     assert_rendered_file 'show' 
     32    assert_template 'show' 
    3333    assert_template_has 'comment' 
    34     assert_valid_record 'comment' 
     34    assert_valid @response.template_objects['comment'] 
    3535  end 
    3636 
    3737  def test_new 
    3838    get :new, :article_id => 2 
    39     assert_rendered_file 'new' 
     39    assert_template 'new' 
    4040    assert_template_has 'comment' 
    4141  end 
     
    4646    post(:new, :comment => { 'author' => 'author', 'body' => 'body' }, 
    4747               :article_id => 2) 
    48     assert_redirected_to :action => 'show' 
     48    assert_response :redirect, :action => 'show' 
    4949 
    5050    assert_equal num_comments + 1, Comment.count 
     
    5353  def test_edit 
    5454    get :edit, :id => 5, :article_id => 2 
    55     assert_rendered_file 'edit' 
     55    assert_template 'edit' 
    5656    assert_template_has 'comment' 
    57     assert_valid_record 'comment' 
     57    assert_valid assigns(:comment) 
    5858  end 
    5959 
    6060  def test_update 
    6161    post :edit, :id => 5, :article_id => 2 
    62     assert_redirected_to :action => 'show', :id => 5 
     62    assert_response :redirect, :action => 'show', :id => 5 
    6363  end 
    6464 
     
    6767 
    6868    get :destroy, :id => 5, :article_id => 2 
    69     assert_success 
     69    assert_response :success 
    7070 
    7171    post :destroy, :id => 5, :article_id => 2 
    72     assert_redirected_to :action => 'list' 
     72    assert_response :redirect, :action => 'list' 
    7373 
    7474    assert_raise(ActiveRecord::RecordNotFound) { 
  • experimental/restful/test/functional/admin/content_controller_test.rb

    r1233 r1275  
    99class Admin::ContentControllerTest < Test::Unit::TestCase 
    1010  fixtures :contents, :users, :categories, :resources, :text_filters, 
    11            :blogs, :articles_categorie
     11           :blogs, :categorization
    1212 
    1313  def setup 
     
    2020  def test_index 
    2121    get :index 
    22     assert_rendered_file 'list' 
     22    assert_template 'list' 
    2323  end 
    2424 
    2525  def test_list 
    2626    get :list 
    27     assert_rendered_file 'list' 
     27    assert_template 'list' 
    2828    assert_template_has 'articles' 
    2929  end 
     
    3131  def test_show 
    3232    get :show, 'id' => 1 
    33     assert_rendered_file 'show' 
     33    assert_template 'show' 
    3434    assert_template_has 'article' 
    35     assert_valid_record 'article' 
     35    assert_valid assigns(:article) 
    3636    assert_not_nil assigns(:article) 
    3737    assert_not_nil assigns(:categories) 
     
    4141  def test_new 
    4242    get :new 
    43     assert_rendered_file 'new' 
     43    assert_template 'new' 
    4444    assert_template_has 'article' 
    4545  end 
     
    7171    tags = ['foo', 'bar', 'baz bliz', 'gorp gack gar'] 
    7272    post :new, 'article' => { :title => "posted via tests!", :body => "Foo", :keywords => "foo bar 'baz bliz' \"gorp gack gar\""}, 'categories' => [1] 
    73     assert_redirected_to :action => 'show' 
     73    assert_response :redirect, :action => 'show' 
    7474 
    7575    assert_equal num_articles + 1, this_blog.published_articles.size 
     
    9191                       :body => "The future's cool!", 
    9292                       :published_at => Time.now + 1.hour }) 
    93     assert_redirected_to :action => 'show' 
     93    assert_response :redirect, :action => 'show' 
    9494    assert ! assigns(:article).published? 
    9595    assert_equal num_articles, this_blog.published_articles.size 
     
    112112    extended="*foo*" 
    113113    post :new, 'article' => { :title => "another test", :body => body, :extended => extended} 
    114     assert_redirected_to :action => 'show' 
     114    assert_response :redirect, :action => 'show' 
    115115 
    116116    new_article = Article.find(:first, :order => "created_at DESC") 
     
    125125    get :edit, 'id' => 1 
    126126    assert_equal assigns(:selected), Article.find(1).categories.collect {|c| c.id} 
    127     assert_rendered_file 'edit' 
     127    assert_template 'edit' 
    128128    assert_template_has 'article' 
    129     assert_valid_record 'article' 
     129    assert_valid assigns(:article) 
    130130  end 
    131131 
     
    136136    body = "another *textile* test" 
    137137    post :edit, 'id' => 1, 'article' => {:body => body, :text_filter => 'textile'} 
    138     assert_redirected_to :action => 'show', :id => 1 
     138    assert_response :redirect, :action => 'show', :id => 1 
    139139 
    140140    article = Article.find(1) 
     
    149149 
    150150    get :destroy, 'id' => 1 
    151     assert_success 
     151    assert_response :success 
    152152 
    153153    post :destroy, 'id' => 1 
    154     assert_redirected_to :action => 'list' 
     154    assert_response :redirect, :action => 'list' 
    155155 
    156156    assert_raise(ActiveRecord::RecordNotFound) { 
     
    162162    get :category_add, :id => 1, :category_id => 1 
    163163 
    164     assert_rendered_file '_show_categories' 
    165     assert_valid_record 'article' 
    166     assert_valid_record 'category' 
     164    assert_template '_show_categories' 
     165    assert_valid assigns(:article) 
     166    assert_valid assigns(:category) 
    167167    assert Article.find(1).categories.include?(Category.find(1)) 
    168168    assert_not_nil assigns(:article) 
     
    174174    get :category_remove, :id => 1, :category_id => 1 
    175175 
    176     assert_rendered_file '_show_categories' 
    177     assert_valid_record 'article' 
    178     assert_valid_record 'category' 
     176    assert_template '_show_categories' 
     177    assert_valid assigns(:article) 
     178    assert_valid assigns(:category) 
    179179    assert !Article.find(1).categories.include?(Category.find(1)) 
    180180    assert_not_nil assigns(:article) 
     
    186186    get :resource_add, :id => 1, :resource_id => 1 
    187187 
    188     assert_rendered_file '_show_resources' 
    189     assert_valid_record 'article' 
    190     assert_valid_record 'resource' 
     188    assert_template '_show_resources' 
     189    assert_valid assigns(:article) 
     190    assert_valid assigns(:resource) 
    191191    assert Article.find(1).resources.include?(Resource.find(1)) 
    192192    assert_not_nil assigns(:article) 
     
    198198    get :resource_remove, :id => 1, :resource_id => 1 
    199199 
    200     assert_rendered_file '_show_resources' 
    201     assert_valid_record 'article' 
    202     assert_valid_record 'resource' 
     200    assert_template '_show_resources' 
     201    assert_valid assigns(:article) 
     202    assert_valid assigns(:resource) 
    203203    assert !Article.find(1).resources.include?(Resource.find(1)) 
    204204    assert_not_nil assigns(:article) 
     
    209209  def test_attachment_box_add 
    210210    get :attachment_box_add, :id => 2 
    211     assert_rendered_file '_attachment' 
     211    assert_template '_attachment' 
    212212    #assert_tag :tag => 'script' 
    213213  end 
  • experimental/restful/test/functional/admin/feedback_controller_test.rb

    r1218 r1275  
    99class Admin::FeedbackControllerTest < Test::Unit::TestCase 
    1010  fixtures :contents, :users, :resources, :text_filters, 
    11            :blogs, :articles_categorie
     11           :blogs, :categorization
    1212 
    1313  def setup 
     
    2121    get :index 
    2222 
    23     assert_success 
    24     assert_rendered_file 'list' 
     23    assert_response :success 
     24    assert_template 'list' 
    2525    assert_equal Feedback.count, assigns(:feedback).size 
    2626  end 
     
    2929    get :index, :confirmed => 'f' 
    3030 
    31     assert_success 
    32     assert_rendered_file 'list' 
     31    assert_response :success 
     32    assert_template 'list' 
    3333 
    34     assert_equal(Feedback.count(['blog_id = 1 AND status_confirmed = ?', false]), 
     34    assert_equal(Feedback.count(:conditions => ['blog_id = 1 AND status_confirmed = ?', false]), 
    3535                 assigns(:feedback).size) 
    3636 
     
    4040    get :index, :published => 'f' 
    4141 
    42     assert_success 
    43     assert_rendered_file 'list' 
     42    assert_response :success 
     43    assert_template 'list' 
    4444 
    45     assert_equal(Feedback.count(['blog_id = 1 AND published = ?', false]), 
     45    assert_equal(Feedback.count(:conditions => ['blog_id = 1 AND published = ?', false]), 
    4646                 assigns(:feedback).size) 
    4747  end 
     
    5050    get :index, :published => 'f', :confirmed => 'f' 
    5151 
    52     assert_success 
    53     assert_rendered_file 'list' 
     52    assert_response :success 
     53    assert_template 'list' 
    5454 
    55     assert_equal(Feedback.count(['blog_id = 1 AND published = ? AND status_confirmed = ?', false, false]), 
     55    assert_equal(Feedback.count(:conditions => ['blog_id = 1 AND published = ? AND status_confirmed = ?', false, false]), 
    5656                 assigns(:feedback).size) 
    5757  end 
  • experimental/restful/test/functional/admin/general_controller_test.rb

    r935 r1275  
    1717  def test_index 
    1818    get :index 
    19     assert_rendered_file 'index' 
     19    assert_template 'index' 
    2020  end 
    2121 
    2222  def test_redirect 
    2323    get :redirect 
    24     assert_redirected_to :controller => 'admin/general', :action => 'index' 
     24    assert_response :redirect, :controller => 'admin/general', :action => 'index' 
    2525  end 
    2626end 
  • experimental/restful/test/functional/admin/pages_controller_test.rb

    r1233 r1275  
    5858    assert_equal "new_page", new_page.name 
    5959 
    60     assert_redirected_to :action => "show", :id => new_page.id 
     60    assert_response :redirect, :action => "show", :id => new_page.id 
    6161 
    6262    # XXX: The flash is currently being made available improperly to tests (scoop) 
     
    7575        :body => "Adding a [link](http://www.typosphere.org/) here" } 
    7676 
    77     assert_redirected_to :action => "show", :id => contents(:markdown_page).id 
     77    assert_response :redirect, :action => "show", :id => contents(:markdown_page).id 
    7878 
    7979    # XXX: The flash is currently being made available improperly to tests (scoop) 
     
    8383  def test_destroy 
    8484    post :destroy, :id => contents(:another_page).id 
    85     assert_redirected_to :action => "list" 
     85    assert_response :redirect, :action => "list" 
    8686    assert_raise(ActiveRecord::RecordNotFound) { Page.find(contents(:another_page).id) } 
    8787  end 
  • experimental/restful/test/functional/admin/resources_controller_test.rb

    r908 r1275  
    1717  def test_list 
    1818    get :list 
    19     assert_success 
    20     assert_rendered_file 'list' 
     19    assert_response :success 
     20    assert_template 'list' 
    2121    assert_template_has 'resources' 
    2222    assert_not_nil assigns(:resources) 
     
    2828 
    2929    get :destroy, :id => 1 
    30     assert_success 
    31     assert_rendered_file 'destroy' 
     30    assert_response :success 
     31    assert_template 'destroy' 
    3232    assert_not_nil assigns(:file) 
    3333 
     
    3535    assert_response 302 
    3636    follow_redirect 
    37     assert_rendered_file 'list' 
     37    assert_template 'list' 
    3838  end 
    3939 
    4040  def test_new 
    4141    get :new 
    42     assert_success 
    43     assert_rendered_file 'new' 
     42    assert_response :success 
     43    assert_template 'new' 
    4444  end 
    4545 
  • experimental/restful/test/functional/admin/textfilters_controller_test.rb

    r908 r1275  
    1919    post :new, :textfilter => { :name => 'filterx', 
    2020      :description => 'Filter X', :markup => 'markdown' } 
    21     assert_redirected_to :action => 'show' 
     21    assert_response :redirect, :action => 'show' 
    2222  end 
    2323 
     
    2525    post :edit, :id => 1, :textfilter => { :name => 'filterx', 
    2626      :description => 'Filter X', :markup => 'markdown' } 
    27     assert_redirected_to :action => 'show' 
     27    assert_response :redirect, :action => 'show' 
    2828  end 
    2929end 
  • experimental/restful/test/functional/admin/themes_controller_test.rb

    r908 r1275  
    2525  def test_switchto 
    2626    get :switchto, :theme => 'azure' 
    27     assert_redirected_to :action => 'index' 
     27    assert_response :redirect, :action => 'index' 
    2828  end 
    29