Changeset 1621
- Timestamp:
- 01/10/08 07:33:40 (4 months ago)
- Files:
-
- trunk/app/models/category.rb (modified) (1 diff)
- trunk/app/models/tag.rb (modified) (1 diff)
- trunk/test/fixtures/blogs.yml (modified) (2 diffs)
- trunk/test/fixtures/contents.yml (modified) (21 diffs)
- trunk/test/fixtures/feedback.yml (modified) (10 diffs)
- trunk/test/fixtures/redirects.yml (modified) (1 diff)
- trunk/test/fixtures/resources.yml (modified) (3 diffs)
- trunk/test/fixtures/sidebars.yml (modified) (1 diff)
- trunk/test/fixtures/text_filters.yml (modified) (5 diffs)
- trunk/test/fixtures/users.yml (modified) (5 diffs)
- trunk/test/functional/admin/content_controller_test.rb (modified) (2 diffs)
- trunk/test/functional/admin/feedback_controller_test.rb (modified) (3 diffs)
- trunk/test/functional/admin/resources_controller_test.rb (modified) (1 diff)
- trunk/test/functional/admin/textfilters_controller_test.rb (modified) (1 diff)
- trunk/test/functional/admin/users_controller_test.rb (modified) (3 diffs)
- trunk/test/unit/article_test.rb (modified) (1 diff)
- trunk/test/unit/comment_test.rb (modified) (1 diff)
- trunk/test/unit/notification_mailer_test.rb (modified) (1 diff)
- trunk/test/unit/resource_test.rb (modified) (1 diff)
- trunk/test/unit/text_filter_test.rb (modified) (1 diff)
- trunk/test/unit/user_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/models/category.rb
r1526 r1621 72 72 73 73 def permalink_url(anchor=nil, only_path=true) 74 blog = Blog. find(1)# remove me...74 blog = Blog.default # remove me... 75 75 76 76 blog.url_for( trunk/app/models/tag.rb
r1533 r1621 63 63 64 64 def permalink_url(anchor=nil, only_path=true) 65 blog = Blog. find(1)# remove me...65 blog = Blog.default # remove me... 66 66 67 67 blog.url_for( trunk/test/fixtures/blogs.yml
r1614 r1621 1 1 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 2 default: 3 id: 14 3 base_url: http://myblog.net 5 4 settings: … … 37 36 comment_text_filter: markdown 38 37 sp_allow_non_ajax_comments: true 39 40 second:41 id: 242 base_url: http://otherblog.net43 settings:44 jabber_password: ""45 show_extended_on_rss: true46 itunes_owner: ""47 blog_name: second test blog48 title_prefix: 049 limit_article_display: 1050 sp_url_limit: 051 use_gravatar: false52 itunes_email: ""53 blog_subtitle: ""54 limit_rss_display: 1055 itunes_explicit: false56 ping_urls: |-57 http://rpc.technorati.com/rpc/ping58 http://ping.blo.gs/59 http://rpc.weblogs.com/RPC260 itunes_name: ""61 geourl_location: ""62 default_allow_pings: false63 itunes_author: ""64 send_outbound_pings: true65 itunes_copyright: ""66 sp_global: true67 jabber_address: ""68 default_allow_comments: true69 itunes_subtitle: ""70 email_from: scott@sigkill.org71 theme: standard_issue72 text_filter: ""73 sp_article_auto_close: 074 link_to_author: false75 itunes_summary: ""76 comment_text_filter: ""77 sp_allow_non_ajax_comments: truetrunk/test/fixtures/contents.yml
r1620 r1621 2 2 3 3 article1: 4 blog _id: 14 blog: default 5 5 title: Article 1! 6 6 body: body … … 12 12 allow_pings: true 13 13 permalink: article-1 14 user _id: 114 user: tobi 15 15 author: Tobi 16 16 guid: a87c4220-18d4-11da-aadd-0002a5d5c51b … … 22 22 article2: 23 23 type: Article 24 blog _id: 124 blog: default 25 25 title: Article 2! 26 26 body: body … … 32 32 allow_pings: true 33 33 permalink: article-2 34 user _id: 234 user: longbob 35 35 author: Bob 36 36 guid: bbbbb … … 42 42 article3: 43 43 type: Article 44 blog _id: 144 blog: default 45 45 title: Article 3! 46 46 body: body … … 52 52 allow_pings: true 53 53 permalink: article-3 54 user _id: 154 user: tobi 55 55 author: Tobi 56 56 guid: ccccc … … 60 60 article4: 61 61 type: Article 62 blog _id: 162 blog: default 63 63 title: Article 4! 64 64 body: I'm not "public":http://www.example.com/public! … … 71 71 allow_pings: true 72 72 permalink: article-4 73 user _id: 173 user: tobi 74 74 author: Tobi 75 75 guid: ddddd … … 78 78 first_page: 79 79 type: Page 80 blog _id: 180 blog: default 81 81 name: page_one 82 82 title: Page One Title … … 85 85 published_at: 2005-05-05 01:00:00 86 86 updated_at: 2005-05-05 01:00:00 87 user _id: 187 user: tobi 88 88 published: true 89 89 state: published … … 91 91 another_page: 92 92 type: Page 93 blog _id: 193 blog: default 94 94 name: page/two 95 95 title: Another Page Title … … 98 98 created_at: 2005-05-05 01:00:00 99 99 published_at: 2005-05-05 01:00:00 100 user _id: 1100 user: tobi 101 101 published: true 102 102 state: published … … 104 104 markdown_page: 105 105 type: Page 106 blog _id: 1106 blog: default 107 107 name: markdown-page 108 108 title: Markdown Page 109 text_filter _id: 1109 text_filter: markdown_filter 110 110 body: this is *markdown*. 111 111 created_at: 2005-05-05 01:00:00 112 112 updated_at: 2005-05-05 01:00:00 113 113 published_at: 2005-05-05 01:00:00 114 user _id: 1114 user: tobi 115 115 published: true 116 116 state: published … … 118 118 inactive_article: 119 119 type: Article 120 blog _id: 1120 blog: default 121 121 title: Inactive Article 122 122 body: body … … 128 128 allow_pings: true 129 129 permalink: inactive-article 130 user _id: 1130 user: tobi 131 131 author: Tobi 132 132 guid: i1n2a3c4t5i6v7e … … 134 134 state: published 135 135 136 second_blog_article:137 type: Article138 blog_id: 2139 title: Second Blog Article140 body: body141 extended: extended content142 allow_comments: true143 allow_pings: true144 permalink: second-blog-article145 created_at: 2004-04-01 12:00:00146 updated_at: 2004-04-01 12:00:00147 published_at: 2004-04-01 12:00:00148 user_id: 1149 author: Tobi150 guid: 2b1l0o6g4ar7151 published: true152 state: published153 154 136 search_target: 155 137 type: Article 156 blog _id: 1138 blog: default 157 139 title: Find me! 158 140 body: search target … … 164 146 updated_at: 2004-04-01 12:00:00 165 147 published_at: 2004-04-01 12:00:00 166 user _id: 1148 user: tobi 167 149 author: Tobi 168 150 guid: 2b1l0o6g4ar7 … … 172 154 xmltest: 173 155 type: Article 174 blog _id: 1156 blog: default 175 157 title: Associations aren't :dependent => true anymore 176 158 body: originally seen on <a href="http://blog.rubyonrails.org/">blog.rubyonrails.org</a> … … 182 164 updated_at: 2003-04-28 05:31:00 183 165 published_at: 2003-04-28 05:31:00 184 user _id: 1166 user: tobi 185 167 author: Tobi 186 168 guid: urn:uuid:0d676c66-4135-4a8b-9d65-b6a3248d3032 … … 190 172 spammed_article: 191 173 type: Article 192 blog _id: 1174 blog: default 193 175 title: C'mon Spam Me! 194 176 body: A bunch of innocuous content … … 199 181 updated_at: 2001-01-01 200 182 published_at: 2001-01-01 201 user _id: 1183 user: tobi 202 184 author: Tobi 203 185 guid: urn:uuid:0d676c66-4135-4a8b-9d65-b6a3248d3023 trunk/test/fixtures/feedback.yml
r1620 r1621 1 1 spam_comment: 2 2 type: Comment 3 blog _id: 13 blog: default 4 4 published: true 5 5 article: article2 … … 15 15 comment2: 16 16 type: Comment 17 blog _id: 117 blog: default 18 18 published: true 19 19 article: article1 20 20 author: John Bar 21 user _id: 221 user: longbob 22 22 url: www.google.com 23 23 email: john.bar@google.com … … 31 31 comment3: 32 32 type: Comment 33 blog _id: 133 blog: default 34 34 published: false 35 35 state: presumed_spam … … 45 45 trackback1: 46 46 type: Trackback 47 blog _id: 147 blog: default 48 48 article: article2 49 49 published: false … … 61 61 trackback2: 62 62 type: Trackback 63 blog _id: 163 blog: default 64 64 article: article1 65 65 state: presumed_ham … … 76 76 trackback3: 77 77 type: Trackback 78 blog _id: 178 blog: default 79 79 article: article1 80 80 published: true … … 91 91 trackback4: 92 92 type: Trackback 93 blog _id: 193 blog: default 94 94 article: search_target 95 95 published: true … … 106 106 old_comment: 107 107 type: Comment 108 blog _id: 1108 blog: default 109 109 article: inactive_article 110 110 author: John Bar … … 121 121 probably_spam_comment: 122 122 type: Comment 123 blog _id: 1123 blog: default 124 124 published: false 125 125 article: spammed_article … … 136 136 definitely_spam_comment: 137 137 type: Comment 138 blog _id: 1138 blog: default 139 139 published: false 140 140 article: spammed_article trunk/test/fixtures/redirects.yml
r986 r1621 1 1 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 2 foo_redirect: 3 id: 14 3 from_path: foo/bar 5 4 to_path: /someplace/else 6 5 archive1_redirect: 7 id: 28 6 from_path: archives/000001.html 9 7 to_path: /articles/read/1 10 8 rooted_bar_redirect: 11 id: 312 9 from_path: bar/foo 13 10 to_path: /blog/someplace/else trunk/test/fixtures/resources.yml
r1620 r1621 1 1 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 2 resource1: 3 id: 14 3 article: article1 5 4 filename: me.jpg … … 9 8 10 9 resource2: 11 id: 212 10 article: article1 13 11 filename: moi … … 17 15 18 16 resource3: 19 id: 320 17 article: article2 21 18 filename: my_latest_typo_patch.diff trunk/test/fixtures/sidebars.yml
r1246 r1621 1 1 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 2 static_sidebar: 3 id: 34 3 active_position: 1 5 4 staged_position: 1 6 blog _id: 15 blog: default 7 6 config: |+ 8 7 --- !map:HashWithIndifferentAccess trunk/test/fixtures/text_filters.yml
r838 r1621 1 1 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 2 markdown_filter: 3 id: 14 3 name: "markdown" 5 4 description: "Markdown" … … 9 8 10 9 smartypants_filter: 11 id: 212 10 name: "smartypants" 13 11 description: "SmartyPants" … … 18 16 19 17 markdownsmartypants_filter: 20 id: 321 18 name: "markdown smartypants" 22 19 description: "Markdown with SmartyPants" … … 27 24 28 25 textile_filter: 29 id: 430 26 name: "textile" 31 27 description: "Textile" … … 35 31 36 32 none_filter: 37 id: 538 33 name: "none" 39 34 description: "None" trunk/test/fixtures/users.yml
r1608 r1621 2 2 3 3 tobi: 4 id: 15 4 login: tobi 6 5 password: ea0f5fd4398054c1c7aa0fbc7aaea30914a14441 # whatever … … 14 13 15 14 bob: 16 id: 217 15 login: bob 18 16 password: 9a91e1d8d95b6315991a88121bb0aa9f03ba0dfc # test … … 26 24 27 25 existingbob: 28 id: 329 26 login: existingbob 30 27 password: 9a91e1d8d95b6315991a88121bb0aa9f03ba0dfc # test … … 38 35 39 36 longbob: 40 id: 441 37 login: longbob 42 38 password: 8e9b1a9a38e66ca572a5e8fdac8e256848842dfa # longtest … … 50 46 51 47 randomuser: 52 id: 553 48 login: randomuser 54 49 password: 8e9b1a9a38e66ca572a5e8fdac8e256848842dfa # longtest trunk/test/functional/admin/content_controller_test.rb
r1620 r1621 193 193 def test_resource_add 194 194 art_id = contents(:article1).id 195 get :resource_add, :id => art_id, :resource_id => 1195 get :resource_add, :id => art_id, :resource_id => resources(:resource1).id 196 196 197 197 assert_template '_show_resources' 198 198 assert_valid assigns(:article) 199 199 assert_valid assigns(:resource) 200 assert Article.find(art_id).resources.include?( Resource.find(1))200 assert Article.find(art_id).resources.include?(resources(:resource1)) 201 201 assert_not_nil assigns(:article) 202 202 assert_not_nil assigns(:resource) … … 206 206 def test_resource_remove 207 207 art_id = contents(:article1).id 208 get :resource_remove, :id => art_id, :resource_id => 1208 get :resource_remove, :id => art_id, :resource_id => resources(:resource1).id 209 209 210 210 assert_template '_show_resources' 211 211 assert_valid assigns(:article) 212 212 assert_valid assigns(:resource) 213 assert !Article.find(art_id).resources.include?( Resource.find(1))213 assert !Article.find(art_id).resources.include?(resources(:resource1)) 214 214 assert_not_nil assigns(:article) 215 215 assert_not_nil assigns(:resource) trunk/test/functional/admin/feedback_controller_test.rb
r1620 r1621 29 29 assert_template 'list' 30 30 31 assert_equal(Feedback.count(:conditions => ['blog_id = 1 AND status_confirmed = ?', false]), 31 assert_equal(Feedback.count(:conditions => ['blog_id = ? AND status_confirmed = ?', 32 blogs(:default).id, false]), 32 33 assigns(:feedback).size) 33 34 … … 40 41 assert_template 'list' 41 42 42 assert_equal(Feedback.count(:conditions => ['blog_id = 1 AND published = ?', false]), 43 assert_equal(Feedback.count(:conditions => ['blog_id = ? AND published = ?', 44 blogs(:default).id, false]), 43 45 assigns(:feedback).size) 44 46 end … … 50 52 assert_template 'list' 51 53 52 assert_equal(Feedback.count(:conditions => ['blog_id = 1 AND published = ? AND status_confirmed = ?', false, false]), 54 assert_equal(Feedback.count(:conditions => ['blog_id = ? AND published = ? AND status_confirmed = ?', 55 blogs(:default).id, false, false]), 53 56 assigns(:feedback).size) 54 57 end trunk/test/functional/admin/resources_controller_test.rb
r1620 r1621 23 23 24 24 def test_destroy 25 assert_not_nil Resource.find(1) 25 res_id = resources(:resource1).id 26 assert_not_nil Resource.find(res_id) 26 27 27 get :destroy, :id => 128 get :destroy, :id => res_id 28 29 assert_response :success 29 30 assert_template 'destroy' 30 31 assert_not_nil assigns(:file) 31 32 32 post :destroy, :id => 133 post :destroy, :id => res_id 33 34 assert_response 302 34 35 follow_redirect trunk/test/functional/admin/textfilters_controller_test.rb
r1620 r1621 21 21 22 22 def test_edit_without_filters 23 post :edit, :id => 1, :textfilter => { :name => 'filterx',23 post :edit, :id => text_filters(:markdown_filter).id, :textfilter => { :name => 'filterx', 24 24 :description => 'Filter X', :markup => 'markdown' } 25 25 assert_response :redirect, :action => 'show' trunk/test/functional/admin/users_controller_test.rb
r1620 r1621 38 38 39 39 def test_show 40 get :show, :id => 140 get :show, :id => users(:tobi).id 41 41 assert_template 'show' 42 42 assert_valid assigns(:user) … … 47 47 48 48 def test_edit 49 get :edit, :id => 1 49 user_id = users(:tobi).id 50 get :edit, :id => user_id 50 51 assert_template 'edit' 51 52 assert_valid assigns(:user) 52 53 53 post :edit, :id => 1, :user => { :login => 'errand',54 post :edit, :id => user_id, :user => { :login => 'errand', 54 55 :email => 'corey@test.com', :password => 'testpass', 55 56 :password_confirmation => 'testpass' } … … 73 74 assert_equal user_count - 1, User.count 74 75 end 75 76 76 end trunk/test/unit/article_test.rb
r1620 r1621 45 45 a = Article.new 46 46 47 assert_equal( 1, a.blog_id)47 assert_equal(blogs(:default).id, a.blog_id) 48 48 assert_kind_of(Blog, a.blog) 49 49 end trunk/test/unit/comment_test.rb
r1620 r1621 148 148 149 149 def test_published 150 a = Article.new(:title => 'foo', :blog_id => 1)150 a = Article.new(:title => 'foo', :blog_id => blogs(:default).id) 151 151 assert a.save 152 152 trunk/test/unit/notification_mailer_test.rb
r1620 r1621 15 15 @controller = nil 16 16 @article = Article.find(contents(:article1).id) 17 @user = User.find(1)17 @user = users(:tobi) 18 18 19 19 @expected = TMail::Mail.new trunk/test/unit/resource_test.rb
r1620 r1621 56 56 assert !resources(:resource1).save 57 57 58 resources(:resource1).filename = Resource.find( 1).filename58 resources(:resource1).filename = Resource.find(resources(:resource1).id).filename 59 59 assert resources(:resource1).save 60 60 end trunk/test/unit/text_filter_test.rb
r1620 r1621 5 5 class TextFilterTest < Test::Unit::TestCase 6 6 def setup 7 @text_filter = TextFilter.find(1)7 @text_filter = text_filters(:markdown_filter) 8 8 end 9 9 trunk/test/unit/user_test.rb
r1620 r1621 8 8 9 9 def test_articles_link 10 assert_equal 8, User.find(1).articles.size11 assert_equal 7, User.find(1).articles.find_published.size12 assert_equal 7, User.find(1).articles.published.size10 assert_equal 7, users(:tobi).articles.size 11 assert_equal 6, users(:tobi).articles.find_published.size 12 assert_equal 6, users(:tobi).articles.published.size 13 13 14 articles = User.find(1).articles.published14 articles = users(:tobi).articles.published 15 15 assert_equal articles.sort_by { |a| a.created_at }.reverse, articles 16 16 17 articles = User.find(1).articles17 articles = users(:tobi).articles 18 18 assert_equal articles.sort_by { |a| a.created_at }.reverse, articles 19 19 end
