spree 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of spree might be problematic. Click here for more details.

Files changed (211) hide show
  1. data/History.txt +5 -0
  2. data/Manifest.txt +158 -21
  3. data/config/hoe.rb +2 -1
  4. data/lib/spree/version.rb +1 -1
  5. data/starter-app/app/views/layouts/application.rhtml +6 -4
  6. data/starter-app/db/sample/line_items.yml +6 -4
  7. data/starter-app/db/sample/{variations.yml → variants.yml} +16 -0
  8. data/starter-app/log/README +1 -0
  9. data/starter-app/public/images/spree.jpg +0 -0
  10. data/starter-app/public/stylesheets/application.css +2 -2
  11. data/starter-app/script/spec +4 -0
  12. data/starter-app/script/spec_server +102 -0
  13. data/starter-app/spec/models/cart_item_spec.rb +50 -0
  14. data/starter-app/spec/models/cart_spec.rb +51 -0
  15. data/starter-app/spec/models/line_item_spec.rb +33 -0
  16. data/starter-app/spec/models/product_spec.rb +29 -0
  17. data/starter-app/spec/rcov.opts +2 -0
  18. data/starter-app/spec/spec.opts +6 -0
  19. data/starter-app/spec/spec_helper.rb +39 -0
  20. data/starter-app/stories/all.rb +4 -0
  21. data/starter-app/stories/helper.rb +3 -0
  22. data/starter-app/vendor/plugins/rspec_on_rails/MIT-LICENSE +31 -0
  23. data/starter-app/vendor/plugins/rspec_on_rails/README +3 -0
  24. data/starter-app/vendor/plugins/rspec_on_rails/Rakefile +9 -0
  25. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/CHANGES +1 -0
  26. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/rspec_generator.rb +35 -0
  27. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/all_stories.rb +4 -0
  28. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/previous_failures.txt +0 -0
  29. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/rcov.opts +2 -0
  30. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/script/spec +4 -0
  31. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/script/spec_server +102 -0
  32. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/spec.opts +6 -0
  33. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/spec_helper.rb +39 -0
  34. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/stories_helper.rb +3 -0
  35. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_controller/USAGE +33 -0
  36. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_controller/rspec_controller_generator.rb +49 -0
  37. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_controller/templates/controller_spec.rb +25 -0
  38. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_controller/templates/helper_spec.rb +11 -0
  39. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_controller/templates/view_spec.rb +12 -0
  40. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_model/USAGE +18 -0
  41. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb +30 -0
  42. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_model/templates/model_spec.rb +11 -0
  43. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/rspec_scaffold_generator.rb +167 -0
  44. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/controller_spec.rb +313 -0
  45. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/edit_erb_spec.rb +25 -0
  46. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/helper_spec.rb +11 -0
  47. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/index_erb_spec.rb +22 -0
  48. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/new_erb_spec.rb +26 -0
  49. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/routing_spec.rb +61 -0
  50. data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/show_erb_spec.rb +22 -0
  51. data/starter-app/vendor/plugins/rspec_on_rails/init.rb +9 -0
  52. data/starter-app/vendor/plugins/rspec_on_rails/lib/autotest/discover.rb +1 -0
  53. data/starter-app/vendor/plugins/rspec_on_rails/lib/autotest/rails_rspec.rb +81 -0
  54. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails.rb +51 -0
  55. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example.rb +47 -0
  56. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb +42 -0
  57. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/controller_example_group.rb +255 -0
  58. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/functional_example_group.rb +66 -0
  59. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/helper_example_group.rb +82 -0
  60. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/ivar_proxy.rb +62 -0
  61. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/model_example_group.rb +14 -0
  62. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/rails_example_group.rb +68 -0
  63. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/render_observer.rb +90 -0
  64. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/view_example_group.rb +171 -0
  65. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions.rb +12 -0
  66. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_controller/base.rb +14 -0
  67. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_controller/rescue.rb +21 -0
  68. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_controller/test_response.rb +11 -0
  69. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_view/base.rb +27 -0
  70. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/active_record/base.rb +30 -0
  71. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/object.rb +5 -0
  72. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/spec/example/configuration.rb +66 -0
  73. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/spec/matchers/have.rb +21 -0
  74. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers.rb +29 -0
  75. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/assert_select.rb +130 -0
  76. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/have_text.rb +55 -0
  77. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/redirect_to.rb +113 -0
  78. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/render_template.rb +70 -0
  79. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/story_adapter.rb +71 -0
  80. data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/version.rb +23 -0
  81. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/autotest/mappings_spec.rb +36 -0
  82. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/autotest/rails_rspec_spec.rb +8 -0
  83. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/assigns_hash_proxy_spec.rb +55 -0
  84. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/configuration_spec.rb +83 -0
  85. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb +43 -0
  86. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/controller_spec_spec.rb +187 -0
  87. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/example_group_factory_spec.rb +112 -0
  88. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/helper_spec_spec.rb +118 -0
  89. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/ivar_proxy_spec.rb +64 -0
  90. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/model_spec_spec.rb +18 -0
  91. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/shared_behaviour_spec.rb +16 -0
  92. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/test_unit_assertion_accessibility_spec.rb +33 -0
  93. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/view_spec_spec.rb +263 -0
  94. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_controller_rescue_action_spec.rb +54 -0
  95. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb +48 -0
  96. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/extensions/active_record_spec.rb +14 -0
  97. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/assert_select_spec.rb +783 -0
  98. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/description_generation_spec.rb +37 -0
  99. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/errors_on_spec.rb +13 -0
  100. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/have_text_spec.rb +62 -0
  101. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/redirect_to_spec.rb +203 -0
  102. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/render_spec.rb +169 -0
  103. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/mocks/mock_model_spec.rb +65 -0
  104. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/sample_spec.rb +7 -0
  105. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/spec_server_spec.rb +89 -0
  106. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/spec_spec.rb +11 -0
  107. data/starter-app/vendor/plugins/rspec_on_rails/spec/rails_suite.rb +7 -0
  108. data/starter-app/vendor/plugins/rspec_on_rails/spec/spec_helper.rb +46 -0
  109. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/controllers/action_view_base_spec_controller.rb +2 -0
  110. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/controllers/controller_spec_controller.rb +56 -0
  111. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/controllers/redirect_spec_controller.rb +59 -0
  112. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/controllers/render_spec_controller.rb +26 -0
  113. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/controllers/rjs_spec_controller.rb +58 -0
  114. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/helpers/explicit_helper.rb +10 -0
  115. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/helpers/more_explicit_helper.rb +5 -0
  116. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/helpers/plugin_application_helper.rb +6 -0
  117. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/helpers/view_spec_helper.rb +13 -0
  118. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/_partial.rhtml +0 -0
  119. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml +1 -0
  120. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml +1 -0
  121. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml +0 -0
  122. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_errors_in_template.rhtml +1 -0
  123. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_template.rhtml +1 -0
  124. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/_a_partial.rhtml +0 -0
  125. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.js.rjs +1 -0
  126. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rhtml +0 -0
  127. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rjs +1 -0
  128. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/_replacement_partial.rhtml +1 -0
  129. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_div.rjs +1 -0
  130. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_page_element.rjs +1 -0
  131. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/insert_html.rjs +1 -0
  132. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace.rjs +1 -0
  133. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html.rjs +1 -0
  134. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html_with_partial.rjs +1 -0
  135. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_effect.rjs +1 -0
  136. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_toggle_effect.rjs +1 -0
  137. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/no_tags.rhtml +1 -0
  138. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml +1 -0
  139. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml +1 -0
  140. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial.rhtml +2 -0
  141. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_used_twice.rhtml +0 -0
  142. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_local_variable.rhtml +1 -0
  143. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_sub_partial.rhtml +1 -0
  144. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_spacer.rhtml +1 -0
  145. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/accessor.rhtml +3 -0
  146. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/entry_form.rhtml +2 -0
  147. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/explicit_helper.rhtml +2 -0
  148. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/foo/show.rhtml +1 -0
  149. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/implicit_helper.rhtml +2 -0
  150. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/multiple_helpers.rhtml +3 -0
  151. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial.rhtml +5 -0
  152. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_using_collection.rhtml +3 -0
  153. data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_with_array.rhtml +1 -0
  154. data/starter-app/vendor/plugins/rspec_on_rails/stories/all.rb +10 -0
  155. data/starter-app/vendor/plugins/rspec_on_rails/stories/helper.rb +5 -0
  156. data/starter-app/vendor/plugins/rspec_on_rails/stories/steps/people.rb +8 -0
  157. data/starter-app/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback +15 -0
  158. data/starter-app/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback.rb +25 -0
  159. data/starter-app/vendor/plugins/rspec_on_rails/tasks/rspec.rake +137 -0
  160. data/starter-app/vendor/plugins/spree/LICENSE +1 -1
  161. data/starter-app/vendor/plugins/spree/app/controllers/admin/categories_controller.rb +0 -24
  162. data/starter-app/vendor/plugins/spree/app/controllers/admin/products_controller.rb +16 -16
  163. data/starter-app/vendor/plugins/spree/app/controllers/cart_controller.rb +2 -8
  164. data/starter-app/vendor/plugins/spree/app/helpers/admin/products_helper.rb +1 -1
  165. data/starter-app/vendor/plugins/spree/app/helpers/spree/base_helper.rb +2 -2
  166. data/starter-app/vendor/plugins/spree/app/models/cart.rb +7 -20
  167. data/starter-app/vendor/plugins/spree/app/models/cart_item.rb +3 -6
  168. data/starter-app/vendor/plugins/spree/app/models/category.rb +6 -22
  169. data/starter-app/vendor/plugins/spree/app/models/line_item.rb +3 -5
  170. data/starter-app/vendor/plugins/spree/app/models/option_value.rb +1 -1
  171. data/starter-app/vendor/plugins/spree/app/models/product.rb +18 -2
  172. data/starter-app/vendor/plugins/spree/app/models/variant.rb +5 -0
  173. data/starter-app/vendor/plugins/spree/app/views/admin/categories/_form.rhtml +1 -5
  174. data/starter-app/vendor/plugins/spree/app/views/admin/overview/index.rhtml +3 -0
  175. data/starter-app/vendor/plugins/spree/app/views/admin/products/_form.rhtml +2 -2
  176. data/starter-app/vendor/plugins/spree/app/views/admin/products/{_new_variation.rhtml → _new_variant.rhtml} +1 -1
  177. data/starter-app/vendor/plugins/spree/app/views/admin/products/_variants.rhtml +43 -0
  178. data/starter-app/vendor/plugins/spree/app/views/cart/index.rhtml +4 -4
  179. data/starter-app/vendor/plugins/spree/app/views/layouts/admin.rhtml +1 -1
  180. data/starter-app/vendor/plugins/spree/app/views/order_mailer/cancel.rhtml +1 -1
  181. data/starter-app/vendor/plugins/spree/app/views/order_mailer/confirm.rhtml +1 -1
  182. data/starter-app/vendor/plugins/spree/app/views/shared/_order_details.rhtml +1 -1
  183. data/starter-app/vendor/plugins/spree/app/views/store/show.rhtml +30 -29
  184. data/starter-app/vendor/plugins/spree/assets/images/spree/spree.jpg +0 -0
  185. data/starter-app/vendor/plugins/spree/assets/stylesheets/spree-admin.css +1 -1
  186. data/starter-app/vendor/plugins/spree/assets/stylesheets/store/_controller.css +1 -1
  187. data/starter-app/vendor/plugins/spree/db/migrate/002_create_cart_items.rb +1 -2
  188. data/starter-app/vendor/plugins/spree/db/migrate/006_create_line_items.rb +5 -7
  189. data/starter-app/vendor/plugins/spree/db/migrate/011_create_variants.rb +11 -0
  190. data/starter-app/vendor/plugins/spree/db/migrate/018_create_option_values_variants.rb +12 -0
  191. data/starter-app/vendor/plugins/spree/test/unit/product_test.rb +0 -33
  192. metadata +170 -23
  193. data/starter-app/vendor/plugins/spree/app/controllers/admin/variations_controller.rb +0 -73
  194. data/starter-app/vendor/plugins/spree/app/helpers/admin/variations_helper.rb +0 -2
  195. data/starter-app/vendor/plugins/spree/app/models/variation.rb +0 -8
  196. data/starter-app/vendor/plugins/spree/app/views/admin/option_types/test.rhtml +0 -8
  197. data/starter-app/vendor/plugins/spree/app/views/admin/products/_variations.rhtml +0 -41
  198. data/starter-app/vendor/plugins/spree/app/views/admin/variations/_form.rhtml +0 -33
  199. data/starter-app/vendor/plugins/spree/app/views/admin/variations/_option_values.rhtml +0 -5
  200. data/starter-app/vendor/plugins/spree/app/views/admin/variations/list.rhtml +0 -23
  201. data/starter-app/vendor/plugins/spree/app/views/admin/variations/new.rhtml +0 -14
  202. data/starter-app/vendor/plugins/spree/assets/images/spree/spree_logo142x65.gif +0 -0
  203. data/starter-app/vendor/plugins/spree/assets/images/spree/spree_logo245x112.gif +0 -0
  204. data/starter-app/vendor/plugins/spree/db/migrate/011_create_variations.rb +0 -11
  205. data/starter-app/vendor/plugins/spree/db/migrate/018_create_option_values_variations.rb +0 -12
  206. data/starter-app/vendor/plugins/spree/test/functional/admin/variations_controller_test.rb +0 -18
  207. data/starter-app/vendor/plugins/spree/test/integration/variations_test.rb +0 -24
  208. data/starter-app/vendor/plugins/spree/test/unit/cart_item_test.rb +0 -55
  209. data/starter-app/vendor/plugins/spree/test/unit/cart_test.rb +0 -35
  210. data/starter-app/vendor/plugins/spree/test/unit/line_item_test.rb +0 -61
  211. data/starter-app/vendor/plugins/spree/test/unit/variation_test.rb +0 -9
@@ -0,0 +1,112 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Spec
4
+ module Example
5
+ describe ExampleGroupFactory do
6
+ it "should return a ModelExampleGroup when given :type => :model" do
7
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
8
+ "name", :type => :model
9
+ ) {}
10
+ example_group.superclass.should == Spec::Rails::Example::ModelExampleGroup
11
+ end
12
+
13
+ it "should return a ModelExampleGroup when given :spec_path => '/blah/spec/models/'" do
14
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
15
+ "name", :spec_path => '/blah/spec/models/blah.rb'
16
+ ) {}
17
+ example_group.superclass.should == Spec::Rails::Example::ModelExampleGroup
18
+ end
19
+
20
+ it "should return a ModelExampleGroup when given :spec_path => '\\blah\\spec\\models\\' (windows format)" do
21
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
22
+ "name", :spec_path => '\\blah\\spec\\models\\blah.rb'
23
+ ) {}
24
+ example_group.superclass.should == Spec::Rails::Example::ModelExampleGroup
25
+ end
26
+
27
+ it "should return a RailsExampleGroup when given :spec_path => '/blah/spec/foo/' (anything other than controllers, views and helpers)" do
28
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
29
+ "name", :spec_path => '/blah/spec/foo/blah.rb'
30
+ ) {}
31
+ example_group.superclass.should == Spec::Rails::Example::RailsExampleGroup
32
+ end
33
+
34
+ it "should return a RailsExampleGroup when given :spec_path => '\\blah\\spec\\foo\\' (windows format) (anything other than controllers, views and helpers)" do
35
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
36
+ "name", :spec_path => '\\blah\\spec\\foo\\blah.rb'
37
+ ) {}
38
+ example_group.superclass.should == Spec::Rails::Example::RailsExampleGroup
39
+ end
40
+
41
+ it "should return a ViewExampleGroup when given :type => :model" do
42
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
43
+ "name", :type => :view
44
+ ) {}
45
+ example_group.superclass.should == Spec::Rails::Example::ViewExampleGroup
46
+ end
47
+
48
+ it "should return a ViewExampleGroup when given :spec_path => '/blah/spec/views/'" do
49
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
50
+ "name", :spec_path => '/blah/spec/views/blah.rb'
51
+ ) {}
52
+ example_group.superclass.should == Spec::Rails::Example::ViewExampleGroup
53
+ end
54
+
55
+ it "should return a ModelExampleGroup when given :spec_path => '\\blah\\spec\\views\\' (windows format)" do
56
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
57
+ "name", :spec_path => '\\blah\\spec\\views\\blah.rb'
58
+ ) {}
59
+ example_group.superclass.should == Spec::Rails::Example::ViewExampleGroup
60
+ end
61
+
62
+ it "should return a HelperExampleGroup when given :type => :helper" do
63
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
64
+ "name", :type => :helper
65
+ ) {}
66
+ example_group.superclass.should == Spec::Rails::Example::HelperExampleGroup
67
+ end
68
+
69
+ it "should return a HelperExampleGroup when given :spec_path => '/blah/spec/helpers/'" do
70
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
71
+ "name", :spec_path => '/blah/spec/helpers/blah.rb'
72
+ ) {}
73
+ example_group.superclass.should == Spec::Rails::Example::HelperExampleGroup
74
+ end
75
+
76
+ it "should return a ModelExampleGroup when given :spec_path => '\\blah\\spec\\helpers\\' (windows format)" do
77
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
78
+ "name", :spec_path => '\\blah\\spec\\helpers\\blah.rb'
79
+ ) {}
80
+ example_group.superclass.should == Spec::Rails::Example::HelperExampleGroup
81
+ end
82
+
83
+ it "should return a ControllerExampleGroup when given :type => :controller" do
84
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
85
+ "name", :type => :controller
86
+ ) {}
87
+ example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
88
+ end
89
+
90
+ it "should return a ControllerExampleGroup when given :spec_path => '/blah/spec/controllers/'" do
91
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
92
+ "name", :spec_path => '/blah/spec/controllers/blah.rb'
93
+ ) {}
94
+ example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
95
+ end
96
+
97
+ it "should return a ModelExampleGroup when given :spec_path => '\\blah\\spec\\controllers\\' (windows format)" do
98
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
99
+ "name", :spec_path => '\\blah\\spec\\controllers\\blah.rb'
100
+ ) {}
101
+ example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
102
+ end
103
+
104
+ it "should favor the :type over the :spec_path" do
105
+ example_group = Spec::Example::ExampleGroupFactory.create_example_group(
106
+ "name", :spec_path => '/blah/spec/models/blah.rb', :type => :controller
107
+ ) {}
108
+ example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,118 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ Spec::Runner.configuration.global_fixtures = :people
3
+
4
+ describe ExplicitHelper, :type => :helper do
5
+ it "should not require naming the helper if describe is passed a type" do
6
+ method_in_explicit_helper.should match(/text from a method/)
7
+ end
8
+ end
9
+
10
+ module Spec
11
+ module Rails
12
+ module Example
13
+ describe HelperExampleGroup, :type => :helper do
14
+ helper_name :explicit
15
+
16
+ it "should have direct access to methods defined in helpers" do
17
+ method_in_explicit_helper.should =~ /text from a method/
18
+ end
19
+
20
+ it "should have access to named routes" do
21
+ rspec_on_rails_specs_url.should == "http://test.host/rspec_on_rails_specs"
22
+ rspec_on_rails_specs_path.should == "/rspec_on_rails_specs"
23
+ end
24
+
25
+ it "should fail if the helper method deson't exist" do
26
+ lambda { non_existant_helper_method }.should raise_error(NameError)
27
+ end
28
+ end
29
+
30
+
31
+ describe HelperExampleGroup, "#eval_erb", :type => :helper do
32
+ helper_name :explicit
33
+
34
+ it "should support methods that accept blocks" do
35
+ eval_erb("<% prepend 'foo' do %>bar<% end %>").should == "foobar"
36
+ end
37
+ end
38
+
39
+ describe HelperExampleGroup, ".fixtures", :type => :helper do
40
+ helper_name :explicit
41
+ fixtures :animals
42
+
43
+ it "should load fixtures" do
44
+ pig = animals(:pig)
45
+ pig.class.should == Animal
46
+ end
47
+
48
+ it "should load global fixtures" do
49
+ lachie = people(:lachie)
50
+ lachie.class.should == Person
51
+ end
52
+ end
53
+
54
+ describe HelperExampleGroup, "included modules", :type => :helper do
55
+ helpers = [
56
+ ActionView::Helpers::ActiveRecordHelper,
57
+ ActionView::Helpers::AssetTagHelper,
58
+ ActionView::Helpers::BenchmarkHelper,
59
+ ActionView::Helpers::CacheHelper,
60
+ ActionView::Helpers::CaptureHelper,
61
+ ActionView::Helpers::DateHelper,
62
+ ActionView::Helpers::DebugHelper,
63
+ ActionView::Helpers::FormHelper,
64
+ ActionView::Helpers::FormOptionsHelper,
65
+ ActionView::Helpers::FormTagHelper,
66
+ ActionView::Helpers::JavaScriptHelper,
67
+ ActionView::Helpers::NumberHelper,
68
+ ActionView::Helpers::PrototypeHelper,
69
+ ActionView::Helpers::ScriptaculousHelper,
70
+ ActionView::Helpers::TagHelper,
71
+ ActionView::Helpers::TextHelper,
72
+ ActionView::Helpers::UrlHelper
73
+ ]
74
+ helpers << ActionView::Helpers::PaginationHelper rescue nil #removed for 2.0
75
+ helpers << ActionView::Helpers::JavaScriptMacrosHelper rescue nil #removed for 2.0
76
+ helpers.each do |helper_module|
77
+ it "should include #{helper_module}" do
78
+ self.class.ancestors.should include(helper_module)
79
+ end
80
+ end
81
+ end
82
+
83
+ # TODO: BT - Helper Examples should proxy method_missing to a Rails View instance.
84
+ # When that is done, remove this method
85
+ describe HelperExampleGroup, "#protect_against_forgery?", :type => :helper do
86
+ it "should return false" do
87
+ protect_against_forgery?.should be_false
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+
94
+ module Bug11223
95
+ # see http://rubyforge.org/tracker/index.php?func=detail&aid=11223&group_id=797&atid=3149
96
+ describe 'Accessing flash from helper spec', :type => :helper do
97
+ it 'should not raise an error' do
98
+ lambda { flash['test'] }.should_not raise_error
99
+ end
100
+ end
101
+ end
102
+
103
+ module Spec
104
+ module Rails
105
+ module Example
106
+ describe HelperExampleGroup do
107
+ it "should clear its name from the description" do
108
+ group = describe("foo", :type => :helper) do
109
+ $nested_group = describe("bar") do
110
+ end
111
+ end
112
+ group.description.to_s.should == "foo"
113
+ $nested_group.description.to_s.should == "foo bar"
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,64 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe "IvarProxy setup", :shared => true do
4
+ before do
5
+ @object = Object.new
6
+ @proxy = Spec::Rails::Example::IvarProxy.new(@object)
7
+ end
8
+ end
9
+
10
+ describe "IvarProxy" do
11
+ it_should_behave_like "IvarProxy setup"
12
+
13
+ it "has [] accessor" do
14
+ @proxy['foo'] = 'bar'
15
+ @object.instance_variable_get(:@foo).should == 'bar'
16
+ @proxy['foo'].should == 'bar'
17
+ end
18
+
19
+ it "iterates through each element like a Hash" do
20
+ values = {
21
+ 'foo' => 1,
22
+ 'bar' => 2,
23
+ 'baz' => 3
24
+ }
25
+ @proxy['foo'] = values['foo']
26
+ @proxy['bar'] = values['bar']
27
+ @proxy['baz'] = values['baz']
28
+
29
+ @proxy.each do |key, value|
30
+ key.should == key
31
+ value.should == values[key]
32
+ end
33
+ end
34
+
35
+ it "detects the presence of a key" do
36
+ @proxy['foo'] = 'bar'
37
+ @proxy.has_key?('foo').should == true
38
+ @proxy.has_key?('bar').should == false
39
+ end
40
+ end
41
+
42
+ describe "IvarProxy", "#delete" do
43
+ it_should_behave_like "IvarProxy setup"
44
+
45
+ it "deletes the element with key" do
46
+ @proxy['foo'] = 'bar'
47
+ @proxy.delete('foo').should == 'bar'
48
+ @proxy['foo'].should be_nil
49
+ end
50
+
51
+ it "deletes nil instance variables" do
52
+ @proxy['foo'] = nil
53
+ @object.instance_variables.should include("@foo")
54
+ @proxy.delete('foo').should == nil
55
+ @proxy['foo'].should be_nil
56
+ @object.instance_variables.should_not include("@foo")
57
+ end
58
+
59
+ it "returns nil when key does not exist" do
60
+ @proxy['foo'].should be_nil
61
+ @proxy.delete('foo').should == nil
62
+ @proxy['foo'].should be_nil
63
+ end
64
+ end
@@ -0,0 +1,18 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Spec
4
+ module Rails
5
+ module Example
6
+ describe ModelExampleGroup do
7
+ it "should clear its name from the description" do
8
+ group = describe("foo", :type => :model) do
9
+ $nested_group = describe("bar") do
10
+ end
11
+ end
12
+ group.description.to_s.should == "foo"
13
+ $nested_group.description.to_s.should == "foo bar"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe "A shared view example_group", :shared => true do
4
+ it "should have some tag with some text" do
5
+ response.should have_tag('div', 'This is text from a method in the ViewSpecHelper')
6
+ end
7
+ end
8
+
9
+ describe "A view example_group", :type => :view do
10
+ it_should_behave_like "A shared view example_group"
11
+
12
+ before(:each) do
13
+ render "view_spec/implicit_helper"
14
+ end
15
+ end
16
+
@@ -0,0 +1,33 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe "assert_equal", :shared => true do
4
+ it "like assert_equal" do
5
+ assert_equal 1, 1
6
+ lambda {
7
+ assert_equal 1, 2
8
+ }.should raise_error(Test::Unit::AssertionFailedError)
9
+ end
10
+ end
11
+
12
+ describe "A model spec should be able to access 'test/unit' assertions", :type => :model do
13
+ it_should_behave_like "assert_equal"
14
+ end
15
+
16
+ describe "A view spec should be able to access 'test/unit' assertions", :type => :view do
17
+ it_should_behave_like "assert_equal"
18
+ end
19
+
20
+ describe "A helper spec should be able to access 'test/unit' assertions", :type => :helper do
21
+ it_should_behave_like "assert_equal"
22
+ end
23
+
24
+ describe "A controller spec with integrated views should be able to access 'test/unit' assertions", :type => :controller do
25
+ controller_name :controller_spec
26
+ integrate_views
27
+ it_should_behave_like "assert_equal"
28
+ end
29
+
30
+ describe "A controller spec should be able to access 'test/unit' assertions", :type => :controller do
31
+ controller_name :controller_spec
32
+ it_should_behave_like "assert_equal"
33
+ end
@@ -0,0 +1,263 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe "A template with an implicit helper", :type => :view do
4
+ before(:each) do
5
+ render "view_spec/implicit_helper"
6
+ end
7
+
8
+ it "should include the helper" do
9
+ response.should have_tag('div', :content => "This is text from a method in the ViewSpecHelper")
10
+ end
11
+
12
+ it "should include the application helper" do
13
+ response.should have_tag('div', :content => "This is text from a method in the ApplicationHelper")
14
+ end
15
+
16
+ it "should have access to named routes" do
17
+ rspec_on_rails_specs_url.should == "http://test.host/rspec_on_rails_specs"
18
+ rspec_on_rails_specs_path.should == "/rspec_on_rails_specs"
19
+ end
20
+ end
21
+
22
+ describe "A template requiring an explicit helper", :type => :view do
23
+ before(:each) do
24
+ render "view_spec/explicit_helper", :helper => 'explicit'
25
+ end
26
+
27
+ it "should include the helper if specified" do
28
+ response.should have_tag('div', :content => "This is text from a method in the ExplicitHelper")
29
+ end
30
+
31
+ it "should include the application helper" do
32
+ response.should have_tag('div', :content => "This is text from a method in the ApplicationHelper")
33
+ end
34
+ end
35
+
36
+ describe "A template requiring multiple explicit helpers", :type => :view do
37
+ before(:each) do
38
+ render "view_spec/multiple_helpers", :helpers => ['explicit', 'more_explicit']
39
+ end
40
+
41
+ it "should include all specified helpers" do
42
+ response.should have_tag('div', :content => "This is text from a method in the ExplicitHelper")
43
+ response.should have_tag('div', :content => "This is text from a method in the MoreExplicitHelper")
44
+ end
45
+
46
+ it "should include the application helper" do
47
+ response.should have_tag('div', :content => "This is text from a method in the ApplicationHelper")
48
+ end
49
+ end
50
+
51
+ describe "Message Expectations on helper methods", :type => :view do
52
+ it "should work" do
53
+ template.should_receive(:method_in_plugin_application_helper).and_return('alternate message 1')
54
+ render "view_spec/implicit_helper"
55
+ response.body.should =~ /alternate message 1/
56
+ end
57
+
58
+ it "should work twice" do
59
+ template.should_receive(:method_in_plugin_application_helper).and_return('alternate message 2')
60
+ render "view_spec/implicit_helper"
61
+ response.body.should =~ /alternate message 2/
62
+ end
63
+ end
64
+
65
+ describe "A template that includes a partial", :type => :view do
66
+ def render!
67
+ render "view_spec/template_with_partial"
68
+ end
69
+
70
+ it "should render the enclosing template" do
71
+ render!
72
+ response.should have_tag('div', "method_in_partial in ViewSpecHelper")
73
+ end
74
+
75
+ it "should render the partial" do
76
+ render!
77
+ response.should have_tag('div', "method_in_template_with_partial in ViewSpecHelper")
78
+ end
79
+
80
+ it "should include the application helper" do
81
+ render!
82
+ response.should have_tag('div', "This is text from a method in the ApplicationHelper")
83
+ end
84
+
85
+ it "should pass expect_render with the right partial" do
86
+ template.expect_render(:partial => 'partial')
87
+ render!
88
+ template.verify_rendered
89
+ end
90
+
91
+ it "should fail expect_render with the wrong partial" do
92
+ template.expect_render(:partial => 'non_existent')
93
+ render!
94
+ begin
95
+ template.verify_rendered
96
+ rescue Spec::Mocks::MockExpectationError => e
97
+ ensure
98
+ e.backtrace.find{|line| line =~ /view_spec_spec\.rb\:92/}.should_not be_nil
99
+ end
100
+ end
101
+
102
+ it "should pass expect_render when a partial is expected twice and happens twice" do
103
+ template.expect_render(:partial => 'partial_used_twice').twice
104
+ render!
105
+ template.verify_rendered
106
+ end
107
+
108
+ it "should pass expect_render when a partial is expected once and happens twice" do
109
+ template.expect_render(:partial => 'partial_used_twice')
110
+ render!
111
+ begin
112
+ template.verify_rendered
113
+ rescue Spec::Mocks::MockExpectationError => e
114
+ ensure
115
+ e.backtrace.find{|line| line =~ /view_spec_spec\.rb\:109/}.should_not be_nil
116
+ end
117
+ end
118
+
119
+ it "should fail expect_render with the right partial but wrong options" do
120
+ template.expect_render(:partial => 'partial', :locals => {:thing => Object.new})
121
+ render!
122
+ lambda {template.verify_rendered}.should raise_error(Spec::Mocks::MockExpectationError)
123
+ end
124
+ end
125
+
126
+ describe "A partial that includes a partial", :type => :view do
127
+ it "should support expect_render with nested partial" do
128
+ obj = Object.new
129
+ template.expect_render(:partial => 'partial', :object => obj)
130
+ render :partial => "view_spec/partial_with_sub_partial", :locals => { :partial => obj }
131
+ end
132
+ end
133
+
134
+ describe "A view that includes a partial using :collection and :spacer_template", :type => :view do
135
+ it "should render the partial w/ spacer_tamplate" do
136
+ render "view_spec/template_with_partial_using_collection"
137
+ response.should have_tag('div',/method_in_partial/)
138
+ response.should have_tag('div',/ApplicationHelper/)
139
+ response.should have_tag('div',/ViewSpecHelper/)
140
+ response.should have_tag('hr#spacer')
141
+ end
142
+
143
+ it "should render the partial" do
144
+ template.expect_render(:partial => 'partial',
145
+ :collection => ['Alice', 'Bob'],
146
+ :spacer_template => 'spacer')
147
+ render "view_spec/template_with_partial_using_collection"
148
+ end
149
+
150
+ end
151
+
152
+ describe "A view that includes a partial using an array as partial_path", :type => :view do
153
+ before(:each) do
154
+ module ActionView::Partials
155
+ def render_template_with_partial_with_array_support(partial_path, local_assigns = nil, deprecated_local_assigns = nil)
156
+ if partial_path.is_a?(Array)
157
+ "Array Partial"
158
+ else
159
+ render_partial_without_array_support(partial_path, local_assigns, deprecated_local_assigns)
160
+ end
161
+ end
162
+
163
+ alias :render_partial_without_array_support :render_partial
164
+ alias :render_partial :render_template_with_partial_with_array_support
165
+ end
166
+
167
+ @array = ['Alice', 'Bob']
168
+ assigns[:array] = @array
169
+ end
170
+
171
+ after(:each) do
172
+ module ActionView::Partials
173
+ alias :render_template_with_partial_with_array_support :render_partial
174
+ alias :render_partial :render_partial_without_array_support
175
+ undef render_template_with_partial_with_array_support
176
+ end
177
+ end
178
+
179
+ it "should render have the array passed through to render_partial without modification" do
180
+ render "view_spec/template_with_partial_with_array"
181
+ response.body.should match(/^Array Partial$/)
182
+ end
183
+ end
184
+
185
+ describe "Different types of renders (not :template)", :type => :view do
186
+ it "should render partial with local" do
187
+ render :partial => "view_spec/partial_with_local_variable", :locals => {:x => "Ender"}
188
+ response.should have_tag('div', :content => "Ender")
189
+ end
190
+ end
191
+
192
+ describe "A view", :type => :view do
193
+ before(:each) do
194
+ session[:key] = "session"
195
+ params[:key] = "params"
196
+ flash[:key] = "flash"
197
+ render "view_spec/accessor"
198
+ end
199
+
200
+ it "should have access to session data" do
201
+ response.should have_tag("div#session", "session")
202
+ end
203
+
204
+ specify "should have access to params data" do
205
+ response.should have_tag("div#params", "params")
206
+ end
207
+
208
+ it "should have access to flash data" do
209
+ response.should have_tag("div#flash", "flash")
210
+ end
211
+ end
212
+
213
+ describe "A view with a form_tag", :type => :view do
214
+ it "should render the right action" do
215
+ render "view_spec/entry_form"
216
+ response.should have_tag("form[action=?]","/view_spec/entry_form")
217
+ end
218
+ end
219
+
220
+ describe "An instantiated ViewExampleGroupController", :type => :view do
221
+ before do
222
+ render "view_spec/foo/show"
223
+ end
224
+
225
+ it "should return the name of the real controller that it replaces" do
226
+ @controller.controller_name.should == 'foo'
227
+ end
228
+
229
+ it "should return the path of the real controller that it replaces" do
230
+ @controller.controller_path.should == 'view_spec/foo'
231
+ end
232
+ end
233
+
234
+ module Spec
235
+ module Rails
236
+ module Example
237
+ describe ViewExampleGroup do
238
+ it "should clear its name from the description" do
239
+ group = describe("foo", :type => :view) do
240
+ $nested_group = describe("bar") do
241
+ end
242
+ end
243
+ group.description.to_s.should == "foo"
244
+ $nested_group.description.to_s.should == "foo bar"
245
+ end
246
+
247
+ it "should clear ActionView::Base.base_view_path on teardown" do
248
+ ViewExampleGroup.class_eval do
249
+ alias_method(:ensure_that_base_view_path_is_not_set_across_example_groups_orig,
250
+ :ensure_that_base_view_path_is_not_set_across_example_groups)
251
+ define_method(:ensure_that_base_view_path_is_not_set_across_example_groups){
252
+ $base_view_path_cleared = true
253
+ ensure_that_base_view_path_is_not_set_across_example_groups_orig
254
+ }
255
+ end
256
+ describe("base_view_path_cleared flag", :type => :view) do
257
+ it { $base_view_path_cleared.should be_true }
258
+ end
259
+ end
260
+ end
261
+ end
262
+ end
263
+ end