Changeset 1620

Show
Ignore:
Timestamp:
01/10/08 03:20:58 (4 months ago)
Author:
pdcawley
Message:

Giving tests and fixtures some love.

Moving from explicit ids throughout the fixtures and many of the tests to taking
advantage of the new fixture capabilities in Rails 2.

We're now loading _all_ the fixtures from test_helper, which should hopefully
reduce problems we've been experiencing with test ordering, which is nice.

Eventually, I intend to move to using pre_loaded_fixtures - loading the fixtures
up as part of the initial rake task, and then letting transactional rollback
stuff deal with the rest.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/test/fixtures/blacklist_patterns.yml

    r178 r1620  
    11# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 
    22first_blacklist_pattern: 
    3   id: 1 
    43  type: StringPattern 
    54  pattern: poker 
    65 
    76another_blacklist_pattern: 
    8   id: 2 
    97  type: RegexPattern 
    108  pattern: ^Texas 
  • trunk/test/fixtures/categories.yml

    r1031 r1620  
    11software: 
    2   id: 1 
    32  name: Software 
    43  permalink: software 
     
    65 
    76hardware: 
    8   id: 2 
    97  name: Hardware 
    108  permalink: hardware 
     
    1210 
    1311personal: 
    14   id: 3 
    1512  name: Personal 
    1613  permalink: personal 
     
    1815 
    1916lifeonmars: 
    20   id: 4 
    2117  name: Life On Mars 
    2218  permalink: life-on-mars 
     
    2420 
    2521strangelynamed: 
    26   id: 5 
    2722  name: "The Permalink doesn't match" 
    2823  permalink: weird-permalink 
     
    3025 
    3126xmltest: 
    32   id: 6 
    3327  name: "this & that" 
    3428  permalink: this-and-that 
  • trunk/test/fixtures/categorizations.yml

    r1300 r1620  
    11articles_categories1: 
    2   article_id:
    3   category_id: 1 
     2  article: article
     3  category: software 
    44 
    55articles_categories2: 
    6   article_id:
    7   category_id: 2 
     6  article: article
     7  category: hardware 
    88 
    99articles_categories3: 
    10   article_id:
    11   category_id: 3 
     10  article: article
     11  category: personal 
    1212 
    1313articles_categories4: 
    14   article_id: 2  
    15   category_id: 3 
     14  article: article2 
     15  category: personal 
    1616 
    1717articles_categories5: 
    18   article_id:
    19   category_id: 3 
    20    
     18  article: article
     19  category: personal 
     20 
    2121articles_categories6: 
    22   article_id:
    23   category_id: 3 
     22  article: article
     23  category: personal 
    2424 
    2525articles_categories7: 
    26   article_id:
    27   category_id: 5 
     26  article: article
     27  category: strangelynamed 
    2828 
    2929articles_categories8: 
    30   article_id: 18 
    31   category_id: 6 
     30  article: xmltest 
     31  category: xmltest 
  • trunk/test/fixtures/contents.yml

    r1480 r1620  
    33article1: 
    44  blog_id: 1 
    5   id: 1 
    65  title: Article 1! 
    76  body: body 
     
    1918  published: true 
    2019  state: published 
     20  tags: foo, bar 
    2121 
    2222article2: 
    2323  type: Article 
    2424  blog_id: 1 
    25   id: 2 
    2625  title: Article 2! 
    2726  body: body 
     
    3837  published: true 
    3938  state: published 
     39  tags: foo 
    4040 
    4141 
     
    4343  type: Article 
    4444  blog_id: 1 
    45   id: 3 
    4645  title: Article 3! 
    4746  body: body 
     
    6261  type: Article 
    6362  blog_id: 1 
    64   id: 4 
    6563  title: Article 4! 
    6664  body: I'm not "public":http://www.example.com/public! 
     
    7674  author: Tobi 
    7775  guid: ddddd 
     76  tags: bar, bazz 
    7877 
    7978first_page: 
    8079  type: Page 
    8180  blog_id: 1 
    82   id: 9 
    8381  name: page_one 
    8482  title: Page One Title 
     
    9492  type: Page 
    9593  blog_id: 1 
    96   id: 10 
    9794  name: page/two 
    9895  title: Another Page Title 
     
    108105  type: Page 
    109106  blog_id: 1 
    110   id: 11 
    111107  name: markdown-page 
    112108  title: Markdown Page 
     
    123119  type: Article 
    124120  blog_id: 1 
    125   id: 14 
    126121  title: Inactive Article 
    127122  body: body 
     
    142137  type: Article 
    143138  blog_id: 2 
    144   id: 16 
    145139  title: Second Blog Article 
    146140  body: body 
     
    161155  type: Article 
    162156  blog_id: 1 
    163   id: 17 
    164157  title: Find me! 
    165158  body: search target 
     
    180173  type: Article 
    181174  blog_id: 1 
    182   id: 18 
    183175  title: Associations aren't :dependent => true anymore 
    184176  body: originally seen on <a href="http://blog.rubyonrails.org/">blog.rubyonrails.org</a> 
     
    199191  type: Article 
    200192  blog_id: 1 
    201   id: 19 
    202193  title: C'mon Spam Me! 
    203194  body: A bunch of innocuous content 
  • trunk/test/fixtures/feedback.yml

    r1438 r1620  
    22  type: Comment 
    33  blog_id: 1 
    4   id: 1 
    54  published: true 
    6   article_id:
     5  article: article
    76  author: Bob Foo 
    87  url: http://fakeurl.com 
     
    1716  type: Comment 
    1817  blog_id: 1 
    19   id: 2 
    2018  published: true 
    21   article_id:
     19  article: article
    2220  author: John Bar 
    2321  user_id: 2 
     
    3432  type: Comment 
    3533  blog_id: 1 
    36   id: 3 
    3734  published: false 
    3835  state: presumed_spam 
    3936  status_confirmed: false 
    40   article_id:
     37  article: article
    4138  author: Foo Bar 
    4239  body: Zzzzzz 
     
    4946  type: Trackback 
    5047  blog_id: 1 
    51   id: 4 
    52   article_id: 2 
     48  article: article2 
    5349  published: false 
    5450  state: presumed_spam 
     
    6662  type: Trackback 
    6763  blog_id: 1 
    68   id: 5 
    69   article_id: 1 
     64  article: article1 
    7065  state: presumed_ham 
    7166  published: true 
     
    8277  type: Trackback 
    8378  blog_id: 1 
    84   id: 6 
    85   article_id: 1 
     79  article: article1 
    8680  published: true 
    8781  state: presumed_ham 
     
    9892  type: Trackback 
    9993  blog_id: 1 
    100   id: 7 
    101   article_id: 17 
     94  article: search_target 
    10295  published: true 
    10396  state: presumed_ham 
     
    114107  type: Comment 
    115108  blog_id: 1 
    116   id: 8 
    117   article_id: 14 
     109  article: inactive_article 
    118110  author: John Bar 
    119111  guid: b1i2n3g4o5t6i7v 
     
    130122  type: Comment 
    131123  blog_id: 1 
    132   id: 9 
    133124  published: false 
    134   article_id: 19 
     125  article: spammed_article 
    135126  author: Bob Foo 
    136127  url: http://fakeurl.com 
     
    146137  type: Comment 
    147138  blog_id: 1 
    148   id: 10 
    149139  published: false 
    150   article_id: 19 
     140  article: spammed_article 
    151141  author: Bob Foo 
    152142  url: http://fakeurl.com 
  • trunk/test/fixtures/resources.yml

    r1031 r1620  
    22resource1: 
    33  id: 1 
    4   article_id:
     4  article: article
    55  filename: me.jpg 
    66  mime: 'image/jpeg' 
     
    1010resource2: 
    1111  id: 2 
    12   article_id:
     12  article: article
    1313  filename: moi 
    1414  mime: 'image/jpeg' 
     
    1818resource3: 
    1919  id: 3 
    20   article_id:
     20  article: article
    2121  filename: my_latest_typo_patch.diff 
    2222  mime: 'text/plain' 
  • trunk/test/fixtures/tags.yml

    r858 r1620  
    11# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 
    2 foo_tag: 
    3   id: 1 
     2foo: 
    43  name: foo 
    54  display_name: foo 
    6 bar_tag: 
    7   id: 2 
     5bar: 
    86  name: bar 
    97  display_name: bar 
    10 bazz_tag: 
    11   id: 3 
     8bazz: 
    129  name: bazz 
    1310  display_name: bazz 
  • trunk/test/functional/accounts_controller_test.rb

    r1516 r1620  
    99 
    1010class AccountsControllerTest < Test::Unit::TestCase 
    11  
    12   fixtures :users, :blogs 
    1311 
    1412  def setup 
  • trunk/test/functional/admin/article_preview_test.rb

    r1516 r1620  
    77 
    88class Admin::ArticlePreviewTest < Test::Unit::TestCase 
    9   fixtures :contents, :users, :categories, :resources, :text_filters, :blogs 
    10  
    119  def setup 
    1210    @controller = Admin::ContentController.new 
  • trunk/test/functional/admin/blacklist_controller_test.rb

    r1516 r1620  
    66 
    77class Admin::BlacklistControllerTest < Test::Unit::TestCase 
    8   fixtures :blacklist_patterns, :users 
    9  
    108  def setup 
    119    @controller = Admin::BlacklistController.new 
     
    3735 
    3836  def test_edit 
    39     get :edit, 'id' => 1 
     37    get :edit, 'id' => blacklist_patterns(:first_blacklist_pattern).id 
    4038    assert_template 'edit' 
    4139    assert_template_has('blacklist_pattern') 
     
    4442 
    4543  def test_update 
    46     post :edit, 'id' => 1 
     44    post :edit, 'id' => blacklist_patterns(:first_blacklist_pattern).id 
    4745    assert_response :redirect, :action => 'list' 
    4846  end 
    4947 
    5048  def test_destroy 
    51     assert_not_nil BlacklistPattern.find(1) 
     49    pattern_id = blacklist_patterns(:first_blacklist_pattern).id 
     50    assert_not_nil BlacklistPattern.find(pattern_id) 
    5251 
    53     get :destroy, 'id' => 1 
     52    get :destroy, 'id' => pattern_id 
    5453    assert_response :success 
    5554 
    56     post :destroy, 'id' => 1 
     55    post :destroy, 'id' => pattern_id 
    5756    assert_response :redirect, :action => 'list' 
    5857 
    5958    assert_raise(ActiveRecord::RecordNotFound) { 
    60       blacklist_pattern = BlacklistPattern.find(1
     59      blacklist_pattern = BlacklistPattern.find(pattern_id
    6160    } 
    6261  end 
  • trunk/test/functional/admin/categories_controller_test.rb

    r1577 r1620  
    66 
    77class Admin::CategoriesControllerTest < Test::Unit::TestCase 
    8   fixtures :categories, :users 
    9  
    108  def setup 
    119    @controller = Admin::CategoriesController.new 
     
    3129 
    3230  def test_show 
    33     get :show, 'id' => 1 
     31    get :show, 'id' => categories(:software).id 
    3432    assert_template 'show' 
    3533    assert_template_has 'category' 
     
    4745 
    4846  def test_edit 
    49     get :edit, :id => 1 
     47    get :edit, :id => categories(:software).id 
    5048    assert_template 'edit' 
    5149    assert_template_has 'category' 
     
    5452 
    5553  def test_update 
    56     post :edit, :id => 1 
     54    post :edit, :id => categories(:software).id 
    5755    assert_response :redirect, :action => 'list' 
    5856  end 
    5957 
    6058  def test_destroy 
    61     assert_not_nil Category.find(1) 
     59    test_id = categories(:software).id 
     60    assert_not_nil Category.find(test_id) 
    6261 
    63     get :destroy, :id => 1 
     62    get :destroy, :id => test_id 
    6463    assert_response :success 
    6564    assert_template 'destroy' 
    6665 
    67     post :destroy, :id => 1 
     66    post :destroy, :id => test_id 
    6867    assert_response :redirect, :action => 'list' 
    6968 
    70     assert_raise(ActiveRecord::RecordNotFound) { Category.find(1) } 
     69    assert_raise(ActiveRecord::RecordNotFound) { Category.find(test_id) } 
    7170  end 
    7271 
  • trunk/test/functional/admin/comments_controller_test.rb

    r1516 r1620  
    77 
    88class Admin::CommentsControllerTest < Test::Unit::TestCase 
    9   fixtures :contents, :feedback, :users, :notifications, :blogs, :blacklist_patterns 
    10  
    119  def setup 
    1210    @controller = Admin::CommentsController.new 
     
    1513 
    1614    @request.session = { :user_id => users(:tobi).id } 
     15    @art_id = contents(:article2).id 
    1716  end 
    1817 
    1918  def test_index 
    20     get :index, :article_id => 2 
     19    get :index, :article_id => @art_id 
    2120    assert_template 'list' 
    2221  end 
    2322 
    2423  def test_list 
    25     get :list, :article_id => 2 
     24    get :list, :article_id => @art_id 
    2625    assert_template 'list' 
    2726    assert_template_has 'comments' 
     
    2928 
    3029  def test_show 
    31     get :show, :id => feedback(:spam_comment).id, :article_id => 2 
     30    get :show, :id => feedback(:spam_comment).id, :article_id => @art_id 
    3231    assert_template 'show' 
    3332    assert_template_has 'comment' 
     
    3635 
    3736  def test_new 
    38     get :new, :article_id => 2 
     37    get :new, :article_id => @art_id 
    3938    assert_template 'new' 
    4039    assert_template_has 'comment' 
     
    4544 
    4645    post(:new, :comment => { 'author' => 'author', 'body' => 'body' }, 
    47                :article_id => 2
     46               :article_id => @art_id
    4847    assert_response :redirect, :action => 'show' 
    4948 
     
    5251 
    5352  def test_edit 
    54     get :edit, :id => feedback(:spam_comment).id, :article_id => 2 
     53    get :edit, :id => feedback(:spam_comment).id, :article_id => @art_id 
    5554    assert_template 'edit' 
    5655    assert_template_has 'comment' 
     
    5958 
    6059  def test_update 
    61     post :edit, :id => feedback(:spam_comment).id, :article_id => 2 
     60    post :edit, :id => feedback(:spam_comment).id, :article_id => @art_id 
    6261    assert_response :redirect, :action => 'show', :id => feedback(:spam_comment).id 
    6362  end 
     
    6665    assert_not_nil Comment.find(feedback(:spam_comment).id) 
    6766 
    68     get :destroy, :id => feedback(:spam_comment).id, :article_id => 2 
     67    get :destroy, :id => feedback(:spam_comment).id, :article_id => @art_id 
    6968    assert_response :success 
    7069 
    71     post :destroy, :id => feedback(:spam_comment).id, :article_id => 2 
     70    post :destroy, :id => feedback(:spam_comment).id, :article_id => @art_id 
    7271    assert_response :redirect, :action => 'list' 
    7372 
  • trunk/test/functional/admin/content_controller_test.rb

    r1602 r1620  
    88 
    99class Admin::ContentControllerTest < Test::Unit::TestCase 
    10   fixtures :contents, :feedback, :users, :categories, :resources, :text_filters, 
    11            :blogs, :categorizations 
    12  
    1310  def setup 
    1411    @controller = Admin::ContentController.new 
     
    3027 
    3128  def test_show 
    32     get :show, 'id' => 1 
     29    get :show, 'id' => contents(:article1).id 
    3330    assert_template 'show' 
    3431    assert_template_has 'article' 
     
    4946                              :keywords => "tagged", 
    5047                              :allow_comments => '0', :allow_pings => '1' }, 
    51                'categories' => [1]) 
     48               'categories' => [categories(:software).id]) 
    5249    assert !assigns(:article).allow_comments? 
    5350    assert  assigns(:article).allow_pings? 
     
    5956                              :keywords => "tagged", 
    6057                              :allow_comments => '1', :allow_pings => '0' }, 
    61                'categories' => [1]) 
     58               'categories' => [categories(:software).id]) 
    6259    assert  assigns(:article).allow_comments? 
    6360    assert !assigns(:article).allow_pings? 
     
    7168    emails = ActionMailer::Base.deliveries 
    7269    tags = ['foo', 'bar', 'baz bliz', 'gorp gack gar'] 
    73     post :new, 'article' => { :title => "posted via tests!", :body => "Foo", :keywords => "foo bar 'baz bliz' \"gorp gack gar\""}, 'categories' => [1
     70    post :new, 'article' => { :title => "posted via tests!", :body => "Foo", :keywords => "foo bar 'baz bliz' \"gorp gack gar\""}, 'categories' => [categories(:software).id
    7471    assert_response :redirect, :action => 'show' 
    7572 
     
    7976    assert_equal users(:tobi), new_article.user 
    8077    assert_equal 1, new_article.categories.size 
    81     assert_equal [1], new_article.categories.collect {|c| c.id} 
     78    assert_equal [categories(:software)], new_article.categories 
    8279    assert_equal 4, new_article.tags.size 
    8380 
     
    126123 
    127124  def test_edit 
    128     get :edit, 'id' => 1 
    129     assert_equal assigns(:selected), Article.find(1).categories.collect {|c| c.id} 
     125    get :edit, 'id' => contents(:article1).id 
     126    assert_equal assigns(:selected), contents(:article1).categories.collect {|c| c.id} 
    130127    assert_template 'edit' 
    131128    assert_template_has 'article' 
     
    138135    emails.clear 
    139136 
     137    art_id = contents(:article1).id 
     138 
    140139    body = "another *textile* test" 
    141     post :edit, 'id' => 1, 'article' => {:body => body, :text_filter => 'textile'} 
    142     assert_response :redirect, :action => 'show', :id => 1 
    143  
    144     article = Article.find(1) 
     140    post :edit, 'id' => art_id, 'article' => {:body => body, :text_filter => 'textile'} 
     141    assert_response :redirect, :action => 'show', :id => art_id 
     142 
     143    article = contents(:article1).reload 
    145144    assert_equal "textile", article.text_filter.name 
    146145    assert_equal body, article.body 
     
    152151 
    153152  def test_destroy 
    154     assert_not_nil Article.find(1) 
    155  
    156     get :destroy, 'id' => 1 
     153    art_id = contents(:article1).id 
     154    assert_not_nil Article.find(art_id) 
     155 
     156    get :destroy, 'id' => art_id 
    157157    assert_response :success 
    158158 
    159     post :destroy, 'id' => 1 
     159    post :destroy, 'id' => art_id 
    160160    assert_response :redirect, :action => 'list' 
    161161 
    162162    assert_raise(ActiveRecord::RecordNotFound) { 
    163       article = Article.find(1
     163      article = Article.find(art_id
    164164    } 
    165165  end 
    166166 
    167167  def test_category_add 
    168     get :category_add, :id => 1, :category_id => 1 
     168    art_id = contents(:article1).id 
     169    get :category_add, :id => art_id, :category_id => categories(:software).id 
    169170 
    170171    assert_template '_show_categories' 
    171172    assert_valid assigns(:article) 
    172173    assert_valid assigns(:category) 
    173     assert Article.find(1).categories.include?(Category.find(1)) 
     174    assert Article.find(art_id).categories.include?(categories(:software)) 
    174175    assert_not_nil assigns(:article) 
    175176    assert_not_nil assigns(:category) 
     
    178179 
    179180  def test_category_remove 
    180     get :category_remove, :id => 1, :category_id => 1 
     181    art_id = contents(:article1).id 
     182    get :category_remove, :id => art_id, :category_id => categories(:software).id 
    181183 
    182184    assert_template '_show_categories' 
    183185    assert_valid assigns(:article) 
    184186    assert_valid assigns(:category) 
    185     assert !Article.find(1).categories.include?(Category.find(1)) 
     187    assert !Article.find(art_id).categories.include?(categories(:software)) 
    186188    assert_not_nil assigns(:article) 
    187189    assert_not_nil assigns(:category) 
     
    190192 
    191193  def test_resource_add 
    192     get :resource_add, :id => 1, :resource_id => 1 
     194    art_id = contents(:article1).id 
     195    get :resource_add, :id => art_id, :resource_id => 1 
    193196 
    194197    assert_template '_show_resources' 
    195198    assert_valid assigns(:article) 
    196199    assert_valid assigns(:resource) 
    197     assert Article.find(1).resources.include?(Resource.find(1)) 
     200    assert Article.find(art_id).resources.include?(Resource.find(1)) 
    198201    assert_not_nil assigns(:article) 
    199202    assert_not_nil assigns(:resource) 
     
    202205 
    203206  def test_resource_remove 
    204     get :resource_remove, :id => 1, :resource_id => 1 
     207    art_id = contents(:article1).id 
     208    get :resource_remove, :id => art_id, :resource_id => 1 
    205209 
    206210    assert_template '_show_resources' 
    207211    assert_valid assigns(:article) 
    208212    assert_valid assigns(:resource) 
    209     assert !Article.find(1).resources.include?(Resource.find(1)) 
     213    assert !Article.find(art_id).resources.include?(Resource.find(1)) 
    210214    assert_not_nil assigns(:article) 
    211215    assert_not_nil assigns(:resource) 
  • trunk/test/functional/admin/feedback_controller_test.rb

    r1516 r1620  
    88 
    99class Admin::FeedbackControllerTest < Test::Unit::TestCase 
    10   fixtures :contents, :users, :resources, :text_filters, 
    11            :blogs, :categorizations, :feedback, :blacklist_patterns, :categories 
    12  
    1310  def setup 
    1411    @controller = Admin::FeedbackController.new 
  • trunk/test/functional/admin/pages_controller_test.rb

    r1516 r1620  
    66 
    77class Admin::PagesControllerTest < Test::Unit::TestCase 
    8   fixtures :contents, :users, :text_filters, :blogs 
    9  
    108  def setup 
    119    @controller = Admin::PagesController.new 
  • trunk/test/functional/admin/resources_controller_test.rb

    r1516 r1620  
    66 
    77class Admin::ResourcesControllerTest < Test::Unit::TestCase 
    8   fixtures :users, :resources 
    9  
    108  def setup 
    119    @controller = Admin::ResourcesController.new 
  • trunk/test/functional/admin/settings_controller_test.rb

    r1611 r1620  
    66 
    77class Admin::SettingsControllerTest < Test::Unit::TestCase 
    8   fixtures :users 
    9  
    108  def setup 
    119    @controller = Admin::SettingsController.new 
  • trunk/test/functional/admin/textfilters_controller_test.rb

    r1516 r1620  
    66 
    77class Admin::TextfiltersControllerTest < Test::Unit::TestCase 
    8   fixtures :text_filters, :users 
    9  
    108  def setup 
    119    @controller = Admin::TextfiltersController.new 
  • trunk/test/functional/admin/themes_controller_test.rb

    r1570 r1620  
    66 
    77class Admin::ThemesControllerTest < Test::Unit::TestCase 
    8   fixtures :users 
    9  
    108  def setup 
    119    @controller = Admin::ThemesController.new 
  • trunk/test/functional/admin/trackbacks_controller_test.rb

    r1516 r1620  
    66 
    77class Admin::TrackbacksControllerTest < Test::Unit::TestCase 
    8   fixtures :contents, :feedback, :users 
    9  
    108  def setup 
    119    @controller = Admin::TrackbacksController.new 
     
    1412 
    1513    @request.session = { :user_id => users(:tobi).id } 
     14    @art_id = contents(:article2).id 
    1615  end 
    1716 
    1817  def test_index 
    19     get :index, :article_id => 2 
     18    get :index, :article_id => @art_id 
    2019    assert_template 'list' 
    2120  end 
    2221 
    2322  def test_list 
    24     get :list, :article_id => 2 
     23    get :list, :article_id => @art_id 
    2524    assert_template 'list' 
    2625    assert_template_has 'trackbacks' 
     
    2827 
    2928  def test_show 
    30     get :show, :id => feedback(:trackback1).id, :article_id => 2 
     29    get :show, :id => feedback(:trackback1).id, :article_id => @art_id 
    3130    assert_template 'show' 
    3231    assert_template_has 'trackback' 
     
    3534 
    3635  def test_new 
    37     get :new, :article_id => 2 
     36    get :new, :article_id => @art_id 
    3837    assert_template 'new' 
    3938    assert_template_has 'trackback' 
     
    4342    num_trackbacks = Trackback.count 
    4443 
    45     post :new, :trackback => { 'title' => 'title', 'excerpt' => 'excerpt', 'blog_name' => 'blog_name', 'url' => 'url' }, :article_id => 2 
     44    post :new, :trackback => { 'title' => 'title', 'excerpt' => 'excerpt', 'blog_name' => 'blog_name', 'url' => 'url' }, :article_id => @art_id 
    4645    assert_response :redirect, :action => 'show' 
    4746 
     
    5049 
    5150  def test_edit 
    52     get :edit, :id => feedback(:trackback1).id, :article_id => 2 
     51    get :edit, :id => feedback(:trackback1).id, :article_id => @art_id 
    5352    assert_template 'edit' 
    5453    assert_template_has 'trackback' 
     
    5756 
    5857  def test_update 
    59     post :edit, :id => feedback(:trackback1).id, :article_id => 2 
     58    post :edit, :id => feedback(:trackback1).id, :article_id => @art_id 
    6059    assert_response :redirect, :action => 'show', :id => feedback(:trackback1).id 
    6160  end 
     
    6463    assert_not_nil Trackback.find(feedback(:trackback1).id) 
    6564 
    66     get :destroy, :id => feedback(:trackback1).id, :article_id => 2 
     65    get :destroy, :id => feedback(:trackback1).id, :article_id => @art_id 
    6766    assert_response :success 
    6867 
    69     post :destroy, :id => feedback(:trackback1).id, :article_id => 2 
     68    post :destroy, :id => feedback(:trackback1).id, :article_id => @art_id 
    7069    assert_response :redirect, :action => 'list' 
    7170 
  • trunk/test/functional/admin/users_controller_test.rb

    r1516 r1620  
    66 
    77class Admin::UsersControllerTest < Test::Unit::TestCase 
    8   fixtures :users, :blogs, :profiles 
    9  
    108  def setup 
    119    @controller = Admin::UsersController.new 
  • trunk/test/functional/articles_controller_test.rb

    r1614 r1620  
    1818 
    1919class ArticlesControllerTest < Test::Unit::TestCase 
    20   fixtures :contents, :feedback, :categories, :blogs, :users, :categorizations, :text_filters, :articles_tags, :tags 
    2120  include ArticlesHelper 
    2221 
     
    136135 
    137136  def test_show_non_published 
    138     show_article(Article.find(4)) 
     137    show_article(contents(:article4)) 
    139138    assert_response 404 
    140139    assert_template "error" 
     
    143142  def test_gravatar 
    144143    assert ! this_blog.use_gravatar 
    145     show_article(Article.find(1)) 
     144    show_article(contents(:article1)) 
    146145    assert_response :success 
    147146    assert_template "read" 
     
    153152    @controller = ArticlesController.new 
    154153    assert this_blog.use_gravatar 
    155     show_article(Article.find(1)) 
     154    show_article(contents(:article1)) 
    156155    assert_response :success 
    157156    assert_template "read" 
     
    219218 
    220219  def test_autodiscovery_article 
    221     show_article(Article.find(1)) 
     220    show_article(contents(:article1)) 
    222221    assert_response :success 
    223222 
     
    225224      assert_select '[rel=alternate]' 
    226225      assert_select '[type=application/rss+xml]' 
    227       assert_select '[href=?]', formatted_article_url(Article.find(1), 'rss') 
     226      assert_select '[href=?]', formatted_article_url(contents(:article1), 'rss') 
    228227    end 
    229228    assert_select 'link[title=Atom]' do 
    230229      assert_select '[rel=alternate]' 
    231230      assert_select '[type=application/atom+xml]' 
    232       assert_select '[href=?]', formatted_article_url(Article.find(1), 'atom') 
     231      assert_select '[href=?]', formatted_article_url(contents(:article1), 'atom') 
    233232    end 
    234233  end 
  • trunk/test/functional/backend_controller_test.rb

    r1552 r1620  
    1111class BackendControllerTest < Test::Unit::TestCase 
    1212  include FlexMock::TestCase 
    13   fixtures :contents, :categories, :blogs, :users, :categorizations, :text_filters, :blacklist_patterns, :feedback, :tags, :articles_tags, :notifications, :resources, :triggers 
    1413 
    1514  def setup 
     
    2120  # BloggerApi Tests 
    2221  def test_blogger_delete_post 
    23     args = [ 'foo', 3, 'tobi', 'whatever', 1 ] 
     22    args = [ 'foo', contents(:article3).id, 'tobi', 'whatever', 1 ] 
    2423 
    2524    result = invoke_layered :blogger, :deletePost, *args 
    26     assert_raise(ActiveRecord::RecordNotFound) { Article.find(3) } 
     25    assert_raise(ActiveRecord::RecordNotFound) { Article.find(contents(:article3).id) } 
    2726  end 
    2827 
     
    106105 
    107106  def test_meta_weblog_get_post