Changeset 1275
- Timestamp:
- 09/29/06 01:15:28 (2 years ago)
- Files:
-
- experimental/restful/app/apis/movable_type_service.rb (modified) (1 diff)
- experimental/restful/app/controllers/admin/content_controller.rb (modified) (2 diffs)
- experimental/restful/app/controllers/admin/feedback_controller.rb (modified) (1 diff)
- experimental/restful/app/controllers/articles_controller.rb (modified) (1 diff)
- experimental/restful/app/controllers/content_controller.rb (modified) (1 diff)
- experimental/restful/app/controllers/theme_controller.rb (modified) (1 diff)
- experimental/restful/app/controllers/xml_controller.rb (deleted)
- experimental/restful/app/models/article.rb (modified) (2 diffs)
- experimental/restful/app/models/categorization.rb (added)
- experimental/restful/app/models/category.rb (modified) (2 diffs)
- experimental/restful/app/models/comment.rb (modified) (1 diff)
- experimental/restful/app/models/content.rb (modified) (1 diff)
- experimental/restful/app/models/notification.rb (added)
- experimental/restful/app/models/user.rb (modified) (1 diff)
- experimental/restful/app/views/admin/users/_user.rhtml (modified) (1 diff)
- experimental/restful/app/views/articles/read.rhtml (modified) (1 diff)
- experimental/restful/app/views/articles/_comment.rhtml (modified) (1 diff)
- experimental/restful/config/routes.rb (modified) (1 diff)
- experimental/restful/db/migrate/056_create_notifications.rb (added)
- experimental/restful/db/migrate/057_add_categorization_model.rb (added)
- experimental/restful/test/fixtures/articles_categories.yml (deleted)
- experimental/restful/test/fixtures/categorizations.yml (added)
- experimental/restful/test/functional/accounts_controller_test.rb (modified) (4 diffs)
- experimental/restful/test/functional/admin/article_preview_test.rb (modified) (1 diff)
- experimental/restful/test/functional/admin/blacklist_controller_test.rb (modified) (4 diffs)
- experimental/restful/test/functional/admin/categories_controller_test.rb (modified) (6 diffs)
- experimental/restful/test/functional/admin/comments_controller_test.rb (modified) (6 diffs)
- experimental/restful/test/functional/admin/content_controller_test.rb (modified) (15 diffs)
- experimental/restful/test/functional/admin/feedback_controller_test.rb (modified) (5 diffs)
- experimental/restful/test/functional/admin/general_controller_test.rb (modified) (1 diff)
- experimental/restful/test/functional/admin/pages_controller_test.rb (modified) (3 diffs)
- experimental/restful/test/functional/admin/resources_controller_test.rb (modified) (3 diffs)
- experimental/restful/test/functional/admin/textfilters_controller_test.rb (modified) (2 diffs)
- experimental/restful/test/functional/admin/themes_controller_test.rb (modified) (1 diff)
- experimental/restful/test/functional/admin/trackbacks_controller_test.rb (modified) (5 diffs)
- experimental/restful/test/functional/admin/users_controller_test.rb (modified) (4 diffs)
- experimental/restful/test/functional/articles_controller_test.rb (modified) (18 diffs)
- experimental/restful/test/functional/backend_controller_test.rb (modified) (1 diff)
- experimental/restful/test/functional/content_fragment_cache_test.rb (deleted)
- experimental/restful/test/functional/redirect_controller_test.rb (modified) (2 diffs)
- experimental/restful/test/functional/theme_controller_test.rb (modified) (1 diff)
- experimental/restful/test/functional/xml_controller_test.rb (deleted)
- experimental/restful/test/test_helper.rb (modified) (2 diffs)
- experimental/restful/test/unit/article_test.rb (modified) (1 diff)
- experimental/restful/test/unit/category_test.rb (modified) (1 diff)
- experimental/restful/test/unit/comment_test.rb (modified) (3 diffs)
- experimental/restful/test/unit/content_state/feedback_states_test.rb (modified) (1 diff)
- experimental/restful/test/unit/notification_test.rb (added)
- experimental/restful/themes/scribbish/views/articles/_article.rhtml (modified) (1 diff)
- experimental/restful/vendor (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
experimental/restful/app/apis/movable_type_service.rb
r1269 r1275 94 94 95 95 def getPostCategories(postid, username, password) 96 this_blog.articles.find(postid).categori es.collect do |c|96 this_blog.articles.find(postid).categorizations.collect do |c| 97 97 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, 100 100 :isPrimary => c.is_primary.to_i 101 101 ) experimental/restful/app/controllers/admin/content_controller.rb
r1188 r1275 32 32 33 33 def category_add; do_add_or_remove_fu; end 34 alias_method :category_remove, :category_add35 34 alias_method :resource_add, :category_add 36 35 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 37 45 38 46 def preview … … 120 128 121 129 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 124 136 @selected = params[:categories] || [] 125 137 end experimental/restful/app/controllers/admin/feedback_controller.rb
r1218 r1275 1 1 require 'comment' 2 require 'trackback' 2 3 3 4 class Admin::FeedbackController < Admin::BaseController 4 model :comment, :trackback5 5 6 6 def index experimental/restful/app/controllers/articles_controller.rb
r1245 r1275 212 212 return list_groupings(klass) unless params[:id] 213 213 214 @page_title = "#{ this_blog.blog_name} - #{klass.to_s.underscore} #{params[:id]}"214 @page_title = "#{klass.to_s.underscore} #{params[:id]}" 215 215 @articles = klass.find_by_permalink(params[:id]).articles.find_already_published rescue [] 216 216 auto_discovery_feed :type => klass.to_s.underscore, :id => params[:id] experimental/restful/app/controllers/content_controller.rb
r1086 r1275 20 20 21 21 include LoginSystem 22 model :user22 # model :user 23 23 helper :theme 24 24 before_filter :auto_discovery_defaults experimental/restful/app/controllers/theme_controller.rb
r1242 r1275 24 24 private 25 25 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) 27 28 render :text => "Not Found", :status => 404 and return if file.split(%r{[\\/]}).include?("..") 28 29 send_file this_blog.current_theme.path + "/#{type}/#{file}", :type => mime, :disposition => 'inline', :stream => false experimental/restful/app/models/article.rb
r1265 r1275 7 7 content_fields :body, :extended 8 8 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" 12 12 has_many :resources, :order => "created_at DESC", 13 13 :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 15 20 has_and_belongs_to_many :tags, :foreign_key => 'article_id' 16 21 belongs_to :user … … 263 268 264 269 def add_notifications 265 # Grr, how do I do :conditions => 'notify_on_new_articles = true' when on MySQL boolean DB tables266 # 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 270 270 self.notify_users = User.find_boolean(:all, :notify_on_new_articles) 271 271 self.notify_users << self.user if (self.user.notify_watch_my_articles? rescue false) experimental/restful/app/models/category.rb
r1237 r1275 1 1 class Category < ActiveRecord::Base 2 2 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" 5 6 6 7 def self.find_all_with_article_counters(maxcount=nil) … … 8 9 SELECT categories.id, categories.name, categories.permalink, categories.position, COUNT(articles.id) AS article_counter 9 10 FROM #{Category.table_name} categories 10 LEFT OUTER JOIN #{Category.table_name_prefix} articles_categories#{Category.table_name_suffix} articles_categories11 LEFT OUTER JOIN #{Category.table_name_prefix}categorizations#{Category.table_name_suffix} articles_categories 11 12 ON articles_categories.category_id = categories.id 12 13 LEFT OUTER JOIN #{Article.table_name} articles experimental/restful/app/models/comment.rb
r1241 r1275 52 52 :permalink => permalink } 53 53 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 54 67 end experimental/restful/app/models/content.rb
r1265 r1275 12 12 :mapping => %w{ state memento } 13 13 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 17 29 18 30 has_many :triggers, :as => :pending_item, :dependent => :delete_all experimental/restful/app/models/user.rb
r1245 r1275 3 3 # this model expects a certain database layout and its based on the name/login pattern. 4 4 class 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 8 9 9 10 has_many :articles, :order => 'created_at DESC' do experimental/restful/app/views/admin/users/_user.rhtml
r787 r1275 1 1 <div class="user"> 2 2 <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> 8 8 <p><%= link_to 'Edit', :action => 'edit', :id => user %><strong> |</strong> <%= link_to 'Delete', :action => 'destroy', :id => user %></p> 9 9 </div> experimental/restful/app/views/articles/read.rhtml
r1265 r1275 57 57 <p class="postmetadata alt"> 58 58 <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> 60 60 <% if @article.allow_pings? -%> 61 61 <a href="<%= @article.trackback_url %>" >trackback uri</a> experimental/restful/app/views/articles/_comment.rhtml
r1265 r1275 4 4 <%= gravatar_tag(comment.email) if this_blog.use_gravatar and comment.email %> 5 5 <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) %> 7 7 <% unless comment.published -%> 8 8 <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 72 72 73 73 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 => /.*/ 77 77 map.connect 'images/theme/:filename', 78 :controller => 'theme', :action => 'images' 78 :controller => 'theme', :action => 'images', :filename => /.*/ 79 79 80 80 # For the tests experimental/restful/test/functional/accounts_controller_test.rb
r915 r1275 25 25 26 26 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") 29 28 end 30 29 … … 34 33 assert_session_has :user 35 34 36 assert_redirect 37 assert_redirected_to :controller => "admin/general", :action => "index" 35 assert_response :redirect, :controller => "admin/general", :action => "index" 38 36 end 39 37 40 38 def test_disable_signup_after_user_exists 41 39 get :signup 42 assert_redirect 43 assert_redirected_to :action => "login" 40 assert_response :redirect, :action => "login" 44 41 end 45 42 … … 51 48 post :signup, :user => { :login => "newbob", :password => "newpassword", :password_confirmation => "wrong" } 52 49 assert_invalid_column_on_record "user", :password 53 assert_ success50 assert_response :success 54 51 55 52 post :signup, :user => { :login => "yo", :password => "newpassword", :password_confirmation => "newpassword" } 56 53 assert_invalid_column_on_record "user", :login 57 assert_ success54 assert_response :success 58 55 59 56 post :signup, :user => { :login => "yo", :password => "newpassword", :password_confirmation => "wrong" } 60 57 assert_invalid_column_on_record "user", [:login, :password] 61 assert_ success58 assert_response :success 62 59 end 63 60 … … 79 76 80 77 end 81 82 78 end experimental/restful/test/functional/admin/article_preview_test.rb
r915 r1275 24 24 post :preview, 'article' => { :title => 'A title' } 25 25 assert_response :success 26 assert_ rendered_file 'preview'26 assert_template 'preview' 27 27 assert_tag :tag => 'h4', :content => 'A title' 28 28 assert_no_tag :tag => 'p' experimental/restful/test/functional/admin/blacklist_controller_test.rb
r1245 r1275 18 18 def test_index 19 19 get :index 20 assert_ rendered_file 'list'20 assert_template 'list' 21 21 end 22 22 23 23 def test_list 24 24 get :list 25 assert_ rendered_file 'list'25 assert_template 'list' 26 26 assert_template_has 'blacklist_patterns' 27 27 end … … 31 31 32 32 post :new, 'blacklist_pattern' => { } 33 assert_re directed_to:action => 'list'33 assert_response :redirect, :action => 'list' 34 34 35 35 assert_equal num_blacklist_patterns + 1, BlacklistPattern.count … … 38 38 def test_edit 39 39 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) 43 43 end 44 44 45 45 def test_update 46 46 post :edit, 'id' => 1 47 assert_re directed_to:action => 'list'47 assert_response :redirect, :action => 'list' 48 48 end 49 49 … … 52 52 53 53 get :destroy, 'id' => 1 54 assert_ success54 assert_response :success 55 55 56 56 post :destroy, 'id' => 1 57 assert_re directed_to:action => 'list'57 assert_response :redirect, :action => 'list' 58 58 59 59 assert_raise(ActiveRecord::RecordNotFound) { experimental/restful/test/functional/admin/categories_controller_test.rb
r1245 r1275 18 18 def test_index 19 19 get :index 20 assert_ rendered_file 'list'20 assert_template 'list' 21 21 assert_template_has 'categories' 22 22 end … … 24 24 def test_list 25 25 get :list 26 assert_ rendered_file 'list'26 assert_template 'list' 27 27 assert_template_has 'categories' 28 28 assert_tag :tag => "div", … … 32 32 def test_show 33 33 get :show, 'id' => 1 34 assert_ rendered_file 'show'34 assert_template 'show' 35 35 assert_template_has 'category' 36 assert_valid _record 'category'36 assert_valid assigns(:category) 37 37 end 38 38 … … 41 41 42 42 post :new, 'category' => { :name => "test category" } 43 assert_re directed_to:action => 'list'43 assert_response :redirect, :action => 'list' 44 44 45 45 assert_equal num_categories + 1, Category.count … … 48 48 def test_edit 49 49 get :edit, :id => 1 50 assert_ rendered_file 'edit'50 assert_template 'edit' 51 51 assert_template_has 'category' 52 assert_valid _record 'category'52 assert_valid assigns(:category) 53 53 end 54 54 55 55 def test_update 56 56 post :edit, :id => 1 57 assert_re directed_to:action => 'list'57 assert_response :redirect, :action => 'list' 58 58 end 59 59 … … 62 62 63 63 get :destroy, :id => 1 64 assert_ success65 assert_ rendered_file 'destroy'64 assert_response :success 65 assert_template 'destroy' 66 66 67 67 post :destroy, :id => 1 68 assert_re directed_to:action => 'list'68 assert_response :redirect, :action => 'list' 69 69 70 70 assert_raise(ActiveRecord::RecordNotFound) { Category.find(1) } experimental/restful/test/functional/admin/comments_controller_test.rb
r1245 r1275 7 7 8 8 class Admin::CommentsControllerTest < Test::Unit::TestCase 9 fixtures :contents, :users 9 fixtures :contents, :users, :notifications 10 10 11 11 def setup … … 19 19 def test_index 20 20 get :index, :article_id => 2 21 assert_ rendered_file 'list'21 assert_template 'list' 22 22 end 23 23 24 24 def test_list 25 25 get :list, :article_id => 2 26 assert_ rendered_file 'list'26 assert_template 'list' 27 27 assert_template_has 'comments' 28 28 end … … 30 30 def test_show 31 31 get :show, :id => 5, :article_id => 2 32 assert_ rendered_file 'show'32 assert_template 'show' 33 33 assert_template_has 'comment' 34 assert_valid _record 'comment'34 assert_valid @response.template_objects['comment'] 35 35 end 36 36 37 37 def test_new 38 38 get :new, :article_id => 2 39 assert_ rendered_file 'new'39 assert_template 'new' 40 40 assert_template_has 'comment' 41 41 end … … 46 46 post(:new, :comment => { 'author' => 'author', 'body' => 'body' }, 47 47 :article_id => 2) 48 assert_re directed_to:action => 'show'48 assert_response :redirect, :action => 'show' 49 49 50 50 assert_equal num_comments + 1, Comment.count … … 53 53 def test_edit 54 54 get :edit, :id => 5, :article_id => 2 55 assert_ rendered_file 'edit'55 assert_template 'edit' 56 56 assert_template_has 'comment' 57 assert_valid _record 'comment'57 assert_valid assigns(:comment) 58 58 end 59 59 60 60 def test_update 61 61 post :edit, :id => 5, :article_id => 2 62 assert_re directed_to:action => 'show', :id => 562 assert_response :redirect, :action => 'show', :id => 5 63 63 end 64 64 … … 67 67 68 68 get :destroy, :id => 5, :article_id => 2 69 assert_ success69 assert_response :success 70 70 71 71 post :destroy, :id => 5, :article_id => 2 72 assert_re directed_to:action => 'list'72 assert_response :redirect, :action => 'list' 73 73 74 74 assert_raise(ActiveRecord::RecordNotFound) { experimental/restful/test/functional/admin/content_controller_test.rb
r1233 r1275 9 9 class Admin::ContentControllerTest < Test::Unit::TestCase 10 10 fixtures :contents, :users, :categories, :resources, :text_filters, 11 :blogs, : articles_categories11 :blogs, :categorizations 12 12 13 13 def setup … … 20 20 def test_index 21 21 get :index 22 assert_ rendered_file 'list'22 assert_template 'list' 23 23 end 24 24 25 25 def test_list 26 26 get :list 27 assert_ rendered_file 'list'27 assert_template 'list' 28 28 assert_template_has 'articles' 29 29 end … … 31 31 def test_show 32 32 get :show, 'id' => 1 33 assert_ rendered_file 'show'33 assert_template 'show' 34 34 assert_template_has 'article' 35 assert_valid _record 'article'35 assert_valid assigns(:article) 36 36 assert_not_nil assigns(:article) 37 37 assert_not_nil assigns(:categories) … … 41 41 def test_new 42 42 get :new 43 assert_ rendered_file 'new'43 assert_template 'new' 44 44 assert_template_has 'article' 45 45 end … … 71 71 tags = ['foo', 'bar', 'baz bliz', 'gorp gack gar'] 72 72 post :new, 'article' => { :title => "posted via tests!", :body => "Foo", :keywords => "foo bar 'baz bliz' \"gorp gack gar\""}, 'categories' => [1] 73 assert_re directed_to:action => 'show'73 assert_response :redirect, :action => 'show' 74 74 75 75 assert_equal num_articles + 1, this_blog.published_articles.size … … 91 91 :body => "The future's cool!", 92 92 :published_at => Time.now + 1.hour }) 93 assert_re directed_to:action => 'show'93 assert_response :redirect, :action => 'show' 94 94 assert ! assigns(:article).published? 95 95 assert_equal num_articles, this_blog.published_articles.size … … 112 112 extended="*foo*" 113 113 post :new, 'article' => { :title => "another test", :body => body, :extended => extended} 114 assert_re directed_to:action => 'show'114 assert_response :redirect, :action => 'show' 115 115 116 116 new_article = Article.find(:first, :order => "created_at DESC") … … 125 125 get :edit, 'id' => 1 126 126 assert_equal assigns(:selected), Article.find(1).categories.collect {|c| c.id} 127 assert_ rendered_file 'edit'127 assert_template 'edit' 128 128 assert_template_has 'article' 129 assert_valid _record 'article'129 assert_valid assigns(:article) 130 130 end 131 131 … … 136 136 body = "another *textile* test" 137 137 post :edit, 'id' => 1, 'article' => {:body => body, :text_filter => 'textile'} 138 assert_re directed_to:action => 'show', :id => 1138 assert_response :redirect, :action => 'show', :id => 1 139 139 140 140 article = Article.find(1) … … 149 149 150 150 get :destroy, 'id' => 1 151 assert_ success151 assert_response :success 152 152 153 153 post :destroy, 'id' => 1 154 assert_re directed_to:action => 'list'154 assert_response :redirect, :action => 'list' 155 155 156 156 assert_raise(ActiveRecord::RecordNotFound) { … … 162 162 get :category_add, :id => 1, :category_id => 1 163 163 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) 167 167 assert Article.find(1).categories.include?(Category.find(1)) 168 168 assert_not_nil assigns(:article) … … 174 174 get :category_remove, :id => 1, :category_id => 1 175 175 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) 179 179 assert !Article.find(1).categories.include?(Category.find(1)) 180 180 assert_not_nil assigns(:article) … … 186 186 get :resource_add, :id => 1, :resource_id => 1 187 187 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) 191 191 assert Article.find(1).resources.include?(Resource.find(1)) 192 192 assert_not_nil assigns(:article) … … 198 198 get :resource_remove, :id => 1, :resource_id => 1 199 199 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) 203 203 assert !Article.find(1).resources.include?(Resource.find(1)) 204 204 assert_not_nil assigns(:article) … … 209 209 def test_attachment_box_add 210 210 get :attachment_box_add, :id => 2 211 assert_ rendered_file '_attachment'211 assert_template '_attachment' 212 212 #assert_tag :tag => 'script' 213 213 end experimental/restful/test/functional/admin/feedback_controller_test.rb
r1218 r1275 9 9 class Admin::FeedbackControllerTest < Test::Unit::TestCase 10 10 fixtures :contents, :users, :resources, :text_filters, 11 :blogs, : articles_categories11 :blogs, :categorizations 12 12 13 13 def setup … … 21 21 get :index 22 22 23 assert_ success24 assert_ rendered_file 'list'23 assert_response :success 24 assert_template 'list' 25 25 assert_equal Feedback.count, assigns(:feedback).size 26 26 end … … 29 29 get :index, :confirmed => 'f' 30 30 31 assert_ success32 assert_ rendered_file 'list'31 assert_response :success 32 assert_template 'list' 33 33 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]), 35 35 assigns(:feedback).size) 36 36 … … 40 40 get :index, :published => 'f' 41 41 42 assert_ success43 assert_ rendered_file 'list'42 assert_response :success 43 assert_template 'list' 44 44 45 assert_equal(Feedback.count( ['blog_id = 1 AND published = ?', false]),45 assert_equal(Feedback.count(:conditions => ['blog_id = 1 AND published = ?', false]), 46 46 assigns(:feedback).size) 47 47 end … … 50 50 get :index, :published => 'f', :confirmed => 'f' 51 51 52 assert_ success53 assert_ rendered_file 'list'52 assert_response :success 53 assert_template 'list' 54 54 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]), 56 56 assigns(:feedback).size) 57 57 end experimental/restful/test/functional/admin/general_controller_test.rb
r935 r1275 17 17 def test_index 18 18 get :index 19 assert_ rendered_file 'index'19 assert_template 'index' 20 20 end 21 21 22 22 def test_redirect 23 23 get :redirect 24 assert_re directed_to:controller => 'admin/general', :action => 'index'24 assert_response :redirect, :controller => 'admin/general', :action => 'index' 25 25 end 26 26 end experimental/restful/test/functional/admin/pages_controller_test.rb
r1233 r1275 58 58 assert_equal "new_page", new_page.name 59 59 60 assert_re directed_to:action => "show", :id => new_page.id60 assert_response :redirect, :action => "show", :id => new_page.id 61 61 62 62 # XXX: The flash is currently being made available improperly to tests (scoop) … … 75 75 :body => "Adding a [link](http://www.typosphere.org/) here" } 76 76 77 assert_re directed_to:action => "show", :id => contents(:markdown_page).id77 assert_response :redirect, :action => "show", :id => contents(:markdown_page).id 78 78 79 79 # XXX: The flash is currently being made available improperly to tests (scoop) … … 83 83 def test_destroy 84 84 post :destroy, :id => contents(:another_page).id 85 assert_re directed_to:action => "list"85 assert_response :redirect, :action => "list" 86 86 assert_raise(ActiveRecord::RecordNotFound) { Page.find(contents(:another_page).id) } 87 87 end experimental/restful/test/functional/admin/resources_controller_test.rb
r908 r1275 17 17 def test_list 18 18 get :list 19 assert_ success20 assert_ rendered_file 'list'19 assert_response :success 20 assert_template 'list' 21 21 assert_template_has 'resources' 22 22 assert_not_nil assigns(:resources) … … 28 28 29 29 get :destroy, :id => 1 30 assert_ success31 assert_ rendered_file 'destroy'30 assert_response :success 31 assert_template 'destroy' 32 32 assert_not_nil assigns(:file) 33 33 … … 35 35 assert_response 302 36 36 follow_redirect 37 assert_ rendered_file 'list'37 assert_template 'list' 38 38 end 39 39 40 40 def test_new 41 41 get :new 42 assert_ success43 assert_ rendered_file 'new'42 assert_response :success 43 assert_template 'new' 44 44 end 45 45 experimental/restful/test/functional/admin/textfilters_controller_test.rb
r908 r1275 19 19 post :new, :textfilter => { :name => 'filterx', 20 20 :description => 'Filter X', :markup => 'markdown' } 21 assert_re directed_to:action => 'show'21 assert_response :redirect, :action => 'show' 22 22 end 23 23 … … 25 25 post :edit, :id => 1, :textfilter => { :name => 'filterx', 26 26 :description => 'Filter X', :markup => 'markdown' } 27 assert_re directed_to:action => 'show'27 assert_response :redirect, :action => 'show' 28 28 end 29 29 end experimental/restful/test/functional/admin/themes_controller_test.rb
r908 r1275 25 25 def test_switchto 26 26 get :switchto, :theme => 'azure' 27 assert_re directed_to:action => 'index'27 assert_response :redirect, :action => 'index' 28 28 end 29
