public
Description: FixtureReplacement rails plugin (version 2 and on)
Homepage: http://replacefixtures.rubyforge.org/
Clone URL: git://github.com/smtlaissezfaire/fixturereplacement.git
this should be a bug fix which fixes the terrible bug of missing methods 
in FR

git-svn-id: http://thmadb.com/public_svn/plugins/fixture_replacement2@254 
6dbbdfbd-06da-443d-8068-b1bdd22a71ef
smt (author)
Sat Jan 12 16:05:45 -0800 2008
commit  1190688a1e44bb258ed255adf522c00d1705cf93
tree    3c4d99f68635b9f6235195f35b4c475793ec6559
parent  f2c7f9355ccd330e3f7e1526affeeffc6cf7bf78
...
36
37
38
 
 
 
 
39
40
41
...
36
37
38
39
40
41
42
43
44
45
0
@@ -36,6 +36,10 @@ module FixtureReplacement
0
       FixtureReplacementController::MethodGenerator.generate_methods
0
       call_after_include_if_exists
0
     end
0
+
0
+ def method_added(method)
0
+ module_function method if method != :method_added
0
+ end
0
 
0
   private
0
   
...
4
5
6
7
 
 
 
8
9
10
 
11
12
13
...
18
19
20
21
22
 
 
23
 
 
 
 
 
24
 
 
 
 
 
25
26
27
28
29
30
31
32
33
34
35
36
37
 
 
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
40
41
...
4
5
6
 
7
8
9
10
11
 
12
13
14
15
...
20
21
22
 
 
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
 
 
 
 
 
 
 
 
 
 
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
0
@@ -4,10 +4,12 @@ module FixtureReplacementController
0
   describe Attributes do
0
     before :each do
0
       @module = Module.new do
0
- extend FixtureReplacement::ClassMethods
0
+ class << self
0
+ include FixtureReplacement::ClassMethods
0
+ end
0
         
0
         attributes_for :user do |u|
0
- u.username = String.random
0
+ u.username = random_string
0
           u.key = String.random
0
         end
0
 
0
@@ -18,23 +20,48 @@ module FixtureReplacementController
0
         attributes_for :admin do |a|
0
           a.admin_status = true
0
         end
0
- end
0
- extend @module
0
+
0
+ private
0
       
0
+ def random_string
0
+ String.random
0
+ end
0
+ end
0
+
0
       FixtureReplacementController::MethodGenerator.generate_methods(@module)
0
+ self.class.send :include, @module
0
+ end
0
+
0
+ it "should have the username as a string (for User) for new_user" do
0
+ new_user.username.class.should == String
0
     end
0
     
0
- it "should have all of the methods" do
0
- self.should respond_to(:default_user)
0
- self.should respond_to(:default_scott)
0
- self.should respond_to(:default_foo)
0
- self.should respond_to(:default_admin)
0
- self.should respond_to(:new_user)
0
- self.should respond_to(:new_scott)
0
- self.should respond_to(:new_foo)
0
- self.should respond_to(:create_user)
0
- self.should respond_to(:create_scott)
0
- self.should respond_to(:create_foo)
0
+ it "should have the username as a string (for User) for create_user" do
0
+ create_user.username.class.should == String
0
     end
0
+
0
+ it "should have the new_user method as a private method" do
0
+ self.private_methods.should include("new_user")
0
+ end
0
+
0
+ it "should have the create_user method as a private method" do
0
+ self.private_methods.should include("create_user")
0
+ end
0
+
0
+ it "should have the new_foo method as a private method" do
0
+ self.private_methods.should include("new_foo")
0
+ end
0
+
0
+ it "should have the create_foo method as a private method" do
0
+ self.private_methods.should include("create_foo")
0
+ end
0
+
0
+ it "should have the new_scott method as a private method" do
0
+ self.private_methods.should include("new_scott")
0
+ end
0
+
0
+ it "should have the create_scott method as a private method" do
0
+ self.private_methods.should include("create_scott")
0
+ end
0
   end
0
 end
0
\ No newline at end of file
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
 
 
47
48
49
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
0
@@ -1,49 +1,8 @@
0
-require 'rubygems'
0
-require 'sqlite3'
0
-require 'active_record'
0
-require 'active_support'
0
-
0
-ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
0
-ActiveRecord::Migration.verbose = false
0
-
0
-ActiveRecord::Schema.define do
0
- create_table :users do |t|
0
- t.column :key, :string
0
- t.column :other_key, :string
0
- t.column :gender_id, :integer
0
- t.column :username, :string
0
- end
0
-
0
- create_table :genders do |t|
0
- t.column :sex, :string
0
- end
0
-
0
- create_table :aliens do |t|
0
- t.column :gender_id, :string
0
- end
0
-
0
- create_table :admins do |t|
0
- t.column :admin_status, :boolean
0
- t.column :name, :string
0
- t.column :username, :string
0
- t.column :key, :string
0
- t.column :other_key, :string
0
- end
0
-
0
- create_table :items do |t|
0
- t.column :category, :integer
0
- t.column :type, :string
0
- t.column :name, :string
0
- end
0
-
0
- create_table :categories do |t|
0
- t.column :name, :string
0
- end
0
-end
0
-
0
-
0
 require File.dirname(__FILE__) + "/spec_helpers"
0
 include SpecHelperFunctions
0
+
0
+setup_database_connection
0
+
0
 swap_out_require!
0
 
0
 require File.dirname(__FILE__) + "/../lib/fixture_replacement"
...
16
17
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
20
 
 
 
 
...
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
0
@@ -16,5 +16,55 @@ module SpecHelperFunctions
0
         end
0
       end
0
     end
0
+ end
0
+
0
+ def setup_database_connection
0
+
0
+ require 'rubygems'
0
+ require 'sqlite3'
0
+ require 'active_record'
0
+ require 'active_support'
0
+
0
+ ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
0
+ ActiveRecord::Migration.verbose = false
0
+
0
+ ActiveRecord::Schema.define do
0
+ create_table :users do |t|
0
+ t.column :key, :string
0
+ t.column :other_key, :string
0
+ t.column :gender_id, :integer
0
+ t.column :username, :string
0
+ end
0
+
0
+ create_table :genders do |t|
0
+ t.column :sex, :string
0
+ end
0
+
0
+ create_table :aliens do |t|
0
+ t.column :gender_id, :string
0
+ end
0
+
0
+ create_table :admins do |t|
0
+ t.column :admin_status, :boolean
0
+ t.column :name, :string
0
+ t.column :username, :string
0
+ t.column :key, :string
0
+ t.column :other_key, :string
0
+ end
0
+
0
+ create_table :items do |t|
0
+ t.column :category, :integer
0
+ t.column :type, :string
0
+ t.column :name, :string
0
+ end
0
+
0
+ create_table :categories do |t|
0
+ t.column :name, :string
0
+ end
0
+ end
0
   end
0
 end
0
+
0
+
0
+
0
+

Comments

    No one has commented yet.