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.
- data/History.txt +5 -0
- data/Manifest.txt +158 -21
- data/config/hoe.rb +2 -1
- data/lib/spree/version.rb +1 -1
- data/starter-app/app/views/layouts/application.rhtml +6 -4
- data/starter-app/db/sample/line_items.yml +6 -4
- data/starter-app/db/sample/{variations.yml → variants.yml} +16 -0
- data/starter-app/log/README +1 -0
- data/starter-app/public/images/spree.jpg +0 -0
- data/starter-app/public/stylesheets/application.css +2 -2
- data/starter-app/script/spec +4 -0
- data/starter-app/script/spec_server +102 -0
- data/starter-app/spec/models/cart_item_spec.rb +50 -0
- data/starter-app/spec/models/cart_spec.rb +51 -0
- data/starter-app/spec/models/line_item_spec.rb +33 -0
- data/starter-app/spec/models/product_spec.rb +29 -0
- data/starter-app/spec/rcov.opts +2 -0
- data/starter-app/spec/spec.opts +6 -0
- data/starter-app/spec/spec_helper.rb +39 -0
- data/starter-app/stories/all.rb +4 -0
- data/starter-app/stories/helper.rb +3 -0
- data/starter-app/vendor/plugins/rspec_on_rails/MIT-LICENSE +31 -0
- data/starter-app/vendor/plugins/rspec_on_rails/README +3 -0
- data/starter-app/vendor/plugins/rspec_on_rails/Rakefile +9 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/CHANGES +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/rspec_generator.rb +35 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/all_stories.rb +4 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/previous_failures.txt +0 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/rcov.opts +2 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/script/spec +4 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/script/spec_server +102 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/spec.opts +6 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/spec_helper.rb +39 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec/templates/stories_helper.rb +3 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_controller/USAGE +33 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_controller/rspec_controller_generator.rb +49 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_controller/templates/controller_spec.rb +25 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_controller/templates/helper_spec.rb +11 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_controller/templates/view_spec.rb +12 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_model/USAGE +18 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb +30 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_model/templates/model_spec.rb +11 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/rspec_scaffold_generator.rb +167 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/controller_spec.rb +313 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/edit_erb_spec.rb +25 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/helper_spec.rb +11 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/index_erb_spec.rb +22 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/new_erb_spec.rb +26 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/routing_spec.rb +61 -0
- data/starter-app/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/show_erb_spec.rb +22 -0
- data/starter-app/vendor/plugins/rspec_on_rails/init.rb +9 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/autotest/discover.rb +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/autotest/rails_rspec.rb +81 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails.rb +51 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example.rb +47 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb +42 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/controller_example_group.rb +255 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/functional_example_group.rb +66 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/helper_example_group.rb +82 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/ivar_proxy.rb +62 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/model_example_group.rb +14 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/rails_example_group.rb +68 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/render_observer.rb +90 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/example/view_example_group.rb +171 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions.rb +12 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_controller/base.rb +14 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_controller/rescue.rb +21 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_controller/test_response.rb +11 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_view/base.rb +27 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/active_record/base.rb +30 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/object.rb +5 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/spec/example/configuration.rb +66 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/spec/matchers/have.rb +21 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers.rb +29 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/assert_select.rb +130 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/have_text.rb +55 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/redirect_to.rb +113 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/render_template.rb +70 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/story_adapter.rb +71 -0
- data/starter-app/vendor/plugins/rspec_on_rails/lib/spec/rails/version.rb +23 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/autotest/mappings_spec.rb +36 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/autotest/rails_rspec_spec.rb +8 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/assigns_hash_proxy_spec.rb +55 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/configuration_spec.rb +83 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb +43 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/controller_spec_spec.rb +187 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/example_group_factory_spec.rb +112 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/helper_spec_spec.rb +118 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/ivar_proxy_spec.rb +64 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/model_spec_spec.rb +18 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/shared_behaviour_spec.rb +16 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/test_unit_assertion_accessibility_spec.rb +33 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/example/view_spec_spec.rb +263 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_controller_rescue_action_spec.rb +54 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb +48 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/extensions/active_record_spec.rb +14 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/assert_select_spec.rb +783 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/description_generation_spec.rb +37 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/errors_on_spec.rb +13 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/have_text_spec.rb +62 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/redirect_to_spec.rb +203 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/render_spec.rb +169 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/mocks/mock_model_spec.rb +65 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/sample_spec.rb +7 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/spec_server_spec.rb +89 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/spec_spec.rb +11 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/rails_suite.rb +7 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec/spec_helper.rb +46 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/controllers/action_view_base_spec_controller.rb +2 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/controllers/controller_spec_controller.rb +56 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/controllers/redirect_spec_controller.rb +59 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/controllers/render_spec_controller.rb +26 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/controllers/rjs_spec_controller.rb +58 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/helpers/explicit_helper.rb +10 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/helpers/more_explicit_helper.rb +5 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/helpers/plugin_application_helper.rb +6 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/helpers/view_spec_helper.rb +13 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/_partial.rhtml +0 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml +0 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_errors_in_template.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_template.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/_a_partial.rhtml +0 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.js.rjs +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rhtml +0 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rjs +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/_replacement_partial.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_div.rjs +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_page_element.rjs +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/insert_html.rjs +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace.rjs +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html.rjs +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html_with_partial.rjs +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_effect.rjs +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_toggle_effect.rjs +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/no_tags.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial.rhtml +2 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_used_twice.rhtml +0 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_local_variable.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_sub_partial.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_spacer.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/accessor.rhtml +3 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/entry_form.rhtml +2 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/explicit_helper.rhtml +2 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/foo/show.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/implicit_helper.rhtml +2 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/multiple_helpers.rhtml +3 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial.rhtml +5 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_using_collection.rhtml +3 -0
- data/starter-app/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_with_array.rhtml +1 -0
- data/starter-app/vendor/plugins/rspec_on_rails/stories/all.rb +10 -0
- data/starter-app/vendor/plugins/rspec_on_rails/stories/helper.rb +5 -0
- data/starter-app/vendor/plugins/rspec_on_rails/stories/steps/people.rb +8 -0
- data/starter-app/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback +15 -0
- data/starter-app/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback.rb +25 -0
- data/starter-app/vendor/plugins/rspec_on_rails/tasks/rspec.rake +137 -0
- data/starter-app/vendor/plugins/spree/LICENSE +1 -1
- data/starter-app/vendor/plugins/spree/app/controllers/admin/categories_controller.rb +0 -24
- data/starter-app/vendor/plugins/spree/app/controllers/admin/products_controller.rb +16 -16
- data/starter-app/vendor/plugins/spree/app/controllers/cart_controller.rb +2 -8
- data/starter-app/vendor/plugins/spree/app/helpers/admin/products_helper.rb +1 -1
- data/starter-app/vendor/plugins/spree/app/helpers/spree/base_helper.rb +2 -2
- data/starter-app/vendor/plugins/spree/app/models/cart.rb +7 -20
- data/starter-app/vendor/plugins/spree/app/models/cart_item.rb +3 -6
- data/starter-app/vendor/plugins/spree/app/models/category.rb +6 -22
- data/starter-app/vendor/plugins/spree/app/models/line_item.rb +3 -5
- data/starter-app/vendor/plugins/spree/app/models/option_value.rb +1 -1
- data/starter-app/vendor/plugins/spree/app/models/product.rb +18 -2
- data/starter-app/vendor/plugins/spree/app/models/variant.rb +5 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/_form.rhtml +1 -5
- data/starter-app/vendor/plugins/spree/app/views/admin/overview/index.rhtml +3 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_form.rhtml +2 -2
- data/starter-app/vendor/plugins/spree/app/views/admin/products/{_new_variation.rhtml → _new_variant.rhtml} +1 -1
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_variants.rhtml +43 -0
- data/starter-app/vendor/plugins/spree/app/views/cart/index.rhtml +4 -4
- data/starter-app/vendor/plugins/spree/app/views/layouts/admin.rhtml +1 -1
- data/starter-app/vendor/plugins/spree/app/views/order_mailer/cancel.rhtml +1 -1
- data/starter-app/vendor/plugins/spree/app/views/order_mailer/confirm.rhtml +1 -1
- data/starter-app/vendor/plugins/spree/app/views/shared/_order_details.rhtml +1 -1
- data/starter-app/vendor/plugins/spree/app/views/store/show.rhtml +30 -29
- data/starter-app/vendor/plugins/spree/assets/images/spree/spree.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/spree-admin.css +1 -1
- data/starter-app/vendor/plugins/spree/assets/stylesheets/store/_controller.css +1 -1
- data/starter-app/vendor/plugins/spree/db/migrate/002_create_cart_items.rb +1 -2
- data/starter-app/vendor/plugins/spree/db/migrate/006_create_line_items.rb +5 -7
- data/starter-app/vendor/plugins/spree/db/migrate/011_create_variants.rb +11 -0
- data/starter-app/vendor/plugins/spree/db/migrate/018_create_option_values_variants.rb +12 -0
- data/starter-app/vendor/plugins/spree/test/unit/product_test.rb +0 -33
- metadata +170 -23
- data/starter-app/vendor/plugins/spree/app/controllers/admin/variations_controller.rb +0 -73
- data/starter-app/vendor/plugins/spree/app/helpers/admin/variations_helper.rb +0 -2
- data/starter-app/vendor/plugins/spree/app/models/variation.rb +0 -8
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/test.rhtml +0 -8
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_variations.rhtml +0 -41
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/_form.rhtml +0 -33
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/_option_values.rhtml +0 -5
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/list.rhtml +0 -23
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/new.rhtml +0 -14
- data/starter-app/vendor/plugins/spree/assets/images/spree/spree_logo142x65.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/spree_logo245x112.gif +0 -0
- data/starter-app/vendor/plugins/spree/db/migrate/011_create_variations.rb +0 -11
- data/starter-app/vendor/plugins/spree/db/migrate/018_create_option_values_variations.rb +0 -12
- data/starter-app/vendor/plugins/spree/test/functional/admin/variations_controller_test.rb +0 -18
- data/starter-app/vendor/plugins/spree/test/integration/variations_test.rb +0 -24
- data/starter-app/vendor/plugins/spree/test/unit/cart_item_test.rb +0 -55
- data/starter-app/vendor/plugins/spree/test/unit/cart_test.rb +0 -35
- data/starter-app/vendor/plugins/spree/test/unit/line_item_test.rb +0 -61
- data/starter-app/vendor/plugins/spree/test/unit/variation_test.rb +0 -9
data/starter-app/vendor/plugins/rspec_on_rails/spec/rails/matchers/description_generation_spec.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
class DescriptionGenerationSpecController < ActionController::Base
|
4
|
+
def render_action
|
5
|
+
end
|
6
|
+
|
7
|
+
def redirect_action
|
8
|
+
redirect_to :action => :render_action
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "Description generation", :type => :controller do
|
13
|
+
controller_name :description_generation_spec
|
14
|
+
|
15
|
+
after(:each) do
|
16
|
+
Spec::Matchers.clear_generated_description
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should generate description for render_template" do
|
20
|
+
get 'render_action'
|
21
|
+
response.should render_template("render_action")
|
22
|
+
Spec::Matchers.generated_description.should == "should render template \"render_action\""
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should generate description for render_template with full path" do
|
26
|
+
get 'render_action'
|
27
|
+
response.should render_template("description_generation_spec/render_action")
|
28
|
+
Spec::Matchers.generated_description.should == "should render template \"description_generation_spec/render_action\""
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should generate description for redirect_to" do
|
32
|
+
get 'redirect_action'
|
33
|
+
response.should redirect_to("http://test.host/description_generation_spec/render_action")
|
34
|
+
Spec::Matchers.generated_description.should == "should redirect to \"http://test.host/description_generation_spec/render_action\""
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe "error_on" do
|
4
|
+
it "should provide a message including the name of what the error is on" do
|
5
|
+
have(1).error_on(:whatever).description.should == "should have 1 error on :whatever"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "errors_on" do
|
10
|
+
it "should provide a message including the name of what the error is on" do
|
11
|
+
have(2).errors_on(:whatever).description.should == "should have 2 errors on :whatever"
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "have_text" do
|
4
|
+
|
5
|
+
describe "where target is a Regexp" do
|
6
|
+
it 'should should match submitted text using a regexp' do
|
7
|
+
string = 'foo'
|
8
|
+
string.should have_text(/fo*/)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "where target is a String" do
|
13
|
+
it 'should match submitted text using a string' do
|
14
|
+
string = 'foo'
|
15
|
+
string.should have_text('foo')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "have_text",
|
22
|
+
:type => :controller do
|
23
|
+
['isolation','integration'].each do |mode|
|
24
|
+
if mode == 'integration'
|
25
|
+
integrate_views
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "where target is a response (in #{mode} mode)" do
|
29
|
+
controller_name :render_spec
|
30
|
+
|
31
|
+
it "should pass with exactly matching text" do
|
32
|
+
post 'text_action'
|
33
|
+
response.should have_text("this is the text for this action")
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should pass with matching text (using Regexp)" do
|
37
|
+
post 'text_action'
|
38
|
+
response.should have_text(/is the text/)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should fail with matching text" do
|
42
|
+
post 'text_action'
|
43
|
+
lambda {
|
44
|
+
response.should have_text("this is NOT the text for this action")
|
45
|
+
}.should fail_with("expected \"this is NOT the text for this action\", got \"this is the text for this action\"")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should fail when a template is rendered" do
|
49
|
+
post 'some_action'
|
50
|
+
lambda {
|
51
|
+
response.should have_text("this is the text for this action")
|
52
|
+
}.should fail_with(/expected \"this is the text for this action\", got .*/)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should pass using should_not with incorrect text" do
|
56
|
+
post 'text_action'
|
57
|
+
response.should_not have_text("the accordian guy")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,203 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
['isolation','integration'].each do |mode|
|
4
|
+
describe "redirect_to behaviour", :type => :controller do
|
5
|
+
if mode == 'integration'
|
6
|
+
integrate_views
|
7
|
+
end
|
8
|
+
controller_name :redirect_spec
|
9
|
+
|
10
|
+
it "redirected to another action" do
|
11
|
+
get 'action_with_redirect_to_somewhere'
|
12
|
+
response.should redirect_to(:action => 'somewhere')
|
13
|
+
end
|
14
|
+
|
15
|
+
it "redirected to another controller and action" do
|
16
|
+
get 'action_with_redirect_to_other_somewhere'
|
17
|
+
response.should redirect_to(:controller => 'render_spec', :action => 'text_action')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "redirected to another action (with 'and return')" do
|
21
|
+
get 'action_with_redirect_to_somewhere_and_return'
|
22
|
+
response.should redirect_to(:action => 'somewhere')
|
23
|
+
end
|
24
|
+
|
25
|
+
it "redirected to correct path with leading /" do
|
26
|
+
get 'action_with_redirect_to_somewhere'
|
27
|
+
response.should redirect_to('/redirect_spec/somewhere')
|
28
|
+
end
|
29
|
+
|
30
|
+
it "redirected to correct path without leading /" do
|
31
|
+
get 'action_with_redirect_to_somewhere'
|
32
|
+
response.should redirect_to('redirect_spec/somewhere')
|
33
|
+
end
|
34
|
+
|
35
|
+
it "redirected to correct internal URL" do
|
36
|
+
get 'action_with_redirect_to_somewhere'
|
37
|
+
response.should redirect_to("http://test.host/redirect_spec/somewhere")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "redirected to correct external URL" do
|
41
|
+
get 'action_with_redirect_to_rspec_site'
|
42
|
+
response.should redirect_to("http://rspec.rubyforge.org")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "redirected :back" do
|
46
|
+
request.env['HTTP_REFERER'] = "http://test.host/previous/page"
|
47
|
+
get 'action_with_redirect_back'
|
48
|
+
response.should redirect_to(:back)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "redirected :back and should redirect_to URL matches" do
|
52
|
+
request.env['HTTP_REFERER'] = "http://test.host/previous/page"
|
53
|
+
get 'action_with_redirect_back'
|
54
|
+
response.should redirect_to("http://test.host/previous/page")
|
55
|
+
end
|
56
|
+
|
57
|
+
it "redirected from within a respond_to block" do
|
58
|
+
get 'action_with_redirect_in_respond_to'
|
59
|
+
response.should redirect_to('redirect_spec/somewhere')
|
60
|
+
end
|
61
|
+
|
62
|
+
params_as_hash = {:action => "somewhere", :id => 1111, :param1 => "value1", :param2 => "value2"}
|
63
|
+
|
64
|
+
it "redirected to an internal URL containing a query string" do
|
65
|
+
get "action_with_redirect_which_creates_query_string"
|
66
|
+
response.should redirect_to(params_as_hash)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "redirected to an internal URL containing a query string, one way it might be generated" do
|
70
|
+
get "action_with_redirect_with_query_string_order1"
|
71
|
+
response.should redirect_to(params_as_hash)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "redirected to an internal URL containing a query string, another way it might be generated" do
|
75
|
+
get "action_with_redirect_with_query_string_order2"
|
76
|
+
response.should redirect_to(params_as_hash)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "redirected to an internal URL which is unroutable but matched via a string" do
|
80
|
+
get "action_with_redirect_to_unroutable_url_inside_app"
|
81
|
+
response.should redirect_to("http://test.host/nonexistant/none")
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
describe "redirect_to with a controller spec in #{mode} mode and a custom request.host", :type => :controller do
|
88
|
+
if mode == 'integration'
|
89
|
+
integrate_views
|
90
|
+
end
|
91
|
+
controller_name :redirect_spec
|
92
|
+
before do
|
93
|
+
request.host = "some.custom.host"
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should pass when redirected to another action" do
|
97
|
+
get 'action_with_redirect_to_somewhere'
|
98
|
+
response.should redirect_to(:action => 'somewhere')
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "Given a controller spec in #{mode} mode", :type => :controller do
|
103
|
+
if mode == 'integration'
|
104
|
+
integrate_views
|
105
|
+
end
|
106
|
+
controller_name :redirect_spec
|
107
|
+
|
108
|
+
it "an action that redirects should not result in an error if no should redirect_to expectation is called" do
|
109
|
+
get 'action_with_redirect_to_somewhere'
|
110
|
+
end
|
111
|
+
|
112
|
+
it "an action that redirects should not result in an error if should_not redirect_to expectation was called, but not to that action" do
|
113
|
+
get 'action_with_redirect_to_somewhere'
|
114
|
+
response.should_not redirect_to(:action => 'another_destination')
|
115
|
+
end
|
116
|
+
|
117
|
+
it "an action that redirects should result in an error if should_not redirect_to expectation was called to that action" do
|
118
|
+
get 'action_with_redirect_to_somewhere'
|
119
|
+
lambda {
|
120
|
+
response.should_not redirect_to(:action => 'somewhere')
|
121
|
+
}.should fail_with("expected not to be redirected to {:action=>\"somewhere\"}, but was")
|
122
|
+
end
|
123
|
+
|
124
|
+
it "an action that does not redirects should not result in an error if should_not redirect_to expectation was called" do
|
125
|
+
get 'action_with_no_redirect'
|
126
|
+
response.should_not redirect_to(:action => 'any_destination')
|
127
|
+
end
|
128
|
+
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
describe "Given a controller spec in #{mode} mode, should redirect_to should fail when", :type => :controller do
|
133
|
+
if mode == 'integration'
|
134
|
+
integrate_views
|
135
|
+
end
|
136
|
+
controller_name :redirect_spec
|
137
|
+
|
138
|
+
it "redirected to wrong action" do
|
139
|
+
get 'action_with_redirect_to_somewhere'
|
140
|
+
lambda {
|
141
|
+
response.should redirect_to(:action => 'somewhere_else')
|
142
|
+
}.should fail_with("expected redirect to {:action=>\"somewhere_else\"}, got redirect to \"http://test.host/redirect_spec/somewhere\"")
|
143
|
+
end
|
144
|
+
|
145
|
+
it "redirected to incorrect path with leading /" do
|
146
|
+
get 'action_with_redirect_to_somewhere'
|
147
|
+
lambda {
|
148
|
+
response.should redirect_to('/redirect_spec/somewhere_else')
|
149
|
+
}.should fail_with('expected redirect to "/redirect_spec/somewhere_else", got redirect to "http://test.host/redirect_spec/somewhere"')
|
150
|
+
end
|
151
|
+
|
152
|
+
it "redirected to incorrect path without leading /" do
|
153
|
+
get 'action_with_redirect_to_somewhere'
|
154
|
+
lambda {
|
155
|
+
response.should redirect_to('redirect_spec/somewhere_else')
|
156
|
+
}.should fail_with('expected redirect to "redirect_spec/somewhere_else", got redirect to "http://test.host/redirect_spec/somewhere"')
|
157
|
+
end
|
158
|
+
|
159
|
+
it "redirected to incorrect internal URL (based on the action)" do
|
160
|
+
get 'action_with_redirect_to_somewhere'
|
161
|
+
lambda {
|
162
|
+
response.should redirect_to("http://test.host/redirect_spec/somewhere_else")
|
163
|
+
}.should fail_with('expected redirect to "http://test.host/redirect_spec/somewhere_else", got redirect to "http://test.host/redirect_spec/somewhere"')
|
164
|
+
end
|
165
|
+
|
166
|
+
it "redirected to wrong external URL" do
|
167
|
+
get 'action_with_redirect_to_rspec_site'
|
168
|
+
lambda {
|
169
|
+
response.should redirect_to("http://test.unit.rubyforge.org")
|
170
|
+
}.should fail_with('expected redirect to "http://test.unit.rubyforge.org", got redirect to "http://rspec.rubyforge.org"')
|
171
|
+
end
|
172
|
+
|
173
|
+
it "redirected to incorrect internal URL (based on the directory path)" do
|
174
|
+
get 'action_with_redirect_to_somewhere'
|
175
|
+
lambda {
|
176
|
+
response.should redirect_to("http://test.host/non_existent_controller/somewhere")
|
177
|
+
}.should fail_with('expected redirect to "http://test.host/non_existent_controller/somewhere", got redirect to "http://test.host/redirect_spec/somewhere"')
|
178
|
+
end
|
179
|
+
|
180
|
+
it "expected redirect :back, but redirected to a new URL" do
|
181
|
+
get 'action_with_no_redirect'
|
182
|
+
lambda {
|
183
|
+
response.should redirect_to(:back)
|
184
|
+
}.should fail_with('expected redirect to :back, got no redirect')
|
185
|
+
end
|
186
|
+
|
187
|
+
it "no redirect at all" do
|
188
|
+
get 'action_with_no_redirect'
|
189
|
+
lambda {
|
190
|
+
response.should redirect_to(:action => 'nowhere')
|
191
|
+
}.should fail_with("expected redirect to {:action=>\"nowhere\"}, got no redirect")
|
192
|
+
end
|
193
|
+
|
194
|
+
it "redirected to an internal URL which is unroutable and matched via a hash" do
|
195
|
+
get "action_with_redirect_to_unroutable_url_inside_app"
|
196
|
+
route = {:controller => "nonexistant", :action => "none"}
|
197
|
+
lambda {
|
198
|
+
response.should redirect_to(route)
|
199
|
+
}.should raise_error(ActionController::RoutingError, /(no route found to match|No route matches) \"\/nonexistant\/none\" with \{\}/)
|
200
|
+
end
|
201
|
+
|
202
|
+
end
|
203
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
['isolation','integration'].each do |mode|
|
4
|
+
describe "response.should render_template (in #{mode} mode)",
|
5
|
+
:type => :controller do
|
6
|
+
controller_name :render_spec
|
7
|
+
if mode == 'integration'
|
8
|
+
integrate_views
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should match a simple path" do
|
12
|
+
post 'some_action'
|
13
|
+
response.should render_template('some_action')
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should match a less simple path" do
|
17
|
+
post 'some_action'
|
18
|
+
response.should render_template('render_spec/some_action')
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should match a less simple path to another controller" do
|
22
|
+
post 'action_which_renders_template_from_other_controller'
|
23
|
+
response.should render_template('controller_spec/action_with_template')
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should match a symbol" do
|
27
|
+
post 'some_action'
|
28
|
+
response.should render_template(:some_action)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should match an rjs template" do
|
32
|
+
xhr :post, 'some_action'
|
33
|
+
if Rails::VERSION::STRING < "2.0.0"
|
34
|
+
response.should render_template('render_spec/some_action.rjs')
|
35
|
+
else
|
36
|
+
response.should render_template('render_spec/some_action')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should match a partial template (simple path)" do
|
41
|
+
get 'action_with_partial'
|
42
|
+
response.should render_template("_a_partial")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should match a partial template (complex path)" do
|
46
|
+
get 'action_with_partial'
|
47
|
+
response.should render_template("render_spec/_a_partial")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should fail when the wrong template is rendered" do
|
51
|
+
post 'some_action'
|
52
|
+
lambda do
|
53
|
+
response.should render_template('non_existent_template')
|
54
|
+
end.should fail_with("expected \"non_existent_template\", got \"render_spec/some_action\"")
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should fail without full path when template is associated with a different controller" do
|
58
|
+
post 'action_which_renders_template_from_other_controller'
|
59
|
+
lambda do
|
60
|
+
response.should render_template('action_with_template')
|
61
|
+
end.should fail_with(%Q|expected "action_with_template", got "controller_spec/action_with_template"|)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should fail with incorrect full path when template is associated with a different controller" do
|
65
|
+
post 'action_which_renders_template_from_other_controller'
|
66
|
+
lambda do
|
67
|
+
response.should render_template('render_spec/action_with_template')
|
68
|
+
end.should fail_with(%Q|expected "render_spec/action_with_template", got "controller_spec/action_with_template"|)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should fail on the wrong extension (given rhtml)" do
|
72
|
+
get 'some_action'
|
73
|
+
lambda {
|
74
|
+
response.should render_template('render_spec/some_action.rjs')
|
75
|
+
}.should fail_with("expected \"render_spec/some_action.rjs\", got \"render_spec/some_action\"")
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should fail when TEXT is rendered" do
|
79
|
+
post 'text_action'
|
80
|
+
lambda do
|
81
|
+
response.should render_template('some_action')
|
82
|
+
end.should fail_with("expected \"some_action\", got nil")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "response.should_not render_template (in #{mode} mode)",
|
87
|
+
:type => :controller do
|
88
|
+
controller_name :render_spec
|
89
|
+
if mode == 'integration'
|
90
|
+
integrate_views
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should pass when the action renders nothing" do
|
94
|
+
post 'action_that_renders_nothing'
|
95
|
+
response.should_not render_template('action_that_renders_nothing')
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should pass when the action renders nothing (symbol)" do
|
99
|
+
post 'action_that_renders_nothing'
|
100
|
+
response.should_not render_template(:action_that_renders_nothing)
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should pass when the action does not render the template" do
|
104
|
+
post 'some_action'
|
105
|
+
response.should_not render_template('some_other_template')
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should pass when the action does not render the template (symbol)" do
|
109
|
+
post 'some_action'
|
110
|
+
response.should_not render_template(:some_other_template)
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should pass when the action does not render the template (named with controller)" do
|
114
|
+
post 'some_action'
|
115
|
+
response.should_not render_template('render_spec/some_other_template')
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should pass when the action renders the template with a different controller" do
|
119
|
+
post 'action_which_renders_template_from_other_controller'
|
120
|
+
response.should_not render_template('action_with_template')
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should pass when the action renders the template (named with controller) with a different controller" do
|
124
|
+
post 'action_which_renders_template_from_other_controller'
|
125
|
+
response.should_not render_template('render_spec/action_with_template')
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should pass when TEXT is rendered" do
|
129
|
+
post 'text_action'
|
130
|
+
response.should_not render_template('some_action')
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should fail when the action renders the template" do
|
134
|
+
post 'some_action'
|
135
|
+
lambda do
|
136
|
+
response.should_not render_template('some_action')
|
137
|
+
end.should fail_with("expected not to render \"some_action\", but did")
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should fail when the action renders the template (symbol)" do
|
141
|
+
post 'some_action'
|
142
|
+
lambda do
|
143
|
+
response.should_not render_template(:some_action)
|
144
|
+
end.should fail_with("expected not to render \"some_action\", but did")
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should fail when the action renders the template (named with controller)" do
|
148
|
+
post 'some_action'
|
149
|
+
lambda do
|
150
|
+
response.should_not render_template('render_spec/some_action')
|
151
|
+
end.should fail_with("expected not to render \"render_spec/some_action\", but did")
|
152
|
+
end
|
153
|
+
|
154
|
+
it "should fail when the action renders the partial" do
|
155
|
+
post 'action_with_partial'
|
156
|
+
lambda do
|
157
|
+
response.should_not render_template('_a_partial')
|
158
|
+
end.should fail_with("expected not to render \"_a_partial\", but did")
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should fail when the action renders the partial (named with controller)" do
|
162
|
+
post 'action_with_partial'
|
163
|
+
lambda do
|
164
|
+
response.should_not render_template('render_spec/_a_partial')
|
165
|
+
end.should fail_with("expected not to render \"render_spec/_a_partial\", but did")
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
end
|