has_many_polymorphs 2.10 → 2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +2 -0
  3. data/Manifest +191 -56
  4. data/TODO +1 -0
  5. data/examples/hmph.rb +69 -0
  6. data/generators/commenting/commenting_generator.rb +94 -0
  7. data/generators/commenting/templates/comment.rb +33 -0
  8. data/generators/commenting/templates/comment_test.rb +12 -0
  9. data/generators/commenting/templates/commenting.rb +13 -0
  10. data/generators/commenting/templates/commenting_extensions.rb +30 -0
  11. data/generators/commenting/templates/commenting_test.rb +30 -0
  12. data/generators/commenting/templates/commentings.yml +23 -0
  13. data/generators/commenting/templates/comments.yml +13 -0
  14. data/generators/commenting/templates/migration.rb +28 -0
  15. data/generators/tagging/templates/tagging_extensions.rb +4 -8
  16. data/has_many_polymorphs.gemspec +19 -12
  17. data/lib/has_many_polymorphs.rb +3 -4
  18. data/lib/has_many_polymorphs/autoload.rb +4 -4
  19. data/lib/has_many_polymorphs/class_methods.rb +8 -8
  20. data/lib/has_many_polymorphs/debugging_tools.rb +2 -0
  21. data/lib/has_many_polymorphs/dependencies.rb +9 -4
  22. data/lib/has_many_polymorphs/support_methods.rb +3 -1
  23. data/test/fixtures/{aquatic/fish.yml → fish.yml} +0 -0
  24. data/test/fixtures/{aquatic/little_whale_pupils.yml → little_whale_pupils.yml} +0 -0
  25. data/test/fixtures/{aquatic/whales.yml → whales.yml} +0 -0
  26. data/test/integration/app/README +182 -0
  27. data/test/integration/app/Rakefile +19 -0
  28. data/test/integration/app/app/controllers/addresses_controller.rb +85 -0
  29. data/test/integration/app/app/controllers/application.rb +7 -0
  30. data/test/integration/app/app/controllers/sellers_controller.rb +85 -0
  31. data/test/integration/app/app/controllers/states_controller.rb +85 -0
  32. data/test/integration/app/app/controllers/users_controller.rb +85 -0
  33. data/test/integration/app/app/helpers/addresses_helper.rb +2 -0
  34. data/test/integration/app/app/helpers/application_helper.rb +3 -0
  35. data/test/integration/app/app/helpers/sellers_helper.rb +28 -0
  36. data/test/integration/app/app/helpers/states_helper.rb +2 -0
  37. data/test/integration/app/app/helpers/users_helper.rb +2 -0
  38. data/test/integration/app/app/models/address.rb +4 -0
  39. data/test/integration/app/app/models/citation.rb +3 -0
  40. data/test/integration/app/app/models/citations_item.rb +4 -0
  41. data/test/integration/app/app/models/seller.rb +4 -0
  42. data/test/integration/app/app/models/state.rb +3 -0
  43. data/test/integration/app/app/models/user.rb +4 -0
  44. data/test/integration/app/app/views/addresses/edit.html.erb +12 -0
  45. data/test/integration/app/app/views/addresses/index.html.erb +18 -0
  46. data/test/integration/app/app/views/addresses/new.html.erb +11 -0
  47. data/test/integration/app/app/views/addresses/show.html.erb +3 -0
  48. data/test/integration/app/app/views/layouts/addresses.html.erb +17 -0
  49. data/test/integration/app/app/views/layouts/sellers.html.erb +17 -0
  50. data/test/integration/app/app/views/layouts/states.html.erb +17 -0
  51. data/test/integration/app/app/views/layouts/users.html.erb +17 -0
  52. data/test/integration/app/app/views/sellers/edit.html.erb +12 -0
  53. data/test/integration/app/app/views/sellers/index.html.erb +20 -0
  54. data/test/integration/app/app/views/sellers/new.html.erb +11 -0
  55. data/test/integration/app/app/views/sellers/show.html.erb +3 -0
  56. data/test/integration/app/app/views/states/edit.html.erb +12 -0
  57. data/test/integration/app/app/views/states/index.html.erb +19 -0
  58. data/test/integration/app/app/views/states/new.html.erb +11 -0
  59. data/test/integration/app/app/views/states/show.html.erb +3 -0
  60. data/test/integration/app/app/views/users/edit.html.erb +12 -0
  61. data/test/integration/app/app/views/users/index.html.erb +22 -0
  62. data/test/integration/app/app/views/users/new.html.erb +11 -0
  63. data/test/integration/app/app/views/users/show.html.erb +3 -0
  64. data/test/integration/app/config/boot.rb +45 -0
  65. data/test/integration/app/config/database.yml +21 -0
  66. data/test/integration/app/config/environment.rb +13 -0
  67. data/test/integration/app/config/environments/development.rb +7 -0
  68. data/test/integration/app/config/environments/production.rb +18 -0
  69. data/test/integration/app/config/environments/test.rb +19 -0
  70. data/test/integration/app/config/locomotive.yml +6 -0
  71. data/test/integration/app/config/routes.rb +33 -0
  72. data/test/integration/app/config/ultrasphinx/default.base +56 -0
  73. data/test/integration/app/config/ultrasphinx/development.conf.canonical +155 -0
  74. data/test/integration/app/db/migrate/001_create_users.rb +16 -0
  75. data/test/integration/app/db/migrate/002_create_sellers.rb +14 -0
  76. data/test/integration/app/db/migrate/003_create_addresses.rb +19 -0
  77. data/test/integration/app/db/migrate/004_create_states.rb +12 -0
  78. data/test/integration/app/db/migrate/005_add_capitalization_to_seller.rb +9 -0
  79. data/test/integration/app/db/migrate/006_add_deleted_to_user.rb +9 -0
  80. data/test/integration/app/db/migrate/007_add_lat_and_long_to_address.rb +11 -0
  81. data/test/integration/app/db/migrate/008_create_citations.rb +12 -0
  82. data/test/integration/app/db/migrate/009_create_citations_items.rb +14 -0
  83. data/test/integration/app/db/schema.rb +144 -0
  84. data/test/integration/app/doc/README_FOR_APP +2 -0
  85. data/test/integration/app/generated_models/aquatic_fish.rb +109 -0
  86. data/test/integration/app/generated_models/aquatic_pupils_whale.rb +13 -0
  87. data/test/integration/app/generated_models/aquatic_whale.rb +42 -0
  88. data/test/integration/app/generated_models/beautiful_fight_relationship.rb +25 -0
  89. data/test/integration/app/generated_models/citation.rb +40 -0
  90. data/test/integration/app/generated_models/citations_item.rb +12 -0
  91. data/test/integration/app/generated_models/dog.rb +183 -0
  92. data/test/integration/app/generated_models/eaters_foodstuff.rb +13 -0
  93. data/test/integration/app/generated_models/frog.rb +78 -0
  94. data/test/integration/app/generated_models/kitten.rb +161 -0
  95. data/test/integration/app/generated_models/parentship.rb +14 -0
  96. data/test/integration/app/generated_models/person.rb +53 -0
  97. data/test/integration/app/generated_models/petfood.rb +125 -0
  98. data/test/integration/app/generated_models/polymorph_test_some_model.rb +25 -0
  99. data/test/integration/app/generated_models/seller.rb +30 -0
  100. data/test/integration/app/generated_models/tabby.rb +26 -0
  101. data/test/integration/app/generated_models/user.rb +34 -0
  102. data/test/integration/app/generated_models/wild_boar.rb +87 -0
  103. data/test/integration/app/generators/commenting_generator_test.rb +83 -0
  104. data/test/integration/app/public/404.html +30 -0
  105. data/test/integration/app/public/500.html +30 -0
  106. data/test/integration/app/public/dispatch.cgi +10 -0
  107. data/test/integration/app/public/dispatch.fcgi +24 -0
  108. data/test/integration/app/public/dispatch.rb +10 -0
  109. data/test/integration/app/public/favicon.ico +0 -0
  110. data/test/integration/app/public/images/rails.png +0 -0
  111. data/test/integration/app/public/index.html +277 -0
  112. data/test/integration/app/public/javascripts/application.js +2 -0
  113. data/test/integration/app/public/javascripts/controls.js +833 -0
  114. data/test/integration/app/public/javascripts/dragdrop.js +942 -0
  115. data/test/integration/app/public/javascripts/effects.js +1088 -0
  116. data/test/integration/app/public/javascripts/prototype.js +2515 -0
  117. data/test/integration/app/public/robots.txt +1 -0
  118. data/test/integration/app/public/stylesheets/scaffold.css +74 -0
  119. data/test/integration/app/script/about +3 -0
  120. data/test/integration/app/script/breakpointer +3 -0
  121. data/test/integration/app/script/console +3 -0
  122. data/test/integration/app/script/destroy +3 -0
  123. data/test/integration/app/script/generate +3 -0
  124. data/test/integration/app/script/performance/benchmarker +3 -0
  125. data/test/integration/app/script/performance/profiler +3 -0
  126. data/test/integration/app/script/plugin +3 -0
  127. data/test/integration/app/script/process/inspector +3 -0
  128. data/test/integration/app/script/process/reaper +3 -0
  129. data/test/integration/app/script/process/spawner +3 -0
  130. data/test/integration/app/script/runner +3 -0
  131. data/test/integration/app/script/server +3 -0
  132. data/test/integration/app/test/fixtures/addresses.yml +13 -0
  133. data/test/integration/app/test/fixtures/citations.yml +9 -0
  134. data/test/integration/app/test/fixtures/citations_items.yml +9 -0
  135. data/test/integration/app/test/fixtures/sellers.yml +10 -0
  136. data/test/integration/app/test/fixtures/states.yml +216 -0
  137. data/test/integration/app/test/fixtures/users.yml +11 -0
  138. data/test/integration/app/test/functional/addresses_controller_test.rb +57 -0
  139. data/test/integration/app/test/functional/sellers_controller_test.rb +57 -0
  140. data/test/integration/app/test/functional/states_controller_test.rb +57 -0
  141. data/test/integration/app/test/functional/users_controller_test.rb +57 -0
  142. data/test/integration/app/test/test_helper.rb +28 -0
  143. data/test/integration/app/test/unit/address_test.rb +10 -0
  144. data/test/integration/app/test/unit/citation_test.rb +10 -0
  145. data/test/integration/app/test/unit/citations_item_test.rb +10 -0
  146. data/test/integration/app/test/unit/seller_test.rb +10 -0
  147. data/test/integration/app/test/unit/state_test.rb +10 -0
  148. data/test/integration/app/test/unit/user_test.rb +10 -0
  149. data/test/models/aquatic/fish.rb +2 -1
  150. data/test/models/aquatic/whale.rb +2 -0
  151. data/test/setup.rb +10 -0
  152. data/test/test_all.rb +16 -0
  153. data/test/test_helper.rb +16 -12
  154. data/test/unit/polymorph_test.rb +35 -34
  155. metadata +239 -98
  156. metadata.gz.sig +0 -0
@@ -0,0 +1 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
@@ -0,0 +1,74 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ .fieldWithErrors {
20
+ padding: 2px;
21
+ background-color: red;
22
+ display: table;
23
+ }
24
+
25
+ #errorExplanation {
26
+ width: 400px;
27
+ border: 2px solid red;
28
+ padding: 7px;
29
+ padding-bottom: 12px;
30
+ margin-bottom: 20px;
31
+ background-color: #f0f0f0;
32
+ }
33
+
34
+ #errorExplanation h2 {
35
+ text-align: left;
36
+ font-weight: bold;
37
+ padding: 5px 5px 5px 15px;
38
+ font-size: 12px;
39
+ margin: -7px;
40
+ background-color: #c00;
41
+ color: #fff;
42
+ }
43
+
44
+ #errorExplanation p {
45
+ color: #333;
46
+ margin-bottom: 0;
47
+ padding: 5px;
48
+ }
49
+
50
+ #errorExplanation ul li {
51
+ font-size: 12px;
52
+ list-style: square;
53
+ }
54
+
55
+ div.uploadStatus {
56
+ margin: 5px;
57
+ }
58
+
59
+ div.progressBar {
60
+ margin: 5px;
61
+ }
62
+
63
+ div.progressBar div.border {
64
+ background-color: #fff;
65
+ border: 1px solid grey;
66
+ width: 100%;
67
+ }
68
+
69
+ div.progressBar div.background {
70
+ background-color: #333;
71
+ height: 18px;
72
+ width: 0%;
73
+ }
74
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/breakpointer'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/inspector'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/reaper'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/spawner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/server'
@@ -0,0 +1,13 @@
1
+ <% 1.upto(40) do |num| %>
2
+ <%="address#{num}:" %>
3
+ id: <%= num %>
4
+ user_id: <%= num %>
5
+ name: <%= "Chicago Branch Office #{num}" %>
6
+ line_1: "3344 Airport Road"
7
+ line_2: "Suite 122"
8
+ city: "Chicago"
9
+ state_id: 15
10
+ province_region: "Cook County"
11
+ zip_postal_code: "43554"
12
+ country_id: 2
13
+ <% end %>
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+ one:
3
+ id: 1
4
+ created_at: 2007-10-04 17:14:07
5
+ updated_at: 2007-10-04 17:14:07
6
+ two:
7
+ id: 2
8
+ created_at: 2007-10-04 17:14:07
9
+ updated_at: 2007-10-04 17:14:07
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+ one:
3
+ id: 1
4
+ created_at: 2007-10-04 17:14:27
5
+ updated_at: 2007-10-04 17:14:27
6
+ two:
7
+ id: 2
8
+ created_at: 2007-10-04 17:14:27
9
+ updated_at: 2007-10-04 17:14:27
@@ -0,0 +1,10 @@
1
+ <% 1.upto(20) do |num| %>
2
+ <%="seller#{num}:" %>
3
+ id: <%= num %>
4
+ user_id: <%= num %>
5
+ company_name: <%= "seller#{num}" %>
6
+ capitalization: <%= num * 1.548 %>
7
+ created_at: <%= (Time.now - num.weeks).to_s :db %>
8
+ updated_at: <%= (Time.now - num.days).to_s :db %>
9
+ <% end %>
10
+
@@ -0,0 +1,216 @@
1
+ AA:<% id = 0 %>
2
+ id: <%= (id=id+1).to_s %>
3
+ name: AA
4
+ abbreviation: AA
5
+ AE:
6
+ id: <%= (id=id+1).to_s %>
7
+ name: AE
8
+ abbreviation: AE
9
+ AP:
10
+ id: <%= (id=id+1).to_s %>
11
+ name: AP
12
+ abbreviation: AP
13
+ AL:
14
+ id: <%= (id=id+1).to_s %>
15
+ name: Alabama
16
+ abbreviation: AL
17
+ AK:
18
+ id: <%= (id=id+1).to_s %>
19
+ name: Alaska
20
+ abbreviation: AK
21
+ AZ:
22
+ id: <%= (id=id+1).to_s %>
23
+ name: Arizona
24
+ abbreviation: AZ
25
+ AR:
26
+ id: <%= (id=id+1).to_s %>
27
+ name: Arkansas
28
+ abbreviation: AR
29
+ CA:
30
+ id: <%= (id=id+1).to_s %>
31
+ name: California
32
+ abbreviation: CA
33
+ CO:
34
+ id: <%= (id=id+1).to_s %>
35
+ name: Colorado
36
+ abbreviation: CO
37
+ CT:
38
+ id: <%= (id=id+1).to_s %>
39
+ name: Connecticut
40
+ abbreviation: CT
41
+ DE:
42
+ id: <%= (id=id+1).to_s %>
43
+ name: Delaware
44
+ abbreviation: DE
45
+ DC:
46
+ id: <%= (id=id+1).to_s %>
47
+ name: District of Columbia
48
+ abbreviation: DC
49
+ FL:
50
+ id: <%= (id=id+1).to_s %>
51
+ name: Florida
52
+ abbreviation: FL
53
+ GA:
54
+ id: <%= (id=id+1).to_s %>
55
+ name: Georgia
56
+ abbreviation: GA
57
+ HI:
58
+ id: <%= (id=id+1).to_s %>
59
+ name: Hawaii
60
+ abbreviation: HI
61
+ ID:
62
+ id: <%= (id=id+1).to_s %>
63
+ name: Idaho
64
+ abbreviation: ID
65
+ IL:
66
+ id: <%= (id=id+1).to_s %>
67
+ name: Illinois
68
+ abbreviation: IL
69
+ IN:
70
+ id: <%= (id=id+1).to_s %>
71
+ name: Indiana
72
+ abbreviation: IN
73
+ IA:
74
+ id: <%= (id=id+1).to_s %>
75
+ name: Iowa
76
+ abbreviation: IA
77
+ KS:
78
+ id: <%= (id=id+1).to_s %>
79
+ name: Kansas
80
+ abbreviation: KS
81
+ KY:
82
+ id: <%= (id=id+1).to_s %>
83
+ name: Kentucky
84
+ abbreviation: KY
85
+ LA:
86
+ id: <%= (id=id+1).to_s %>
87
+ name: Louisiana
88
+ abbreviation: LA
89
+ ME:
90
+ id: <%= (id=id+1).to_s %>
91
+ name: Maine
92
+ abbreviation: ME
93
+ MD:
94
+ id: <%= (id=id+1).to_s %>
95
+ name: Maryland
96
+ abbreviation: MD
97
+ MA:
98
+ id: <%= (id=id+1).to_s %>
99
+ name: Massachusetts
100
+ abbreviation: MA
101
+ MI:
102
+ id: <%= (id=id+1).to_s %>
103
+ name: Michigan
104
+ abbreviation: MI
105
+ MN:
106
+ id: <%= (id=id+1).to_s %>
107
+ name: Minnesota
108
+ abbreviation: MN
109
+ MS:
110
+ id: <%= (id=id+1).to_s %>
111
+ name: Mississippi
112
+ abbreviation: MS
113
+ MO:
114
+ id: <%= (id=id+1).to_s %>
115
+ name: Missouri
116
+ abbreviation: MO
117
+ MT:
118
+ id: <%= (id=id+1).to_s %>
119
+ name: Montana
120
+ abbreviation: MT
121
+ NE:
122
+ id: <%= (id=id+1).to_s %>
123
+ name: Nebraska
124
+ abbreviation: NE
125
+ NV:
126
+ id: <%= (id=id+1).to_s %>
127
+ name: Nevada
128
+ abbreviation: NV
129
+ NH:
130
+ id: <%= (id=id+1).to_s %>
131
+ name: New Hampshire
132
+ abbreviation: NH
133
+ NJ:
134
+ id: <%= (id=id+1).to_s %>
135
+ name: New Jersey
136
+ abbreviation: NJ
137
+ NM:
138
+ id: <%= (id=id+1).to_s %>
139
+ name: New Mexico
140
+ abbreviation: NM
141
+ NY:
142
+ id: <%= (id=id+1).to_s %>
143
+ name: New York
144
+ abbreviation: NY
145
+ NC:
146
+ id: <%= (id=id+1).to_s %>
147
+ name: North Carolina
148
+ abbreviation: NC
149
+ ND:
150
+ id: <%= (id=id+1).to_s %>
151
+ name: North Dakota
152
+ abbreviation: ND
153
+ OH:
154
+ id: <%= (id=id+1).to_s %>
155
+ name: Ohio
156
+ abbreviation: OH
157
+ OK:
158
+ id: <%= (id=id+1).to_s %>
159
+ name: Oklahoma
160
+ abbreviation: OK
161
+ OR:
162
+ id: <%= (id=id+1).to_s %>
163
+ name: Oregon
164
+ abbreviation: OR
165
+ PA:
166
+ id: <%= (id=id+1).to_s %>
167
+ name: Pennsylvania
168
+ abbreviation: PA
169
+ RI:
170
+ id: <%= (id=id+1).to_s %>
171
+ name: Rhode Island
172
+ abbreviation: RI
173
+ SC:
174
+ id: <%= (id=id+1).to_s %>
175
+ name: South Carolina
176
+ abbreviation: SC
177
+ SD:
178
+ id: <%= (id=id+1).to_s %>
179
+ name: South Dakota
180
+ abbreviation: SD
181
+ TN:
182
+ id: <%= (id=id+1).to_s %>
183
+ name: Tennessee
184
+ abbreviation: TN
185
+ TX:
186
+ id: <%= (id=id+1).to_s %>
187
+ name: Texas
188
+ abbreviation: TX
189
+ UT:
190
+ id: <%= (id=id+1).to_s %>
191
+ name: Utah
192
+ abbreviation: UT
193
+ VT:
194
+ id: <%= (id=id+1).to_s %>
195
+ name: Vermont
196
+ abbreviation: VT
197
+ VA:
198
+ id: <%= (id=id+1).to_s %>
199
+ name: Virginia
200
+ abbreviation: VA
201
+ WA:
202
+ id: <%= (id=id+1).to_s %>
203
+ name: Washington
204
+ abbreviation: WA
205
+ WV:
206
+ id: <%= (id=id+1).to_s %>
207
+ name: West Virginia
208
+ abbreviation: WV
209
+ WI:
210
+ id: <%= (id=id+1).to_s %>
211
+ name: Wisconsin
212
+ abbreviation: WI
213
+ WY:
214
+ id: <%= (id=id+1).to_s %>
215
+ name: Wyoming
216
+ abbreviation: WY
@@ -0,0 +1,11 @@
1
+ <% 1.upto(41) do |num| %>
2
+ <%="user#{num}:" %>
3
+ id: <%= num.to_s %>
4
+ login: <%= "user#{num}" %>
5
+ crypted_password: "2fdefe5c83d80a03a828dd65e90cfff65f0fb42d043a254ca2cad6af968d0e15" #password
6
+ email: <%= "user#{num}@test.com" %>
7
+ salt: "1000"
8
+ created_at: <%= (Time.now - 30).to_s :db %>
9
+ updated_at: <%= Time.now.to_s :db %>
10
+ deleted: <%= num == 41 ? true : false %>
11
+ <% end %>
@@ -0,0 +1,57 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'addresses_controller'
3
+
4
+ # Re-raise errors caught by the controller.
5
+ class AddressesController; def rescue_action(e) raise e end; end
6
+
7
+ class AddressesControllerTest < Test::Unit::TestCase
8
+ fixtures :addresses
9
+
10
+ def setup
11
+ @controller = AddressesController.new
12
+ @request = ActionController::TestRequest.new
13
+ @response = ActionController::TestResponse.new
14
+ end
15
+
16
+ def test_should_get_index
17
+ get :index
18
+ assert_response :success
19
+ assert assigns(:addresses)
20
+ end
21
+
22
+ def test_should_get_new
23
+ get :new
24
+ assert_response :success
25
+ end
26
+
27
+ def test_should_create_address
28
+ assert_difference('Address.count') do
29
+ post :create, :address => { :country_id => 1, :user_id => 1, :state_id => 1}
30
+ end
31
+
32
+ assert_redirected_to address_path(assigns(:address))
33
+ end
34
+
35
+ def test_should_show_address
36
+ get :show, :id => 1
37
+ assert_response :success
38
+ end
39
+
40
+ def test_should_get_edit
41
+ get :edit, :id => 1
42
+ assert_response :success
43
+ end
44
+
45
+ def test_should_update_address
46
+ put :update, :id => 1, :address => { }
47
+ assert_redirected_to address_path(assigns(:address))
48
+ end
49
+
50
+ def test_should_destroy_address
51
+ assert_difference('Address.count', -1) do
52
+ delete :destroy, :id => 1
53
+ end
54
+
55
+ assert_redirected_to addresses_path
56
+ end
57
+ end