Changeset 1621

Show
Ignore:
Timestamp:
01/10/08 07:33:40 (4 months ago)
Author:
pdcawley
Message:

More work on rejigging tests and fixtures to solely use symbolic ids for
fixtures. Also, removed the second blog from the test fixtures as a first
step towards getting the core back to one blog per database.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/models/category.rb

    r1526 r1621  
    7272 
    7373  def permalink_url(anchor=nil, only_path=true) 
    74     blog = Blog.find(1) # remove me... 
     74    blog = Blog.default # remove me... 
    7575 
    7676    blog.url_for( 
  • trunk/app/models/tag.rb

    r1533 r1621  
    6363 
    6464  def permalink_url(anchor=nil, only_path=true) 
    65     blog = Blog.find(1) # remove me... 
     65    blog = Blog.default # remove me... 
    6666 
    6767    blog.url_for( 
  • trunk/test/fixtures/blogs.yml

    r1614 r1621  
    11# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 
    22default: 
    3   id: 1 
    43  base_url: http://myblog.net 
    54  settings: 
     
    3736    comment_text_filter: markdown 
    3837    sp_allow_non_ajax_comments: true 
    39  
    40 second: 
    41   id: 2 
    42   base_url: http://otherblog.net 
    43   settings: 
    44     jabber_password: "" 
    45     show_extended_on_rss: true 
    46     itunes_owner: "" 
    47     blog_name: second test blog 
    48     title_prefix: 0 
    49     limit_article_display: 10 
    50     sp_url_limit: 0 
    51     use_gravatar: false 
    52     itunes_email: "" 
    53     blog_subtitle: "" 
    54     limit_rss_display: 10 
    55     itunes_explicit: false 
    56     ping_urls: |- 
    57       http://rpc.technorati.com/rpc/ping 
    58       http://ping.blo.gs/ 
    59       http://rpc.weblogs.com/RPC2 
    60     itunes_name: "" 
    61     geourl_location: "" 
    62     default_allow_pings: false 
    63     itunes_author: "" 
    64     send_outbound_pings: true 
    65     itunes_copyright: "" 
    66     sp_global: true 
    67     jabber_address: "" 
    68     default_allow_comments: true 
    69     itunes_subtitle: "" 
    70     email_from: scott@sigkill.org 
    71     theme: standard_issue 
    72     text_filter: "" 
    73     sp_article_auto_close: 0 
    74     link_to_author: false 
    75     itunes_summary: "" 
    76     comment_text_filter: "" 
    77     sp_allow_non_ajax_comments: true 
  • trunk/test/fixtures/contents.yml

    r1620 r1621  
    22 
    33article1: 
    4   blog_id: 1 
     4  blog: default 
    55  title: Article 1! 
    66  body: body 
     
    1212  allow_pings: true 
    1313  permalink: article-1 
    14   user_id: 1 
     14  user: tobi 
    1515  author: Tobi 
    1616  guid: a87c4220-18d4-11da-aadd-0002a5d5c51b 
     
    2222article2: 
    2323  type: Article 
    24   blog_id: 1 
     24  blog: default 
    2525  title: Article 2! 
    2626  body: body 
     
    3232  allow_pings: true 
    3333  permalink: article-2 
    34   user_id: 2 
     34  user: longbob 
    3535  author: Bob 
    3636  guid: bbbbb 
     
    4242article3: 
    4343  type: Article 
    44   blog_id: 1 
     44  blog: default 
    4545  title: Article 3! 
    4646  body: body 
     
    5252  allow_pings: true 
    5353  permalink: article-3 
    54   user_id: 1 
     54  user: tobi 
    5555  author: Tobi 
    5656  guid: ccccc 
     
    6060article4: 
    6161  type: Article 
    62   blog_id: 1 
     62  blog: default 
    6363  title: Article 4! 
    6464  body: I'm not "public":http://www.example.com/public! 
     
    7171  allow_pings: true 
    7272  permalink: article-4 
    73   user_id: 1 
     73  user: tobi 
    7474  author: Tobi 
    7575  guid: ddddd 
     
    7878first_page: 
    7979  type: Page 
    80   blog_id: 1 
     80  blog: default 
    8181  name: page_one 
    8282  title: Page One Title 
     
    8585  published_at: 2005-05-05 01:00:00 
    8686  updated_at: 2005-05-05 01:00:00 
    87   user_id: 1 
     87  user: tobi 
    8888  published: true 
    8989  state: published 
     
    9191another_page: 
    9292  type: Page 
    93   blog_id: 1 
     93  blog: default 
    9494  name: page/two 
    9595  title: Another Page Title 
     
    9898  created_at: 2005-05-05 01:00:00 
    9999  published_at: 2005-05-05 01:00:00 
    100   user_id: 1 
     100  user: tobi 
    101101  published: true 
    102102  state: published 
     
    104104markdown_page: 
    105105  type: Page 
    106   blog_id: 1 
     106  blog: default 
    107107  name: markdown-page 
    108108  title: Markdown Page 
    109   text_filter_id: 1 
     109  text_filter: markdown_filter 
    110110  body: this is *markdown*. 
    111111  created_at: 2005-05-05 01:00:00 
    112112  updated_at: 2005-05-05 01:00:00 
    113113  published_at: 2005-05-05 01:00:00 
    114   user_id: 1 
     114  user: tobi 
    115115  published: true 
    116116  state: published 
     
    118118inactive_article: 
    119119  type: Article 
    120   blog_id: 1 
     120  blog: default 
    121121  title: Inactive Article 
    122122  body: body 
     
    128128  allow_pings: true 
    129129  permalink: inactive-article 
    130   user_id: 1 
     130  user: tobi 
    131131  author: Tobi 
    132132  guid: i1n2a3c4t5i6v7e 
     
    134134  state: published 
    135135 
    136 second_blog_article: 
    137   type: Article 
    138   blog_id: 2 
    139   title: Second Blog Article 
    140   body: body 
    141   extended: extended content 
    142   allow_comments: true 
    143   allow_pings: true 
    144   permalink: second-blog-article 
    145   created_at: 2004-04-01 12:00:00 
    146   updated_at: 2004-04-01 12:00:00 
    147   published_at: 2004-04-01 12:00:00 
    148   user_id: 1 
    149   author: Tobi 
    150   guid: 2b1l0o6g4ar7 
    151   published: true 
    152   state: published 
    153  
    154136search_target: 
    155137  type: Article 
    156   blog_id: 1 
     138  blog: default 
    157139  title: Find me! 
    158140  body: search target 
     
    164146  updated_at: 2004-04-01 12:00:00 
    165147  published_at: 2004-04-01 12:00:00 
    166   user_id: 1 
     148  user: tobi 
    167149  author: Tobi 
    168150  guid: 2b1l0o6g4ar7 
     
    172154xmltest: 
    173155  type: Article 
    174   blog_id: 1 
     156  blog: default 
    175157  title: Associations aren't :dependent => true anymore 
    176158  body: originally seen on <a href="http://blog.rubyonrails.org/">blog.rubyonrails.org</a> 
     
    182164  updated_at: 2003-04-28 05:31:00 
    183165  published_at: 2003-04-28 05:31:00 
    184   user_id: 1 
     166  user: tobi 
    185167  author: Tobi 
    186168  guid: urn:uuid:0d676c66-4135-4a8b-9d65-b6a3248d3032 
     
    190172spammed_article: 
    191173  type: Article 
    192   blog_id: 1 
     174  blog: default 
    193175  title: C'mon Spam Me! 
    194176  body: A bunch of innocuous content 
     
    199181  updated_at: 2001-01-01 
    200182  published_at: 2001-01-01 
    201   user_id: 1 
     183  user: tobi 
    202184  author: Tobi 
    203185  guid: urn:uuid:0d676c66-4135-4a8b-9d65-b6a3248d3023 
  • trunk/test/fixtures/feedback.yml

    r1620 r1621  
    11spam_comment: 
    22  type: Comment 
    3   blog_id: 1 
     3  blog: default 
    44  published: true 
    55  article: article2 
     
    1515comment2: 
    1616  type: Comment 
    17   blog_id: 1 
     17  blog: default 
    1818  published: true 
    1919  article: article1 
    2020  author: John Bar 
    21   user_id: 2 
     21  user: longbob 
    2222  url: www.google.com 
    2323  email: john.bar@google.com 
     
    3131comment3: 
    3232  type: Comment 
    33   blog_id: 1 
     33  blog: default 
    3434  published: false 
    3535  state: presumed_spam 
     
    4545trackback1: 
    4646  type: Trackback 
    47   blog_id: 1 
     47  blog: default 
    4848  article: article2 
    4949  published: false 
     
    6161trackback2: 
    6262  type: Trackback 
    63   blog_id: 1 
     63  blog: default 
    6464  article: article1 
    6565  state: presumed_ham 
     
    7676trackback3: 
    7777  type: Trackback 
    78   blog_id: 1 
     78  blog: default 
    7979  article: article1 
    8080  published: true 
     
    9191trackback4: 
    9292  type: Trackback 
    93   blog_id: 1 
     93  blog: default 
    9494  article: search_target 
    9595  published: true 
     
    106106old_comment: 
    107107  type: Comment 
    108   blog_id: 1 
     108  blog: default 
    109109  article: inactive_article 
    110110  author: John Bar 
     
    121121probably_spam_comment: 
    122122  type: Comment 
    123   blog_id: 1 
     123  blog: default 
    124124  published: false 
    125125  article: spammed_article 
     
    136136definitely_spam_comment: 
    137137  type: Comment 
    138   blog_id: 1 
     138  blog: default 
    139139  published: false 
    140140  article: spammed_article 
  • trunk/test/fixtures/redirects.yml

    r986 r1621  
    11# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 
    22foo_redirect: 
    3   id: 1 
    43  from_path: foo/bar 
    54  to_path: /someplace/else 
    65archive1_redirect: 
    7   id: 2 
    86  from_path: archives/000001.html 
    97  to_path: /articles/read/1 
    108rooted_bar_redirect: 
    11   id: 3 
    129  from_path: bar/foo 
    1310  to_path: /blog/someplace/else 
  • trunk/test/fixtures/resources.yml

    r1620 r1621  
    11# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 
    22resource1: 
    3   id: 1 
    43  article: article1 
    54  filename: me.jpg 
     
    98 
    109resource2: 
    11   id: 2 
    1210  article: article1 
    1311  filename: moi 
     
    1715 
    1816resource3: 
    19   id: 3 
    2017  article: article2 
    2118  filename: my_latest_typo_patch.diff 
  • trunk/test/fixtures/sidebars.yml

    r1246 r1621  
    11# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 
    22static_sidebar: 
    3   id: 3 
    43  active_position: 1 
    54  staged_position: 1 
    6   blog_id: 1 
     5  blog: default 
    76  config: |+ 
    87    --- !map:HashWithIndifferentAccess 
  • trunk/test/fixtures/text_filters.yml

    r838 r1621  
    11# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 
    22markdown_filter: 
    3   id: 1 
    43  name: "markdown" 
    54  description: "Markdown" 
     
    98 
    109smartypants_filter: 
    11   id: 2 
    1210  name: "smartypants" 
    1311  description: "SmartyPants" 
     
    1816 
    1917markdownsmartypants_filter: 
    20   id: 3 
    2118  name: "markdown smartypants" 
    2219  description: "Markdown with SmartyPants" 
     
    2724 
    2825textile_filter: 
    29   id: 4 
    3026  name: "textile" 
    3127  description: "Textile" 
     
    3531 
    3632none_filter: 
    37    id: 5 
    3833   name: "none" 
    3934   description: "None" 
  • trunk/test/fixtures/users.yml

    r1608 r1621  
    22 
    33tobi: 
    4   id: 1 
    54  login: tobi 
    65  password: ea0f5fd4398054c1c7aa0fbc7aaea30914a14441 # whatever 
     
    1413 
    1514bob: 
    16   id: 2 
    1715  login: bob 
    1816  password: 9a91e1d8d95b6315991a88121bb0aa9f03ba0dfc # test 
     
    2624 
    2725existingbob: 
    28   id: 3 
    2926  login: existingbob 
    3027  password: 9a91e1d8d95b6315991a88121bb0aa9f03ba0dfc # test 
     
    3835 
    3936longbob: 
    40   id: 4 
    4137  login: longbob 
    4238  password: 8e9b1a9a38e66ca572a5e8fdac8e256848842dfa # longtest 
     
    5046 
    5147randomuser: 
    52   id: 5 
    5348  login: randomuser 
    5449  password: 8e9b1a9a38e66ca572a5e8fdac8e256848842dfa # longtest 
  • trunk/test/functional/admin/content_controller_test.rb

    r1620 r1621  
    193193  def test_resource_add 
    194194    art_id = contents(:article1).id 
    195     get :resource_add, :id => art_id, :resource_id => 1 
     195    get :resource_add, :id => art_id, :resource_id => resources(:resource1).id 
    196196 
    197197    assert_template '_show_resources' 
    198198    assert_valid assigns(:article) 
    199199    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)) 
    201201    assert_not_nil assigns(:article) 
    202202    assert_not_nil assigns(:resource) 
     
    206206  def test_resource_remove 
    207207    art_id = contents(:article1).id 
    208     get :resource_remove, :id => art_id, :resource_id => 1 
     208    get :resource_remove, :id => art_id, :resource_id => resources(:resource1).id 
    209209 
    210210    assert_template '_show_resources' 
    211211    assert_valid assigns(:article) 
    212212    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)) 
    214214    assert_not_nil assigns(:article) 
    215215    assert_not_nil assigns(:resource) 
  • trunk/test/functional/admin/feedback_controller_test.rb

    r1620 r1621  
    2929    assert_template 'list' 
    3030 
    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]), 
    3233                 assigns(:feedback).size) 
    3334 
     
    4041    assert_template 'list' 
    4142 
    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]), 
    4345                 assigns(:feedback).size) 
    4446  end 
     
    5052    assert_template 'list' 
    5153 
    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]), 
    5356                 assigns(:feedback).size) 
    5457  end 
  • trunk/test/functional/admin/resources_controller_test.rb

    r1620 r1621  
    2323 
    2424  def test_destroy 
    25     assert_not_nil Resource.find(1) 
     25    res_id = resources(:resource1).id 
     26    assert_not_nil Resource.find(res_id) 
    2627 
    27     get :destroy, :id => 1 
     28    get :destroy, :id => res_id 
    2829    assert_response :success 
    2930    assert_template 'destroy' 
    3031    assert_not_nil assigns(:file) 
    3132 
    32     post :destroy, :id => 1 
     33    post :destroy, :id => res_id 
    3334    assert_response 302 
    3435    follow_redirect 
  • trunk/test/functional/admin/textfilters_controller_test.rb

    r1620 r1621  
    2121 
    2222  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', 
    2424      :description => 'Filter X', :markup => 'markdown' } 
    2525    assert_response :redirect, :action => 'show' 
  • trunk/test/functional/admin/users_controller_test.rb

    r1620 r1621  
    3838 
    3939  def test_show 
    40     get :show, :id => 1 
     40    get :show, :id => users(:tobi).id 
    4141    assert_template 'show' 
    4242    assert_valid assigns(:user) 
     
    4747 
    4848  def test_edit 
    49     get :edit, :id => 1 
     49    user_id = users(:tobi).id 
     50    get :edit, :id => user_id 
    5051    assert_template 'edit' 
    5152    assert_valid assigns(:user) 
    5253 
    53     post :edit, :id => 1, :user => { :login => 'errand', 
     54    post :edit, :id => user_id, :user => { :login => 'errand', 
    5455      :email => 'corey@test.com', :password => 'testpass', 
    5556      :password_confirmation => 'testpass' } 
     
    7374    assert_equal user_count - 1, User.count 
    7475  end 
    75  
    7676end 
  • trunk/test/unit/article_test.rb

    r1620 r1621  
    4545    a = Article.new 
    4646 
    47     assert_equal(1, a.blog_id) 
     47    assert_equal(blogs(:default).id, a.blog_id) 
    4848    assert_kind_of(Blog, a.blog) 
    4949  end 
  • trunk/test/unit/comment_test.rb

    r1620 r1621  
    148148 
    149149  def test_published 
    150     a = Article.new(:title => 'foo', :blog_id => 1
     150    a = Article.new(:title => 'foo', :blog_id => blogs(:default).id
    151151    assert a.save 
    152152 
  • trunk/test/unit/notification_mailer_test.rb

    r1620 r1621  
    1515    @controller = nil 
    1616    @article = Article.find(contents(:article1).id) 
    17     @user = User.find(1
     17    @user = users(:tobi
    1818 
    1919    @expected = TMail::Mail.new 
  • trunk/test/unit/resource_test.rb

    r1620 r1621  
    5656    assert !resources(:resource1).save 
    5757 
    58     resources(:resource1).filename = Resource.find(1).filename 
     58    resources(:resource1).filename = Resource.find(resources(:resource1).id).filename 
    5959    assert resources(:resource1).save 
    6060  end 
  • trunk/test/unit/text_filter_test.rb

    r1620 r1621  
    55class TextFilterTest < Test::Unit::TestCase 
    66  def setup 
    7     @text_filter = TextFilter.find(1
     7    @text_filter = text_filters(:markdown_filter
    88  end 
    99 
  • trunk/test/unit/user_test.rb

    r1620 r1621  
    88 
    99  def test_articles_link 
    10     assert_equal 8, User.find(1).articles.size 
    11     assert_equal 7, User.find(1).articles.find_published.size 
    12     assert_equal 7, User.find(1).articles.published.size 
     10    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 
    1313 
    14     articles = User.find(1).articles.published 
     14    articles = users(:tobi).articles.published 
    1515    assert_equal articles.sort_by { |a| a.created_at }.reverse, articles 
    1616 
    17     articles = User.find(1).articles 
     17    articles = users(:tobi).articles 
    1818    assert_equal articles.sort_by { |a| a.created_at }.reverse, articles 
    1919  end