public
Rubygem
Fork of thoughtbot/shoulda
Description: Makes tests easy on the fingers and the eyes
Homepage: http://www.thoughtbot.com/projects/shoulda
Clone URL: git://github.com/technicalpickles/shoulda.git
Deprecated load_all_fixtures [#65]

 * Use `fixtures :all` instead
rmm5t (author)
Tue Sep 02 13:49:13 -0700 2008
commit  42d4de6e9747dbc74ce1e6b086fbb5b1a924ddb3
tree    776dacfbf087373ee544070c3671958603300752
parent  c2e908e58b255bd00b0a576254179cadb88d821c
...
48
49
50
51
 
52
53
54
...
60
61
62
63
64
65
66
67
...
48
49
50
 
51
52
53
54
...
60
61
62
 
 
63
64
65
0
@@ -48,7 +48,7 @@ So readable!
0
 Quick macro tests for your ActiveRecord associations and validations:
0
 
0
   class PostTest < Test::Unit::TestCase
0
- load_all_fixtures
0
+ fixtures :all
0
 
0
     should_belong_to :user
0
     should_have_many :tags, :through => :taggings
0
@@ -60,8 +60,6 @@ Quick macro tests for your ActiveRecord associations and validations:
0
   end
0
 
0
   class UserTest < Test::Unit::TestCase
0
- load_all_fixtures
0
-
0
     should_have_many :posts
0
 
0
     should_not_allow_values_for :email, "blah", "b lah"
...
22
23
24
 
25
26
27
28
29
 
 
30
31
32
...
22
23
24
25
26
 
 
 
 
27
28
29
30
31
0
@@ -22,11 +22,10 @@ module ThoughtBot # :nodoc:
0
       #
0
       module Macros
0
         # Loads all fixture files (<tt>test/fixtures/*.yml</tt>)
0
+ # Deprecated: Use <tt>fixtures :all</tt> instead
0
         def load_all_fixtures
0
- all_fixtures = Dir.glob(File.join(Test::Unit::TestCase.fixture_path, "*.yml")).collect do |f|
0
- File.basename(f, '.yml').to_sym
0
- end
0
- fixtures *all_fixtures
0
+ warn "[DEPRECATION] load_all_fixtures is deprecated. Use `fixtures :all` instead."
0
+ fixtures :all
0
         end
0
 
0
         # Ensures that the model cannot be saved if one of the attributes listed is not present.
...
12
13
14
15
 
16
17
18
...
12
13
14
 
15
16
17
18
0
@@ -12,7 +12,7 @@ module ThoughtBot # :nodoc:
0
       #
0
       # Example:
0
       # class UsersControllerTest < Test::Unit::TestCase
0
- # load_all_fixtures
0
+ # fixtures :all
0
       #
0
       # def setup
0
       # ...normal setup code...
...
5
6
7
8
 
9
10
11
...
25
26
27
28
 
29
30
31
32
33
34
35
 
36
37
38
...
5
6
7
 
8
9
10
11
...
25
26
27
 
28
29
30
31
32
33
34
 
35
36
37
38
0
@@ -5,7 +5,7 @@ require 'posts_controller'
0
 class PostsController; def rescue_action(e) raise e end; end
0
 
0
 class PostsControllerTest < Test::Unit::TestCase
0
- load_all_fixtures
0
+ fixtures :all
0
 
0
   def setup
0
     @controller = PostsController.new
0
@@ -25,14 +25,14 @@ class PostsControllerTest < Test::Unit::TestCase
0
       resource.denied.actions = [:index, :show, :edit, :new, :create, :update, :destroy]
0
       resource.denied.flash = /what/i
0
       resource.denied.redirect = '"/"'
0
- end
0
+ end
0
   end
0
 
0
   context "Logged in" do
0
     setup do
0
       @request.session[:logged_in] = true
0
     end
0
-
0
+
0
     should_be_restful do |resource|
0
       resource.parent = :user
0
 
...
5
6
7
8
 
9
10
11
...
21
22
23
24
 
25
26
27
 
28
29
30
31
 
32
33
34
 
35
36
...
5
6
7
 
8
9
10
11
...
21
22
23
 
24
25
26
 
27
28
29
30
 
31
32
33
 
34
35
36
0
@@ -5,7 +5,7 @@ require 'users_controller'
0
 class UsersController; def rescue_action(e) raise e end; end
0
 
0
 class UsersControllerTest < Test::Unit::TestCase
0
- load_all_fixtures
0
+ fixtures :all
0
 
0
   def setup
0
     @controller = UsersController.new
0
@@ -21,16 +21,16 @@ class UsersControllerTest < Test::Unit::TestCase
0
     resource.parent = []
0
     resource.actions = [:index, :show, :new, :edit, :update, :create, :destroy]
0
     resource.formats = [:html, :xml]
0
-
0
+
0
     resource.create.params = { :name => "bob", :email => 'bob@bob.com', :age => 13, :ssn => "123456789"}
0
     resource.update.params = { :name => "sue" }
0
-
0
+
0
     resource.create.redirect = "user_url(@user)"
0
     resource.update.redirect = "user_url(@user)"
0
     resource.destroy.redirect = "users_url"
0
-
0
+
0
     resource.create.flash = /created/i
0
     resource.update.flash = /updated/i
0
- resource.destroy.flash = /removed/i
0
+ resource.destroy.flash = /removed/i
0
   end
0
 end
...
1
2
3
4
 
 
5
6
7
8
9
10
 
11
...
1
2
3
 
4
5
6
7
 
 
8
 
9
10
0
@@ -1,11 +1,10 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
 class AddressTest < Test::Unit::TestCase
0
- load_all_fixtures
0
+ fixtures :all
0
+
0
   should_belong_to :addressable
0
   should_require_unique_attributes :title, :scoped_to => [:addressable_id, :addressable_type]
0
-
0
-
0
   should_ensure_length_at_least :zip, 5
0
- should_only_allow_numeric_values_for :zip
0
+ should_only_allow_numeric_values_for :zip
0
 end
...
1
2
3
4
5
6
7
...
1
2
3
 
4
5
6
0
@@ -1,7 +1,6 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
 class DogTest < Test::Unit::TestCase
0
- load_all_fixtures
0
   should_belong_to :user
0
   should_belong_to :address
0
   should_have_and_belong_to_many :fleas
...
1
2
3
4
5
6
7
...
1
2
3
 
4
5
6
0
@@ -1,7 +1,6 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
 class FleaTest < Test::Unit::TestCase
0
- load_all_fixtures
0
   should_have_and_belong_to_many :dogs
0
 end
0
 
...
1
2
3
4
 
5
6
7
8
9
10
 
11
12
13
...
1
2
3
 
4
5
6
7
8
9
 
10
11
12
13
0
@@ -1,13 +1,13 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
 class PostTest < Test::Unit::TestCase
0
- load_all_fixtures
0
+ fixtures :all
0
 
0
   should_belong_to :user
0
   should_belong_to :owner
0
   should_have_many :tags, :through => :taggings
0
   should_have_many :through_tags, :through => :taggings
0
-
0
+
0
   should_require_unique_attributes :title
0
   should_require_attributes :body, :message => /wtf/
0
   should_require_attributes :title
...
1
2
3
4
5
6
7
8
 
9
10
11
...
1
2
3
 
 
4
5
 
6
7
8
9
0
@@ -1,11 +1,9 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
 class TagTest < Test::Unit::TestCase
0
- load_all_fixtures
0
-
0
   should_have_many :taggings, :dependent => :destroy
0
   should_have_many :posts
0
-
0
+
0
   should_ensure_length_at_least :name, 2
0
 
0
   should_protect_attributes :secret
...
1
2
3
4
5
6
7
8
...
1
2
3
 
 
4
5
6
0
@@ -1,8 +1,6 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
 class TaggingTest < Test::Unit::TestCase
0
- load_all_fixtures
0
-
0
   should_belong_to :post
0
   should_belong_to :tag
0
 end
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
 class UserTest < Test::Unit::TestCase
0
- load_all_fixtures
0
+ fixtures :all
0
 
0
   should_have_many :posts
0
   should_have_many :dogs

Comments

    No one has commented yet.