shoulda 2.11.3 → 3.0.0.beta1

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 (262) hide show
  1. data/Gemfile +9 -0
  2. data/Gemfile.lock +108 -0
  3. data/README.md +95 -0
  4. data/Rakefile +6 -50
  5. data/lib/shoulda/version.rb +1 -1
  6. metadata +50 -269
  7. data/README.rdoc +0 -154
  8. data/bin/convert_to_should_syntax +0 -42
  9. data/lib/shoulda.rb +0 -9
  10. data/lib/shoulda/action_controller.rb +0 -34
  11. data/lib/shoulda/action_controller/macros.rb +0 -221
  12. data/lib/shoulda/action_controller/matchers.rb +0 -39
  13. data/lib/shoulda/action_controller/matchers/assign_to_matcher.rb +0 -112
  14. data/lib/shoulda/action_controller/matchers/filter_param_matcher.rb +0 -74
  15. data/lib/shoulda/action_controller/matchers/redirect_to_matcher.rb +0 -62
  16. data/lib/shoulda/action_controller/matchers/render_template_matcher.rb +0 -54
  17. data/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb +0 -99
  18. data/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb +0 -74
  19. data/lib/shoulda/action_controller/matchers/respond_with_matcher.rb +0 -85
  20. data/lib/shoulda/action_controller/matchers/route_matcher.rb +0 -93
  21. data/lib/shoulda/action_controller/matchers/set_session_matcher.rb +0 -98
  22. data/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb +0 -100
  23. data/lib/shoulda/action_mailer.rb +0 -13
  24. data/lib/shoulda/action_mailer/assertions.rb +0 -42
  25. data/lib/shoulda/action_mailer/matchers.rb +0 -22
  26. data/lib/shoulda/action_mailer/matchers/have_sent_email.rb +0 -110
  27. data/lib/shoulda/active_record.rb +0 -16
  28. data/lib/shoulda/active_record/assertions.rb +0 -69
  29. data/lib/shoulda/active_record/helpers.rb +0 -32
  30. data/lib/shoulda/active_record/macros.rb +0 -457
  31. data/lib/shoulda/active_record/matchers.rb +0 -42
  32. data/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb +0 -83
  33. data/lib/shoulda/active_record/matchers/allow_value_matcher.rb +0 -110
  34. data/lib/shoulda/active_record/matchers/association_matcher.rb +0 -226
  35. data/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb +0 -87
  36. data/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb +0 -141
  37. data/lib/shoulda/active_record/matchers/have_db_column_matcher.rb +0 -169
  38. data/lib/shoulda/active_record/matchers/have_db_index_matcher.rb +0 -112
  39. data/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb +0 -59
  40. data/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb +0 -41
  41. data/lib/shoulda/active_record/matchers/validate_format_of_matcher.rb +0 -65
  42. data/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb +0 -39
  43. data/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb +0 -60
  44. data/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb +0 -148
  45. data/lib/shoulda/active_record/matchers/validation_matcher.rb +0 -56
  46. data/lib/shoulda/assertions.rb +0 -79
  47. data/lib/shoulda/autoload_macros.rb +0 -46
  48. data/lib/shoulda/context.rb +0 -433
  49. data/lib/shoulda/helpers.rb +0 -8
  50. data/lib/shoulda/integrations/rspec.rb +0 -13
  51. data/lib/shoulda/integrations/rspec2.rb +0 -22
  52. data/lib/shoulda/integrations/test_unit.rb +0 -22
  53. data/lib/shoulda/macros.rb +0 -161
  54. data/lib/shoulda/private_helpers.rb +0 -13
  55. data/lib/shoulda/proc_extensions.rb +0 -14
  56. data/lib/shoulda/rails.rb +0 -8
  57. data/lib/shoulda/tasks.rb +0 -3
  58. data/lib/shoulda/tasks/list_tests.rake +0 -29
  59. data/lib/shoulda/tasks/yaml_to_shoulda.rake +0 -28
  60. data/rails/init.rb +0 -8
  61. data/test/README +0 -36
  62. data/test/fail_macros.rb +0 -55
  63. data/test/fixtures/addresses.yml +0 -3
  64. data/test/fixtures/friendships.yml +0 -0
  65. data/test/fixtures/posts.yml +0 -5
  66. data/test/fixtures/products.yml +0 -0
  67. data/test/fixtures/taggings.yml +0 -0
  68. data/test/fixtures/tags.yml +0 -9
  69. data/test/fixtures/users.yml +0 -6
  70. data/test/functional/posts_controller_test.rb +0 -121
  71. data/test/functional/users_controller_test.rb +0 -19
  72. data/test/matchers/action_mailer/have_sent_email_test.rb +0 -70
  73. data/test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb +0 -74
  74. data/test/matchers/active_record/allow_value_matcher_test.rb +0 -64
  75. data/test/matchers/active_record/association_matcher_test.rb +0 -263
  76. data/test/matchers/active_record/ensure_inclusion_of_matcher_test.rb +0 -81
  77. data/test/matchers/active_record/ensure_length_of_matcher_test.rb +0 -158
  78. data/test/matchers/active_record/have_db_column_matcher_test.rb +0 -169
  79. data/test/matchers/active_record/have_db_index_matcher_test.rb +0 -91
  80. data/test/matchers/active_record/have_readonly_attributes_matcher_test.rb +0 -29
  81. data/test/matchers/active_record/validate_acceptance_of_matcher_test.rb +0 -44
  82. data/test/matchers/active_record/validate_format_of_matcher_test.rb +0 -39
  83. data/test/matchers/active_record/validate_numericality_of_matcher_test.rb +0 -52
  84. data/test/matchers/active_record/validate_presence_of_matcher_test.rb +0 -86
  85. data/test/matchers/active_record/validate_uniqueness_of_matcher_test.rb +0 -147
  86. data/test/matchers/controller/assign_to_matcher_test.rb +0 -45
  87. data/test/matchers/controller/filter_param_matcher_test.rb +0 -40
  88. data/test/matchers/controller/redirect_to_matcher_test.rb +0 -37
  89. data/test/matchers/controller/render_template_matcher_test.rb +0 -37
  90. data/test/matchers/controller/render_with_layout_matcher_test.rb +0 -47
  91. data/test/matchers/controller/respond_with_content_type_matcher_test.rb +0 -32
  92. data/test/matchers/controller/respond_with_matcher_test.rb +0 -96
  93. data/test/matchers/controller/route_matcher_test.rb +0 -75
  94. data/test/matchers/controller/set_session_matcher_test.rb +0 -48
  95. data/test/matchers/controller/set_the_flash_matcher.rb +0 -95
  96. data/test/other/autoload_macro_test.rb +0 -18
  97. data/test/other/context_test.rb +0 -372
  98. data/test/other/convert_to_should_syntax_test.rb +0 -63
  99. data/test/other/helpers_test.rb +0 -317
  100. data/test/other/private_helpers_test.rb +0 -32
  101. data/test/other/should_test.rb +0 -271
  102. data/test/rails2_model_builder.rb +0 -130
  103. data/test/rails2_root/app/controllers/application_controller.rb +0 -22
  104. data/test/rails2_root/app/controllers/posts_controller.rb +0 -87
  105. data/test/rails2_root/app/controllers/users_controller.rb +0 -84
  106. data/test/rails2_root/app/helpers/application_helper.rb +0 -3
  107. data/test/rails2_root/app/helpers/posts_helper.rb +0 -2
  108. data/test/rails2_root/app/helpers/users_helper.rb +0 -2
  109. data/test/rails2_root/app/models/address.rb +0 -7
  110. data/test/rails2_root/app/models/flea.rb +0 -11
  111. data/test/rails2_root/app/models/friendship.rb +0 -4
  112. data/test/rails2_root/app/models/notifier.rb +0 -8
  113. data/test/rails2_root/app/models/pets/cat.rb +0 -7
  114. data/test/rails2_root/app/models/pets/dog.rb +0 -10
  115. data/test/rails2_root/app/models/post.rb +0 -12
  116. data/test/rails2_root/app/models/product.rb +0 -12
  117. data/test/rails2_root/app/models/profile.rb +0 -2
  118. data/test/rails2_root/app/models/registration.rb +0 -2
  119. data/test/rails2_root/app/models/tag.rb +0 -8
  120. data/test/rails2_root/app/models/tagging.rb +0 -4
  121. data/test/rails2_root/app/models/treat.rb +0 -3
  122. data/test/rails2_root/app/models/user.rb +0 -32
  123. data/test/rails2_root/app/views/layouts/posts.rhtml +0 -19
  124. data/test/rails2_root/app/views/layouts/users.rhtml +0 -17
  125. data/test/rails2_root/app/views/layouts/wide.html.erb +0 -1
  126. data/test/rails2_root/app/views/notifier/the_email.html.erb +0 -1
  127. data/test/rails2_root/app/views/posts/edit.rhtml +0 -27
  128. data/test/rails2_root/app/views/posts/index.rhtml +0 -25
  129. data/test/rails2_root/app/views/posts/new.rhtml +0 -26
  130. data/test/rails2_root/app/views/posts/show.rhtml +0 -18
  131. data/test/rails2_root/app/views/users/edit.rhtml +0 -22
  132. data/test/rails2_root/app/views/users/index.rhtml +0 -22
  133. data/test/rails2_root/app/views/users/new.rhtml +0 -21
  134. data/test/rails2_root/app/views/users/show.rhtml +0 -13
  135. data/test/rails2_root/config/boot.rb +0 -110
  136. data/test/rails2_root/config/database.yml +0 -4
  137. data/test/rails2_root/config/environment.rb +0 -17
  138. data/test/rails2_root/config/environments/test.rb +0 -23
  139. data/test/rails2_root/config/initializers/new_rails_defaults.rb +0 -15
  140. data/test/rails2_root/config/initializers/shoulda.rb +0 -8
  141. data/test/rails2_root/config/routes.rb +0 -6
  142. data/test/rails2_root/db/migrate/001_create_users.rb +0 -19
  143. data/test/rails2_root/db/migrate/002_create_posts.rb +0 -13
  144. data/test/rails2_root/db/migrate/003_create_taggings.rb +0 -12
  145. data/test/rails2_root/db/migrate/004_create_tags.rb +0 -11
  146. data/test/rails2_root/db/migrate/005_create_dogs.rb +0 -12
  147. data/test/rails2_root/db/migrate/006_create_addresses.rb +0 -14
  148. data/test/rails2_root/db/migrate/007_create_fleas.rb +0 -11
  149. data/test/rails2_root/db/migrate/008_create_dogs_fleas.rb +0 -12
  150. data/test/rails2_root/db/migrate/009_create_products.rb +0 -17
  151. data/test/rails2_root/db/migrate/010_create_friendships.rb +0 -14
  152. data/test/rails2_root/db/migrate/011_create_treats.rb +0 -12
  153. data/test/rails2_root/db/migrate/20090506203502_create_profiles.rb +0 -12
  154. data/test/rails2_root/db/migrate/20090506203536_create_registrations.rb +0 -14
  155. data/test/rails2_root/db/migrate/20090513104502_create_cats.rb +0 -12
  156. data/test/rails2_root/db/schema.rb +0 -0
  157. data/test/rails2_root/log/test.log +0 -50381
  158. data/test/rails2_root/public/404.html +0 -30
  159. data/test/rails2_root/public/422.html +0 -30
  160. data/test/rails2_root/public/500.html +0 -30
  161. data/test/rails2_root/script/console +0 -3
  162. data/test/rails2_root/script/generate +0 -3
  163. data/test/rails2_root/test/shoulda_macros/custom_macro.rb +0 -6
  164. data/test/rails2_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb +0 -6
  165. data/test/rails2_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb +0 -6
  166. data/test/rails2_test_helper.rb +0 -6
  167. data/test/rails3_model_builder.rb +0 -118
  168. data/test/rails3_root/Gemfile +0 -28
  169. data/test/rails3_root/README +0 -244
  170. data/test/rails3_root/Rakefile +0 -10
  171. data/test/rails3_root/app/controllers/application_controller.rb +0 -22
  172. data/test/rails3_root/app/controllers/posts_controller.rb +0 -87
  173. data/test/rails3_root/app/controllers/users_controller.rb +0 -82
  174. data/test/rails3_root/app/helpers/application_helper.rb +0 -2
  175. data/test/rails3_root/app/models/address.rb +0 -7
  176. data/test/rails3_root/app/models/flea.rb +0 -11
  177. data/test/rails3_root/app/models/friendship.rb +0 -4
  178. data/test/rails3_root/app/models/notifier.rb +0 -8
  179. data/test/rails3_root/app/models/pets/cat.rb +0 -7
  180. data/test/rails3_root/app/models/pets/dog.rb +0 -10
  181. data/test/rails3_root/app/models/post.rb +0 -12
  182. data/test/rails3_root/app/models/product.rb +0 -12
  183. data/test/rails3_root/app/models/profile.rb +0 -2
  184. data/test/rails3_root/app/models/registration.rb +0 -2
  185. data/test/rails3_root/app/models/tag.rb +0 -8
  186. data/test/rails3_root/app/models/tagging.rb +0 -4
  187. data/test/rails3_root/app/models/treat.rb +0 -3
  188. data/test/rails3_root/app/models/user.rb +0 -32
  189. data/test/rails3_root/app/views/layouts/application.html.erb +0 -14
  190. data/test/rails3_root/app/views/layouts/posts.rhtml +0 -19
  191. data/test/rails3_root/app/views/layouts/users.rhtml +0 -17
  192. data/test/rails3_root/app/views/layouts/wide.html.erb +0 -1
  193. data/test/rails3_root/app/views/notifier/the_email.html.erb +0 -1
  194. data/test/rails3_root/app/views/posts/edit.rhtml +0 -27
  195. data/test/rails3_root/app/views/posts/index.rhtml +0 -25
  196. data/test/rails3_root/app/views/posts/new.rhtml +0 -24
  197. data/test/rails3_root/app/views/posts/show.rhtml +0 -18
  198. data/test/rails3_root/app/views/users/edit.rhtml +0 -22
  199. data/test/rails3_root/app/views/users/index.rhtml +0 -22
  200. data/test/rails3_root/app/views/users/new.rhtml +0 -21
  201. data/test/rails3_root/app/views/users/show.rhtml +0 -13
  202. data/test/rails3_root/config.ru +0 -4
  203. data/test/rails3_root/config/application.rb +0 -46
  204. data/test/rails3_root/config/boot.rb +0 -6
  205. data/test/rails3_root/config/database.yml +0 -22
  206. data/test/rails3_root/config/environment.rb +0 -5
  207. data/test/rails3_root/config/environments/development.rb +0 -19
  208. data/test/rails3_root/config/environments/production.rb +0 -42
  209. data/test/rails3_root/config/environments/test.rb +0 -32
  210. data/test/rails3_root/config/initializers/backtrace_silencers.rb +0 -7
  211. data/test/rails3_root/config/initializers/inflections.rb +0 -10
  212. data/test/rails3_root/config/initializers/mime_types.rb +0 -5
  213. data/test/rails3_root/config/initializers/secret_token.rb +0 -7
  214. data/test/rails3_root/config/initializers/session_store.rb +0 -8
  215. data/test/rails3_root/config/locales/en.yml +0 -5
  216. data/test/rails3_root/config/routes.rb +0 -4
  217. data/test/rails3_root/db/migrate/001_create_users.rb +0 -19
  218. data/test/rails3_root/db/migrate/002_create_posts.rb +0 -13
  219. data/test/rails3_root/db/migrate/003_create_taggings.rb +0 -12
  220. data/test/rails3_root/db/migrate/004_create_tags.rb +0 -11
  221. data/test/rails3_root/db/migrate/005_create_dogs.rb +0 -12
  222. data/test/rails3_root/db/migrate/006_create_addresses.rb +0 -14
  223. data/test/rails3_root/db/migrate/007_create_fleas.rb +0 -11
  224. data/test/rails3_root/db/migrate/008_create_dogs_fleas.rb +0 -12
  225. data/test/rails3_root/db/migrate/009_create_products.rb +0 -17
  226. data/test/rails3_root/db/migrate/010_create_friendships.rb +0 -14
  227. data/test/rails3_root/db/migrate/011_create_treats.rb +0 -12
  228. data/test/rails3_root/db/migrate/20090506203502_create_profiles.rb +0 -12
  229. data/test/rails3_root/db/migrate/20090506203536_create_registrations.rb +0 -14
  230. data/test/rails3_root/db/migrate/20090513104502_create_cats.rb +0 -12
  231. data/test/rails3_root/db/seeds.rb +0 -7
  232. data/test/rails3_root/db/test.sqlite3 +0 -0
  233. data/test/rails3_root/log/test.log +0 -10834
  234. data/test/rails3_root/public/404.html +0 -26
  235. data/test/rails3_root/public/422.html +0 -26
  236. data/test/rails3_root/public/500.html +0 -26
  237. data/test/rails3_root/public/favicon.ico +0 -0
  238. data/test/rails3_root/public/images/rails.png +0 -0
  239. data/test/rails3_root/public/index.html +0 -279
  240. data/test/rails3_root/public/javascripts/application.js +0 -2
  241. data/test/rails3_root/public/javascripts/controls.js +0 -965
  242. data/test/rails3_root/public/javascripts/dragdrop.js +0 -974
  243. data/test/rails3_root/public/javascripts/effects.js +0 -1123
  244. data/test/rails3_root/public/javascripts/prototype.js +0 -4874
  245. data/test/rails3_root/public/javascripts/rails.js +0 -118
  246. data/test/rails3_root/public/robots.txt +0 -5
  247. data/test/rails3_root/script/rails +0 -9
  248. data/test/rails3_root/test/performance/browsing_test.rb +0 -9
  249. data/test/rails3_root/test/test_helper.rb +0 -13
  250. data/test/rails3_test_helper.rb +0 -6
  251. data/test/rspec_test.rb +0 -207
  252. data/test/test_helper.rb +0 -36
  253. data/test/unit/address_test.rb +0 -10
  254. data/test/unit/cat_test.rb +0 -7
  255. data/test/unit/dog_test.rb +0 -9
  256. data/test/unit/flea_test.rb +0 -14
  257. data/test/unit/friendship_test.rb +0 -6
  258. data/test/unit/post_test.rb +0 -15
  259. data/test/unit/product_test.rb +0 -23
  260. data/test/unit/tag_test.rb +0 -11
  261. data/test/unit/tagging_test.rb +0 -6
  262. data/test/unit/user_test.rb +0 -46
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '3.0.3'
4
+ gem 'sqlite3-ruby', :require => 'sqlite3'
5
+ gem 'rspec'
6
+ gem 'ruby-debug'
7
+ gem 'cucumber'
8
+ gem "aruba"
9
+
@@ -0,0 +1,108 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ abstract (1.0.0)
5
+ actionmailer (3.0.3)
6
+ actionpack (= 3.0.3)
7
+ mail (~> 2.2.9)
8
+ actionpack (3.0.3)
9
+ activemodel (= 3.0.3)
10
+ activesupport (= 3.0.3)
11
+ builder (~> 2.1.2)
12
+ erubis (~> 2.6.6)
13
+ i18n (~> 0.4)
14
+ rack (~> 1.2.1)
15
+ rack-mount (~> 0.6.13)
16
+ rack-test (~> 0.5.6)
17
+ tzinfo (~> 0.3.23)
18
+ activemodel (3.0.3)
19
+ activesupport (= 3.0.3)
20
+ builder (~> 2.1.2)
21
+ i18n (~> 0.4)
22
+ activerecord (3.0.3)
23
+ activemodel (= 3.0.3)
24
+ activesupport (= 3.0.3)
25
+ arel (~> 2.0.2)
26
+ tzinfo (~> 0.3.23)
27
+ activeresource (3.0.3)
28
+ activemodel (= 3.0.3)
29
+ activesupport (= 3.0.3)
30
+ activesupport (3.0.3)
31
+ arel (2.0.6)
32
+ aruba (0.2.7)
33
+ background_process
34
+ cucumber (~> 0.10.0)
35
+ background_process (1.2)
36
+ builder (2.1.2)
37
+ columnize (0.3.2)
38
+ cucumber (0.10.0)
39
+ builder (>= 2.1.2)
40
+ diff-lcs (~> 1.1.2)
41
+ gherkin (~> 2.3.2)
42
+ json (~> 1.4.6)
43
+ term-ansicolor (~> 1.0.5)
44
+ diff-lcs (1.1.2)
45
+ erubis (2.6.6)
46
+ abstract (>= 1.0.0)
47
+ gherkin (2.3.2)
48
+ json (~> 1.4.6)
49
+ term-ansicolor (~> 1.0.5)
50
+ i18n (0.5.0)
51
+ json (1.4.6)
52
+ linecache (0.43)
53
+ mail (2.2.12)
54
+ activesupport (>= 2.3.6)
55
+ i18n (>= 0.4.0)
56
+ mime-types (~> 1.16)
57
+ treetop (~> 1.4.8)
58
+ mime-types (1.16)
59
+ polyglot (0.3.1)
60
+ rack (1.2.1)
61
+ rack-mount (0.6.13)
62
+ rack (>= 1.0.0)
63
+ rack-test (0.5.6)
64
+ rack (>= 1.0)
65
+ rails (3.0.3)
66
+ actionmailer (= 3.0.3)
67
+ actionpack (= 3.0.3)
68
+ activerecord (= 3.0.3)
69
+ activeresource (= 3.0.3)
70
+ activesupport (= 3.0.3)
71
+ bundler (~> 1.0)
72
+ railties (= 3.0.3)
73
+ railties (3.0.3)
74
+ actionpack (= 3.0.3)
75
+ activesupport (= 3.0.3)
76
+ rake (>= 0.8.7)
77
+ thor (~> 0.14.4)
78
+ rake (0.8.7)
79
+ rspec (2.3.0)
80
+ rspec-core (~> 2.3.0)
81
+ rspec-expectations (~> 2.3.0)
82
+ rspec-mocks (~> 2.3.0)
83
+ rspec-core (2.3.0)
84
+ rspec-expectations (2.3.0)
85
+ diff-lcs (~> 1.1.2)
86
+ rspec-mocks (2.3.0)
87
+ ruby-debug (0.10.4)
88
+ columnize (>= 0.1)
89
+ ruby-debug-base (~> 0.10.4.0)
90
+ ruby-debug-base (0.10.4)
91
+ linecache (>= 0.3)
92
+ sqlite3-ruby (1.3.2)
93
+ term-ansicolor (1.0.5)
94
+ thor (0.14.6)
95
+ treetop (1.4.9)
96
+ polyglot (>= 0.3.1)
97
+ tzinfo (0.3.23)
98
+
99
+ PLATFORMS
100
+ ruby
101
+
102
+ DEPENDENCIES
103
+ aruba
104
+ cucumber
105
+ rails (= 3.0.3)
106
+ rspec
107
+ ruby-debug
108
+ sqlite3-ruby
@@ -0,0 +1,95 @@
1
+ shoulda
2
+ ===================================================
3
+
4
+ The shoulda gem is a meta gem with two dependencies:
5
+
6
+ * [shoulda-context](https://github.com/thoughtbot/shoulda-context)
7
+ * [shoulda-matchers](https://github.com/thoughtbot/shoulda-matchers)
8
+
9
+ Official documentation for each gem:
10
+
11
+ * [shoulda-context](http://rubydoc.info/github/thoughtbot/shoulda-context/master/frames)
12
+ * [shoulda-matchers](http://rubydoc.info/github/thoughtbot/shoulda-matchers/master/frames)
13
+
14
+ The following describes different use cases and combinations.
15
+
16
+ rspec with shoulda-matchers
17
+ ---------------------------
18
+
19
+ This is what thoughtbot currently does. We write tests like:
20
+
21
+ describe Post do
22
+ it { should belong_to(:user) }
23
+ it { should validate_presence_of(:title) }
24
+ end
25
+
26
+ The belong_to and validate_presence_of methods are the matchers.
27
+ All matchers are Rails 3-specific.
28
+
29
+ Add rspec-rails and shoulda-matchers to the project's Gemfile:
30
+
31
+ only :test do
32
+ gem 'rspec-rails'
33
+ gem 'shoulda-matchers'
34
+ end
35
+
36
+ test/unit with shoulda
37
+ ----------------------
38
+
39
+ For the folks who prefer Test::Unit, they'd write tests like:
40
+
41
+ class UserTest < Test::Unit::TestCase
42
+ should have_many(:posts)
43
+ should_not allow_value("blah").for(:email)
44
+ end
45
+
46
+ The have_many and allow_value methods are the same kind of matchers
47
+ seen in the RSpec example. They come from the shoulda-matchers gem.
48
+
49
+ Add shoulda to the project's Gemfile:
50
+
51
+ only :test do
52
+ gem 'shoulda'
53
+ end
54
+
55
+ test/unit with shoulda-context
56
+ ------------------------------
57
+
58
+ If you're not testing a Rails project or don't want to use the matchers,
59
+ you can use shoulda-context independently to write tests like:
60
+
61
+ class CalculatorTest < Test::Unit::TestCase
62
+ context "a calculator" do
63
+ setup do
64
+ @calculator = Calculator.new
65
+ end
66
+
67
+ should "add two numbers for the sum" do
68
+ assert_equal 4, @calculator.sum(2, 2)
69
+ end
70
+
71
+ should "multiply two numbers for the product" do
72
+ assert_equal 10, @calculator.product(2, 5)
73
+ end
74
+ end
75
+ end
76
+
77
+ Add shoulda-context to the project's Gemfile:
78
+
79
+ only :test do
80
+ gem 'shoulda-context'
81
+ end
82
+
83
+ Credits
84
+ -------
85
+
86
+ ![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
87
+
88
+ Shoulda is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
89
+
90
+ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
91
+
92
+ License
93
+ -------
94
+
95
+ Shoulda is Copyright © 2006-2011 Tammer Saleh, thoughtbot. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
data/Rakefile CHANGED
@@ -1,36 +1,11 @@
1
1
  require 'rubygems'
2
+ require 'bundler/setup'
2
3
  require 'rake'
3
- require 'rake/testtask'
4
- require 'rake/rdoctask'
5
4
  require 'rake/gempackagetask'
6
5
  require 'cucumber/rake/task'
7
6
 
8
7
  $LOAD_PATH.unshift("lib")
9
8
  require 'shoulda/version'
10
- load 'tasks/shoulda.rake'
11
-
12
- # Test::Unit::UI::VERBOSE
13
- test_files_pattern = 'test/{unit,functional,other,matchers}/**/*_test.rb'
14
- Rake::TestTask.new do |t|
15
- t.libs << 'lib' << 'test'
16
- t.pattern = test_files_pattern
17
- t.verbose = false
18
- end
19
-
20
- Rake::RDocTask.new { |rdoc|
21
- rdoc.rdoc_dir = 'doc'
22
- rdoc.title = "Shoulda -- Making tests easy on the fingers and eyes"
23
- rdoc.options << '--line-numbers'
24
- rdoc.template = "#{ENV['template']}.rb" if ENV['template']
25
- rdoc.rdoc_files.include('README.rdoc', 'CONTRIBUTION_GUIDELINES.rdoc', 'lib/**/*.rb')
26
- }
27
-
28
- desc "Run code-coverage analysis using rcov"
29
- task :coverage do
30
- rm_rf "coverage"
31
- files = Dir[test_files_pattern]
32
- system "rcov --rails --sort coverage -Ilib #{files.join(' ')}"
33
- end
34
9
 
35
10
  eval("$specification = begin; #{IO.read('shoulda.gemspec')}; end")
36
11
  Rake::GemPackageTask.new $specification do |pkg|
@@ -41,30 +16,11 @@ end
41
16
  desc "Clean files generated by rake tasks"
42
17
  task :clobber => [:clobber_rdoc, :clobber_package]
43
18
 
44
- namespace :cucumber do
45
- Cucumber::Rake::Task.new(:rails2, "Run the cucumber features in Rails 2") do |t|
46
- t.fork = true
47
- t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
48
- t.profile = 'rails2'
49
- end
50
-
51
- Cucumber::Rake::Task.new(:rails3, "Run the cucumber features in Rails 3") do |t|
52
- t.fork = true
53
- t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
54
- t.profile = 'rails3'
55
- end
56
- end
57
-
58
- desc "Run the cucumber features in both Rails 2 and 3"
59
- task :cucumber => ["cucumber:rails2", "cucumber:rails3"]
60
-
61
- desc 'run tests for all supported versions of Rails'
62
- task :test_all do
63
- %w(2.3.8 3.0.0.beta4).each do |version|
64
- system("RAILS_VERSION=#{version} rake -s test;")
65
- end
19
+ Cucumber::Rake::Task.new do |t|
20
+ t.fork = true
21
+ t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
66
22
  end
67
23
 
68
- desc 'Default: run test and cucumber features for support versions'
69
- task :default => [:test_all, :cucumber]
24
+ desc 'Default: run cucumber features'
25
+ task :default => [:cucumber]
70
26
 
@@ -1,4 +1,4 @@
1
1
  module Shoulda
2
- VERSION = "2.11.3"
2
+ VERSION = "3.0.0.beta1"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoulda
3
3
  version: !ruby/object:Gem::Version
4
- hash: 37
5
- prerelease: false
4
+ hash: 299253629
5
+ prerelease: true
6
6
  segments:
7
- - 2
8
- - 11
9
7
  - 3
10
- version: 2.11.3
8
+ - 0
9
+ - 0
10
+ - beta1
11
+ version: 3.0.0.beta1
11
12
  platform: ruby
12
13
  authors:
13
14
  - Tammer Saleh
@@ -19,280 +20,60 @@ autorequire:
19
20
  bindir: bin
20
21
  cert_chain: []
21
22
 
22
- date: 2010-08-02 00:00:00 -04:00
23
- default_executable: convert_to_should_syntax
24
- dependencies: []
25
-
23
+ date: 2011-01-19 00:00:00 -05:00
24
+ default_executable:
25
+ dependencies:
26
+ - !ruby/object:Gem::Dependency
27
+ type: :runtime
28
+ prerelease: false
29
+ name: shoulda-context
30
+ version_requirements: &id001 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ hash: 299253597
36
+ segments:
37
+ - 1
38
+ - 0
39
+ - 0
40
+ - beta1
41
+ version: 1.0.0.beta1
42
+ requirement: *id001
43
+ - !ruby/object:Gem::Dependency
44
+ type: :runtime
45
+ prerelease: false
46
+ name: shoulda-matchers
47
+ version_requirements: &id002 !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ~>
51
+ - !ruby/object:Gem::Version
52
+ hash: 299253597
53
+ segments:
54
+ - 1
55
+ - 0
56
+ - 0
57
+ - beta1
58
+ version: 1.0.0.beta1
59
+ requirement: *id002
26
60
  description: Making tests easy on the fingers and eyes
27
61
  email: support@thoughtbot.com
28
- executables:
29
- - convert_to_should_syntax
62
+ executables: []
63
+
30
64
  extensions: []
31
65
 
32
66
  extra_rdoc_files:
33
- - README.rdoc
67
+ - README.md
34
68
  - CONTRIBUTION_GUIDELINES.rdoc
35
69
  files:
36
70
  - CONTRIBUTION_GUIDELINES.rdoc
71
+ - Gemfile
72
+ - Gemfile.lock
37
73
  - MIT-LICENSE
38
74
  - Rakefile
39
- - README.rdoc
40
- - bin/convert_to_should_syntax
41
- - lib/shoulda/action_controller/macros.rb
42
- - lib/shoulda/action_controller/matchers/assign_to_matcher.rb
43
- - lib/shoulda/action_controller/matchers/filter_param_matcher.rb
44
- - lib/shoulda/action_controller/matchers/redirect_to_matcher.rb
45
- - lib/shoulda/action_controller/matchers/render_template_matcher.rb
46
- - lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb
47
- - lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb
48
- - lib/shoulda/action_controller/matchers/respond_with_matcher.rb
49
- - lib/shoulda/action_controller/matchers/route_matcher.rb
50
- - lib/shoulda/action_controller/matchers/set_session_matcher.rb
51
- - lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb
52
- - lib/shoulda/action_controller/matchers.rb
53
- - lib/shoulda/action_controller.rb
54
- - lib/shoulda/action_mailer/assertions.rb
55
- - lib/shoulda/action_mailer/matchers/have_sent_email.rb
56
- - lib/shoulda/action_mailer/matchers.rb
57
- - lib/shoulda/action_mailer.rb
58
- - lib/shoulda/active_record/assertions.rb
59
- - lib/shoulda/active_record/helpers.rb
60
- - lib/shoulda/active_record/macros.rb
61
- - lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb
62
- - lib/shoulda/active_record/matchers/allow_value_matcher.rb
63
- - lib/shoulda/active_record/matchers/association_matcher.rb
64
- - lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb
65
- - lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb
66
- - lib/shoulda/active_record/matchers/have_db_column_matcher.rb
67
- - lib/shoulda/active_record/matchers/have_db_index_matcher.rb
68
- - lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb
69
- - lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb
70
- - lib/shoulda/active_record/matchers/validate_format_of_matcher.rb
71
- - lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb
72
- - lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb
73
- - lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb
74
- - lib/shoulda/active_record/matchers/validation_matcher.rb
75
- - lib/shoulda/active_record/matchers.rb
76
- - lib/shoulda/active_record.rb
77
- - lib/shoulda/assertions.rb
78
- - lib/shoulda/autoload_macros.rb
79
- - lib/shoulda/context.rb
80
- - lib/shoulda/helpers.rb
81
- - lib/shoulda/integrations/rspec.rb
82
- - lib/shoulda/integrations/rspec2.rb
83
- - lib/shoulda/integrations/test_unit.rb
84
- - lib/shoulda/macros.rb
85
- - lib/shoulda/private_helpers.rb
86
- - lib/shoulda/proc_extensions.rb
87
- - lib/shoulda/rails.rb
88
- - lib/shoulda/tasks/list_tests.rake
89
- - lib/shoulda/tasks/yaml_to_shoulda.rake
90
- - lib/shoulda/tasks.rb
75
+ - README.md
91
76
  - lib/shoulda/version.rb
92
- - lib/shoulda.rb
93
- - rails/init.rb
94
- - test/fail_macros.rb
95
- - test/fixtures/addresses.yml
96
- - test/fixtures/friendships.yml
97
- - test/fixtures/posts.yml
98
- - test/fixtures/products.yml
99
- - test/fixtures/taggings.yml
100
- - test/fixtures/tags.yml
101
- - test/fixtures/users.yml
102
- - test/functional/posts_controller_test.rb
103
- - test/functional/users_controller_test.rb
104
- - test/matchers/action_mailer/have_sent_email_test.rb
105
- - test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb
106
- - test/matchers/active_record/allow_value_matcher_test.rb
107
- - test/matchers/active_record/association_matcher_test.rb
108
- - test/matchers/active_record/ensure_inclusion_of_matcher_test.rb
109
- - test/matchers/active_record/ensure_length_of_matcher_test.rb
110
- - test/matchers/active_record/have_db_column_matcher_test.rb
111
- - test/matchers/active_record/have_db_index_matcher_test.rb
112
- - test/matchers/active_record/have_readonly_attributes_matcher_test.rb
113
- - test/matchers/active_record/validate_acceptance_of_matcher_test.rb
114
- - test/matchers/active_record/validate_format_of_matcher_test.rb
115
- - test/matchers/active_record/validate_numericality_of_matcher_test.rb
116
- - test/matchers/active_record/validate_presence_of_matcher_test.rb
117
- - test/matchers/active_record/validate_uniqueness_of_matcher_test.rb
118
- - test/matchers/controller/assign_to_matcher_test.rb
119
- - test/matchers/controller/filter_param_matcher_test.rb
120
- - test/matchers/controller/redirect_to_matcher_test.rb
121
- - test/matchers/controller/render_template_matcher_test.rb
122
- - test/matchers/controller/render_with_layout_matcher_test.rb
123
- - test/matchers/controller/respond_with_content_type_matcher_test.rb
124
- - test/matchers/controller/respond_with_matcher_test.rb
125
- - test/matchers/controller/route_matcher_test.rb
126
- - test/matchers/controller/set_session_matcher_test.rb
127
- - test/matchers/controller/set_the_flash_matcher.rb
128
- - test/other/autoload_macro_test.rb
129
- - test/other/context_test.rb
130
- - test/other/convert_to_should_syntax_test.rb
131
- - test/other/helpers_test.rb
132
- - test/other/private_helpers_test.rb
133
- - test/other/should_test.rb
134
- - test/rails2_model_builder.rb
135
- - test/rails2_root/app/controllers/application_controller.rb
136
- - test/rails2_root/app/controllers/posts_controller.rb
137
- - test/rails2_root/app/controllers/users_controller.rb
138
- - test/rails2_root/app/helpers/application_helper.rb
139
- - test/rails2_root/app/helpers/posts_helper.rb
140
- - test/rails2_root/app/helpers/users_helper.rb
141
- - test/rails2_root/app/models/address.rb
142
- - test/rails2_root/app/models/flea.rb
143
- - test/rails2_root/app/models/friendship.rb
144
- - test/rails2_root/app/models/notifier.rb
145
- - test/rails2_root/app/models/pets/cat.rb
146
- - test/rails2_root/app/models/pets/dog.rb
147
- - test/rails2_root/app/models/post.rb
148
- - test/rails2_root/app/models/product.rb
149
- - test/rails2_root/app/models/profile.rb
150
- - test/rails2_root/app/models/registration.rb
151
- - test/rails2_root/app/models/tag.rb
152
- - test/rails2_root/app/models/tagging.rb
153
- - test/rails2_root/app/models/treat.rb
154
- - test/rails2_root/app/models/user.rb
155
- - test/rails2_root/app/views/layouts/posts.rhtml
156
- - test/rails2_root/app/views/layouts/users.rhtml
157
- - test/rails2_root/app/views/layouts/wide.html.erb
158
- - test/rails2_root/app/views/notifier/the_email.html.erb
159
- - test/rails2_root/app/views/posts/edit.rhtml
160
- - test/rails2_root/app/views/posts/index.rhtml
161
- - test/rails2_root/app/views/posts/new.rhtml
162
- - test/rails2_root/app/views/posts/show.rhtml
163
- - test/rails2_root/app/views/users/edit.rhtml
164
- - test/rails2_root/app/views/users/index.rhtml
165
- - test/rails2_root/app/views/users/new.rhtml
166
- - test/rails2_root/app/views/users/show.rhtml
167
- - test/rails2_root/config/boot.rb
168
- - test/rails2_root/config/database.yml
169
- - test/rails2_root/config/environment.rb
170
- - test/rails2_root/config/environments/test.rb
171
- - test/rails2_root/config/initializers/new_rails_defaults.rb
172
- - test/rails2_root/config/initializers/shoulda.rb
173
- - test/rails2_root/config/routes.rb
174
- - test/rails2_root/db/migrate/001_create_users.rb
175
- - test/rails2_root/db/migrate/002_create_posts.rb
176
- - test/rails2_root/db/migrate/003_create_taggings.rb
177
- - test/rails2_root/db/migrate/004_create_tags.rb
178
- - test/rails2_root/db/migrate/005_create_dogs.rb
179
- - test/rails2_root/db/migrate/006_create_addresses.rb
180
- - test/rails2_root/db/migrate/007_create_fleas.rb
181
- - test/rails2_root/db/migrate/008_create_dogs_fleas.rb
182
- - test/rails2_root/db/migrate/009_create_products.rb
183
- - test/rails2_root/db/migrate/010_create_friendships.rb
184
- - test/rails2_root/db/migrate/011_create_treats.rb
185
- - test/rails2_root/db/migrate/20090506203502_create_profiles.rb
186
- - test/rails2_root/db/migrate/20090506203536_create_registrations.rb
187
- - test/rails2_root/db/migrate/20090513104502_create_cats.rb
188
- - test/rails2_root/db/schema.rb
189
- - test/rails2_root/log/test.log
190
- - test/rails2_root/public/404.html
191
- - test/rails2_root/public/422.html
192
- - test/rails2_root/public/500.html
193
- - test/rails2_root/script/console
194
- - test/rails2_root/script/generate
195
- - test/rails2_root/test/shoulda_macros/custom_macro.rb
196
- - test/rails2_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb
197
- - test/rails2_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb
198
- - test/rails2_test_helper.rb
199
- - test/rails3_model_builder.rb
200
- - test/rails3_root/app/controllers/application_controller.rb
201
- - test/rails3_root/app/controllers/posts_controller.rb
202
- - test/rails3_root/app/controllers/users_controller.rb
203
- - test/rails3_root/app/helpers/application_helper.rb
204
- - test/rails3_root/app/models/address.rb
205
- - test/rails3_root/app/models/flea.rb
206
- - test/rails3_root/app/models/friendship.rb
207
- - test/rails3_root/app/models/notifier.rb
208
- - test/rails3_root/app/models/pets/cat.rb
209
- - test/rails3_root/app/models/pets/dog.rb
210
- - test/rails3_root/app/models/post.rb
211
- - test/rails3_root/app/models/product.rb
212
- - test/rails3_root/app/models/profile.rb
213
- - test/rails3_root/app/models/registration.rb
214
- - test/rails3_root/app/models/tag.rb
215
- - test/rails3_root/app/models/tagging.rb
216
- - test/rails3_root/app/models/treat.rb
217
- - test/rails3_root/app/models/user.rb
218
- - test/rails3_root/app/views/layouts/application.html.erb
219
- - test/rails3_root/app/views/layouts/posts.rhtml
220
- - test/rails3_root/app/views/layouts/users.rhtml
221
- - test/rails3_root/app/views/layouts/wide.html.erb
222
- - test/rails3_root/app/views/notifier/the_email.html.erb
223
- - test/rails3_root/app/views/posts/edit.rhtml
224
- - test/rails3_root/app/views/posts/index.rhtml
225
- - test/rails3_root/app/views/posts/new.rhtml
226
- - test/rails3_root/app/views/posts/show.rhtml
227
- - test/rails3_root/app/views/users/edit.rhtml
228
- - test/rails3_root/app/views/users/index.rhtml
229
- - test/rails3_root/app/views/users/new.rhtml
230
- - test/rails3_root/app/views/users/show.rhtml
231
- - test/rails3_root/config/application.rb
232
- - test/rails3_root/config/boot.rb
233
- - test/rails3_root/config/database.yml
234
- - test/rails3_root/config/environment.rb
235
- - test/rails3_root/config/environments/development.rb
236
- - test/rails3_root/config/environments/production.rb
237
- - test/rails3_root/config/environments/test.rb
238
- - test/rails3_root/config/initializers/backtrace_silencers.rb
239
- - test/rails3_root/config/initializers/inflections.rb
240
- - test/rails3_root/config/initializers/mime_types.rb
241
- - test/rails3_root/config/initializers/secret_token.rb
242
- - test/rails3_root/config/initializers/session_store.rb
243
- - test/rails3_root/config/locales/en.yml
244
- - test/rails3_root/config/routes.rb
245
- - test/rails3_root/config.ru
246
- - test/rails3_root/db/migrate/001_create_users.rb
247
- - test/rails3_root/db/migrate/002_create_posts.rb
248
- - test/rails3_root/db/migrate/003_create_taggings.rb
249
- - test/rails3_root/db/migrate/004_create_tags.rb
250
- - test/rails3_root/db/migrate/005_create_dogs.rb
251
- - test/rails3_root/db/migrate/006_create_addresses.rb
252
- - test/rails3_root/db/migrate/007_create_fleas.rb
253
- - test/rails3_root/db/migrate/008_create_dogs_fleas.rb
254
- - test/rails3_root/db/migrate/009_create_products.rb
255
- - test/rails3_root/db/migrate/010_create_friendships.rb
256
- - test/rails3_root/db/migrate/011_create_treats.rb
257
- - test/rails3_root/db/migrate/20090506203502_create_profiles.rb
258
- - test/rails3_root/db/migrate/20090506203536_create_registrations.rb
259
- - test/rails3_root/db/migrate/20090513104502_create_cats.rb
260
- - test/rails3_root/db/seeds.rb
261
- - test/rails3_root/db/test.sqlite3
262
- - test/rails3_root/Gemfile
263
- - test/rails3_root/log/test.log
264
- - test/rails3_root/public/404.html
265
- - test/rails3_root/public/422.html
266
- - test/rails3_root/public/500.html
267
- - test/rails3_root/public/favicon.ico
268
- - test/rails3_root/public/images/rails.png
269
- - test/rails3_root/public/index.html
270
- - test/rails3_root/public/javascripts/application.js
271
- - test/rails3_root/public/javascripts/controls.js
272
- - test/rails3_root/public/javascripts/dragdrop.js
273
- - test/rails3_root/public/javascripts/effects.js
274
- - test/rails3_root/public/javascripts/prototype.js
275
- - test/rails3_root/public/javascripts/rails.js
276
- - test/rails3_root/public/robots.txt
277
- - test/rails3_root/Rakefile
278
- - test/rails3_root/README
279
- - test/rails3_root/script/rails
280
- - test/rails3_root/test/performance/browsing_test.rb
281
- - test/rails3_root/test/test_helper.rb
282
- - test/rails3_test_helper.rb
283
- - test/README
284
- - test/rspec_test.rb
285
- - test/test_helper.rb
286
- - test/unit/address_test.rb
287
- - test/unit/cat_test.rb
288
- - test/unit/dog_test.rb
289
- - test/unit/flea_test.rb
290
- - test/unit/friendship_test.rb
291
- - test/unit/post_test.rb
292
- - test/unit/product_test.rb
293
- - test/unit/tag_test.rb
294
- - test/unit/tagging_test.rb
295
- - test/unit/user_test.rb
296
77
  has_rdoc: true
297
78
  homepage: http://thoughtbot.com/community/
298
79
  licenses: []
@@ -301,7 +82,7 @@ post_install_message:
301
82
  rdoc_options:
302
83
  - --line-numbers
303
84
  - --main
304
- - README.rdoc
85
+ - README.md
305
86
  require_paths:
306
87
  - lib
307
88
  required_ruby_version: !ruby/object:Gem::Requirement