joinfix 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/joinfix_test.rb CHANGED
@@ -36,40 +36,6 @@ class JoinFixTest < Test::Unit::TestCase
36
36
  def teardown
37
37
  end
38
38
 
39
- #
40
- # compatability tests
41
- #
42
-
43
- def btest_fixtures_without_templates_are_unaffected
44
- database_test(NoJoinFixMigration) do |connection|
45
- assert_equal "1", no_join_fixes(:first).field
46
- assert_equal "2", no_join_fixes(:second).field
47
- end
48
- end
49
-
50
- def btest_omap_fixtures_without_templates_are_unaffected
51
- database_test(NoJoinFixMigration) do |connection|
52
- assert_equal 1, omap_no_join_fixes(:first).id
53
- assert_equal 2, omap_no_join_fixes(:second).id
54
- end
55
- end
56
-
57
- #
58
- # preserved keys test
59
- #
60
-
61
- def btest_id_keys_are_preserved
62
- [:id, :preserved_id].each do |key|
63
- assert JoinFix.preserves?(key)
64
- assert JoinFix.preserves?(key.to_s)
65
- end
66
-
67
- [:not_preserved, :pid, "_id"].each do |key|
68
- assert !JoinFix.preserves?(key)
69
- assert !JoinFix.preserves?(key.to_s)
70
- end
71
- end
72
-
73
39
  #
74
40
  # join tests
75
41
  #
@@ -110,8 +76,7 @@ class JoinFixTest < Test::Unit::TestCase
110
76
 
111
77
  def test_join_belongs_to_validates_inclusion_of_required_configurations
112
78
  assert_raise(ArgumentError) { joinfix.join_belongs_to(nil, {}) }
113
- assert_raise(ArgumentError) { joinfix.join_belongs_to(nil, :polymorphic => true) }
114
- assert_raise(ArgumentError) { joinfix.join_belongs_to(nil, :child_table => "child_table") }
79
+ assert_raise(ArgumentError) { joinfix.join_has_one(nil, :child_table => "child_table") }
115
80
  end
116
81
 
117
82
  # join_has_one tests
@@ -126,7 +91,6 @@ class JoinFixTest < Test::Unit::TestCase
126
91
 
127
92
  def test_join_has_one_validates_inclusion_of_required_configurations
128
93
  assert_raise(ArgumentError) { joinfix.join_has_one(nil, {}) }
129
- assert_raise(ArgumentError) { joinfix.join_has_one(nil, :foreign_key => "foreign_key") }
130
94
  assert_raise(ArgumentError) { joinfix.join_has_one(nil, :parent_table => "parent_table") }
131
95
  end
132
96
 
@@ -143,25 +107,9 @@ class JoinFixTest < Test::Unit::TestCase
143
107
  assert_equal({["foreign_key", "parent_table"] => "parent_entry", ["association_foreign_key", "child_table"] => "child_entry"}, join)
144
108
  end
145
109
 
146
- def btest_join_has_and_belongs_to_many_with_attributes
147
- attributes = {:some_attribute => "attribute"}
148
-
149
- join = parent.join_has_and_belongs_to_many(child,
150
- :foreign_key => "foreign_key",
151
- :parent_table => "parent_table",
152
- :association_foreign_key => "association_foreign_key",
153
- :child_table => "child_table",
154
- :attributes => attributes)
155
-
156
- assert_equal({:name => "parent_name"}, parent)
157
- assert_equal({:name => "child_name"}, child)
158
- assert_equal(attributes.merge( ["foreign_key", "parent_table"] => "parent_entry", ["association_foreign_key", "child_table"] => "child_entry" ), join)
159
- end
160
-
161
110
  def test_join_has_and_belongs_to_many_validates_inclusion_of_required_configurations
162
111
  assert_raise(ArgumentError) { joinfix.join_has_and_belongs_to_many(nil, {}) }
163
- assert_raise(ArgumentError) { joinfix.join_has_and_belongs_to_many(nil, :foreign_key => "foreign_key") }
164
- assert_raise(ArgumentError) { joinfix.join_has_and_belongs_to_many(nil, :association_foreign_key => "parent_table") }
112
+ assert_raise(ArgumentError) { joinfix.join_has_one(nil, :parent_table => "parent_table") }
165
113
  end
166
114
 
167
115
  # join_has_many test
@@ -201,22 +149,11 @@ class JoinFixTest < Test::Unit::TestCase
201
149
  assert_equal({["foreign_key", "parent_table"] => "parent_entry", ["association_foreign_key", "child_table"] => "child_entry"}, join)
202
150
  end
203
151
 
204
- def btest_join_has_many_through_with_attributes
205
- attributes = {:some_attribute => "attribute"}
206
-
207
- join = parent.join_has_many(child,
208
- :through => "some_join_table",
209
- :foreign_key => "foreign_key",
210
- :parent_table => "parent_table",
211
- :association_foreign_key => "association_foreign_key",
212
- :child_table => "child_table",
213
- :attributes => attributes)
214
-
215
- assert_equal({:name => "parent_name"}, parent)
216
- assert_equal({:name => "child_name"}, child)
217
- assert_equal(attributes.merge(["foreign_key", "parent_table"] => "parent_entry", ["association_foreign_key", "child_table"] => "child_entry"), join)
152
+ def test_join_has_many_validates_inclusion_of_required_configurations
153
+ assert_raise(ArgumentError) { joinfix.join_has_many(nil, {}) }
154
+ assert_raise(ArgumentError) { joinfix.join_has_one(nil, :parent_table => "parent_table") }
218
155
  end
219
-
156
+
220
157
  #
221
158
  # test extract_if
222
159
  #
@@ -2,7 +2,7 @@ $:.unshift File.join(File.dirname(__FILE__), '../lib')
2
2
 
3
3
  puts %{
4
4
  NOTE! The joinfix tests are not run through this test suite
5
- because they require a database to connect to. See TEST_README
5
+ because they must connect to a database. See TEST_README
6
6
  for details and instructions on running the joinfix tests.
7
7
  }
8
8
  #
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: joinfix
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2007-05-13 00:00:00 -06:00
6
+ version: 1.0.0
7
+ date: 2007-06-28 00:00:00 -06:00
8
8
  summary: A reflection-based solution to the fixture join problem.
9
9
  require_paths:
10
10
  - lib
@@ -51,8 +51,8 @@ files:
51
51
  - test/joinfix_test_suite.rb
52
52
  - test/missing_fixture_test.rb
53
53
  - test/nested_test.rb
54
- - test/todo
55
54
  - lib/joinfix
55
+ - lib/joinfix/error.rb
56
56
  - lib/joinfix/fixture.rb
57
57
  - lib/joinfix/fixtures.rb
58
58
  - lib/joinfix/fixtures_class.rb
@@ -157,13 +157,17 @@ files:
157
157
  - rails/tmp
158
158
  - rails/vendor
159
159
  - rails/vendor/plugins
160
+ - Rakefile
160
161
  - README
161
162
  - MIT-LICENSE
162
163
  - TEST_README
163
164
  test_files:
164
165
  - test/joinfix_test_suite.rb
165
- rdoc_options: []
166
-
166
+ rdoc_options:
167
+ - --title
168
+ - JoinFix
169
+ - --main
170
+ - README
167
171
  extra_rdoc_files:
168
172
  - README
169
173
  - MIT-LICENSE
data/test/todo DELETED
@@ -1,15 +0,0 @@
1
- test error conditions:
2
- -- fixture not specified
3
- -- model not specified
4
- -- name collisions
5
- -- id collisions
6
-
7
- test also:
8
- -- omaps
9
- -- fixtures across different test
10
- -- mapping a fixture to a class
11
- -- default field values
12
-
13
- devel:
14
- -- clean up error handling -- make appropriate subclasses of error
15
- -- annoying that the re-raise loses the original stack trace