rspec-rails 1.1.11 → 1.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +29 -0
- data/Manifest.txt +94 -94
- data/README.txt +5 -7
- data/Rakefile +14 -2
- data/{spec_resources/views/controller_spec/_partial.rhtml → TODO.txt} +0 -0
- data/features/step_definitions/people.rb +6 -0
- data/features/support/env.rb +13 -0
- data/{stories/transactions_should_rollback → features/transactions/transactions_should_rollback.feature} +4 -3
- data/generators/rspec/rspec_generator.rb +0 -4
- data/generators/rspec/templates/rspec.rake +130 -104
- data/generators/rspec/templates/script/spec_server +17 -8
- data/generators/rspec/templates/spec_helper.rb +1 -1
- data/generators/rspec_default_values.rb +3 -3
- data/generators/rspec_scaffold/templates/edit_erb_spec.rb +7 -6
- data/generators/rspec_scaffold/templates/index_erb_spec.rb +9 -8
- data/generators/rspec_scaffold/templates/new_erb_spec.rb +7 -6
- data/generators/rspec_scaffold/templates/show_erb_spec.rb +9 -9
- data/lib/spec/rails.rb +14 -2
- data/lib/spec/rails/example/controller_example_group.rb +16 -23
- data/lib/spec/rails/example/cookies_proxy.rb +5 -1
- data/lib/spec/rails/example/functional_example_group.rb +17 -5
- data/lib/spec/rails/example/helper_example_group.rb +5 -4
- data/lib/spec/rails/example/rails_example_group.rb +10 -15
- data/lib/spec/rails/example/view_example_group.rb +5 -5
- data/lib/spec/rails/extensions.rb +1 -3
- data/lib/spec/rails/extensions/action_controller/base.rb +1 -1
- data/lib/spec/rails/extensions/action_controller/rescue.rb +9 -5
- data/lib/spec/rails/extensions/action_controller/test_response.rb +11 -2
- data/lib/spec/rails/extensions/action_view/base.rb +4 -2
- data/lib/spec/rails/extensions/active_record/base.rb +1 -2
- data/lib/spec/rails/extensions/spec/{example → runner}/configuration.rb +12 -7
- data/lib/spec/rails/matchers.rb +1 -0
- data/lib/spec/rails/matchers/ar_be_valid.rb +41 -0
- data/lib/spec/rails/matchers/redirect_to.rb +4 -2
- data/lib/spec/rails/matchers/render_template.rb +30 -10
- data/lib/spec/rails/mocks.rb +11 -8
- data/lib/spec/rails/version.rb +3 -2
- data/rspec-rails.gemspec +16 -8
- data/spec/{rails/autotest → autotest}/mappings_spec.rb +3 -3
- data/{spec_resources → spec/resources}/controllers/action_view_base_spec_controller.rb +0 -0
- data/spec/resources/controllers/application.rb +9 -0
- data/{spec_resources → spec/resources}/controllers/controller_spec_controller.rb +19 -6
- data/{spec_resources → spec/resources}/controllers/redirect_spec_controller.rb +7 -0
- data/{spec_resources → spec/resources}/controllers/render_spec_controller.rb +0 -0
- data/{spec_resources → spec/resources}/controllers/rjs_spec_controller.rb +0 -0
- data/{spec_resources → spec/resources}/helpers/addition_helper.rb +0 -0
- data/{spec_resources → spec/resources}/helpers/explicit_helper.rb +8 -0
- data/{spec_resources → spec/resources}/helpers/more_explicit_helper.rb +0 -0
- data/{spec_resources → spec/resources}/helpers/plugin_application_helper.rb +0 -0
- data/{spec_resources → spec/resources}/helpers/view_spec_helper.rb +0 -0
- data/spec/resources/models/animal.rb +4 -0
- data/spec/resources/models/person.rb +18 -0
- data/spec/resources/models/thing.rb +3 -0
- data/{spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml → spec/resources/views/controller_spec/_partial.rhtml} +0 -0
- data/{spec_resources → spec/resources}/views/controller_spec/action_setting_flash_after_session_reset.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/controller_spec/action_setting_flash_before_session_reset.rhtml +0 -0
- data/{spec_resources/views/layouts/application.rhtml → spec/resources/views/controller_spec/action_setting_the_assigns_hash.rhtml} +0 -0
- data/{spec_resources → spec/resources}/views/controller_spec/action_with_errors_in_template.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/controller_spec/action_with_template.rhtml +0 -0
- data/{spec_resources/views/layouts/simple.rhtml → spec/resources/views/layouts/application.rhtml} +0 -0
- data/{spec_resources/views/render_spec/_a_partial.rhtml → spec/resources/views/layouts/simple.rhtml} +0 -0
- data/{spec_resources → spec/resources}/views/objects/_object.html.erb +0 -0
- data/{spec_resources/views/render_spec/action_with_alternate_layout.rhtml → spec/resources/views/render_spec/_a_partial.rhtml} +0 -0
- data/{spec_resources/views/render_spec/some_action.rhtml → spec/resources/views/render_spec/action_with_alternate_layout.rhtml} +0 -0
- data/{spec_resources/views/view_spec/_partial_used_twice.rhtml → spec/resources/views/render_spec/some_action.html.erb} +0 -0
- data/{spec_resources → spec/resources}/views/render_spec/some_action.js.rjs +0 -0
- data/{spec_resources → spec/resources}/views/render_spec/some_action.rjs +0 -0
- data/{spec_resources → spec/resources}/views/rjs_spec/_replacement_partial.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/rjs_spec/hide_div.rjs +0 -0
- data/{spec_resources → spec/resources}/views/rjs_spec/hide_page_element.rjs +0 -0
- data/{spec_resources → spec/resources}/views/rjs_spec/insert_html.rjs +0 -0
- data/{spec_resources → spec/resources}/views/rjs_spec/replace.rjs +0 -0
- data/{spec_resources → spec/resources}/views/rjs_spec/replace_html.rjs +0 -0
- data/{spec_resources → spec/resources}/views/rjs_spec/replace_html_with_partial.rjs +0 -0
- data/{spec_resources → spec/resources}/views/rjs_spec/visual_effect.rjs +0 -0
- data/{spec_resources → spec/resources}/views/rjs_spec/visual_toggle_effect.rjs +0 -0
- data/{spec_resources → spec/resources}/views/tag_spec/no_tags.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/tag_spec/single_div_with_no_attributes.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/tag_spec/single_div_with_one_attribute.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/_partial.rhtml +0 -0
- data/spec/resources/views/view_spec/_partial_used_twice.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/_partial_with_local_variable.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/_partial_with_sub_partial.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/_spacer.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/accessor.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/block_helper.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/entry_form.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/explicit_helper.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/foo/show.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/implicit_helper.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/multiple_helpers.rhtml +0 -0
- data/spec/resources/views/view_spec/path_params.html.erb +1 -0
- data/{spec_resources → spec/resources}/views/view_spec/should_not_receive.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/template_with_partial.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/template_with_partial_using_collection.rhtml +0 -0
- data/{spec_resources → spec/resources}/views/view_spec/template_with_partial_with_array.rhtml +0 -0
- data/spec/{rails → spec/rails}/example/assigns_hash_proxy_spec.rb +1 -1
- data/spec/spec/rails/example/configuration_spec.rb +79 -0
- data/spec/{rails → spec/rails}/example/controller_isolation_spec.rb +1 -7
- data/spec/{rails → spec/rails}/example/controller_spec_spec.rb +63 -6
- data/spec/{rails → spec/rails}/example/cookies_proxy_spec.rb +30 -13
- data/spec/{rails → spec/rails}/example/example_group_factory_spec.rb +1 -1
- data/spec/{rails → spec/rails}/example/helper_spec_spec.rb +28 -1
- data/spec/{rails → spec/rails}/example/model_spec_spec.rb +1 -1
- data/spec/{rails → spec/rails}/example/shared_behaviour_spec.rb +1 -1
- data/spec/{rails → spec/rails}/example/test_unit_assertion_accessibility_spec.rb +1 -1
- data/spec/{rails → spec/rails}/example/view_spec_spec.rb +22 -1
- data/spec/{rails → spec/rails}/extensions/action_controller_rescue_action_spec.rb +4 -1
- data/spec/{rails → spec/rails}/extensions/action_view_base_spec.rb +1 -1
- data/spec/{rails → spec/rails}/extensions/active_record_spec.rb +1 -1
- data/spec/{rails → spec/rails}/interop/testcase_spec.rb +6 -2
- data/spec/spec/rails/matchers/ar_be_valid_spec.rb +35 -0
- data/spec/{rails → spec/rails}/matchers/assert_select_spec.rb +1 -5
- data/spec/{rails → spec/rails}/matchers/errors_on_spec.rb +1 -1
- data/spec/{rails → spec/rails}/matchers/have_text_spec.rb +1 -1
- data/spec/{rails → spec/rails}/matchers/include_text_spec.rb +1 -1
- data/spec/{rails → spec/rails}/matchers/redirect_to_spec.rb +11 -2
- data/spec/{rails → spec/rails}/matchers/render_template_spec.rb +8 -4
- data/spec/{rails → spec/rails}/matchers/should_change_spec.rb +1 -1
- data/spec/{rails → spec/rails}/mocks/ar_classes.rb +0 -0
- data/spec/{rails → spec/rails}/mocks/mock_model_spec.rb +1 -1
- data/spec/{rails → spec/rails}/mocks/stub_model_spec.rb +1 -1
- data/spec/{rails → spec/rails}/sample_modified_fixture.rb +1 -1
- data/spec/{rails → spec/rails}/sample_spec.rb +1 -1
- data/spec/spec/rails/spec_server_spec.rb +96 -0
- data/spec/{rails → spec/rails}/spec_spec.rb +1 -1
- data/spec/spec_helper.rb +23 -14
- metadata +111 -100
- data/UPGRADE +0 -7
- data/generators/rspec/templates/all_stories.rb +0 -4
- data/generators/rspec/templates/stories_helper.rb +0 -3
- data/lib/spec/rails/extensions/object.rb +0 -5
- data/spec/rails/example/configuration_spec.rb +0 -83
- data/spec/rails/matchers/description_generation_spec.rb +0 -37
- data/spec/rails/spec_server_spec.rb +0 -96
- data/stories/all.rb +0 -10
- data/stories/configuration/stories.rb +0 -5
- data/stories/helper.rb +0 -6
- data/stories/steps/people.rb +0 -8
- data/stories/transactions_should_rollback.rb +0 -25
@@ -8,14 +8,18 @@ module ActionController
|
|
8
8
|
@use_rails_error_handling ||= false
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
protected
|
12
|
+
|
12
13
|
def rescue_action_with_fast_errors(exception)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
unless respond_to?(:rescue_with_handler) and rescue_with_handler(exception)
|
15
|
+
if use_rails_error_handling?
|
16
|
+
rescue_action_without_fast_errors exception
|
17
|
+
else
|
18
|
+
raise exception
|
19
|
+
end
|
17
20
|
end
|
18
21
|
end
|
19
22
|
alias_method_chain :rescue_action, :fast_errors
|
23
|
+
|
20
24
|
end
|
21
25
|
end
|
@@ -5,7 +5,16 @@ module ActionController #:nodoc:
|
|
5
5
|
def capture(name)
|
6
6
|
template.instance_variable_get "@content_for_#{name.to_s}"
|
7
7
|
end
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
if ::Rails::VERSION::STRING < "2.3"
|
10
|
+
def [](name)
|
11
|
+
Kernel.warn <<-WARNING
|
12
|
+
[](name) as an alias for capture(name) (TestResponse extension in rspec-rails)
|
13
|
+
is deprecated and will be removed in the rspec-rails release that follows the
|
14
|
+
rails-2.3.0 release.
|
15
|
+
WARNING
|
16
|
+
capture(name)
|
17
|
+
end
|
18
|
+
end
|
10
19
|
end
|
11
20
|
end
|
@@ -2,6 +2,8 @@ module ActionView #:nodoc:
|
|
2
2
|
class Base #:nodoc:
|
3
3
|
include Spec::Rails::Example::RenderObserver
|
4
4
|
cattr_accessor :base_view_path
|
5
|
+
|
6
|
+
alias_method :orig_render_partial, :render_partial
|
5
7
|
def render_partial(partial_path, local_assigns = nil, deprecated_local_assigns = nil) #:nodoc:
|
6
8
|
if partial_path.is_a?(String)
|
7
9
|
unless partial_path.include?("/")
|
@@ -11,9 +13,9 @@ module ActionView #:nodoc:
|
|
11
13
|
end
|
12
14
|
end
|
13
15
|
begin
|
14
|
-
|
16
|
+
orig_render_partial(partial_path, local_assigns, deprecated_local_assigns)
|
15
17
|
rescue ArgumentError # edge rails > 2.1 changed render_partial to accept only one arg
|
16
|
-
|
18
|
+
orig_render_partial(partial_path)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
@@ -1,8 +1,13 @@
|
|
1
|
-
require 'spec/
|
1
|
+
require 'spec/runner/configuration'
|
2
|
+
require 'test_help'
|
3
|
+
|
2
4
|
begin
|
3
5
|
module Spec
|
4
|
-
module
|
6
|
+
module Runner
|
5
7
|
class Configuration
|
8
|
+
|
9
|
+
TEST_CASE = ActiveSupport.const_defined?(:TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase
|
10
|
+
|
6
11
|
# Rails 1.2.3 does a copy of the @inheritable_attributes to the subclass when the subclass is
|
7
12
|
# created. This causes an ordering issue when setting state on Configuration because the data is
|
8
13
|
# already copied.
|
@@ -10,7 +15,7 @@ module Spec
|
|
10
15
|
# @inheritable_attributes updated.
|
11
16
|
# TODO: BT - When we no longer support Rails 1.2.3, we can remove this functionality
|
12
17
|
EXAMPLE_GROUP_CLASSES = [
|
13
|
-
|
18
|
+
TEST_CASE,
|
14
19
|
::Spec::Rails::Example::RailsExampleGroup,
|
15
20
|
::Spec::Rails::Example::FunctionalExampleGroup,
|
16
21
|
::Spec::Rails::Example::ControllerExampleGroup,
|
@@ -26,7 +31,7 @@ module Spec
|
|
26
31
|
end
|
27
32
|
|
28
33
|
def use_transactional_fixtures
|
29
|
-
|
34
|
+
TEST_CASE.use_transactional_fixtures
|
30
35
|
end
|
31
36
|
def use_transactional_fixtures=(value)
|
32
37
|
EXAMPLE_GROUP_CLASSES.each do |example_group|
|
@@ -35,7 +40,7 @@ module Spec
|
|
35
40
|
end
|
36
41
|
|
37
42
|
def use_instantiated_fixtures
|
38
|
-
|
43
|
+
TEST_CASE.use_instantiated_fixtures
|
39
44
|
end
|
40
45
|
def use_instantiated_fixtures=(value)
|
41
46
|
EXAMPLE_GROUP_CLASSES.each do |example_group|
|
@@ -44,7 +49,7 @@ module Spec
|
|
44
49
|
end
|
45
50
|
|
46
51
|
def fixture_path
|
47
|
-
|
52
|
+
TEST_CASE.fixture_path
|
48
53
|
end
|
49
54
|
def fixture_path=(path)
|
50
55
|
EXAMPLE_GROUP_CLASSES.each do |example_group|
|
@@ -53,7 +58,7 @@ module Spec
|
|
53
58
|
end
|
54
59
|
|
55
60
|
def global_fixtures
|
56
|
-
|
61
|
+
TEST_CASE.fixture_table_names
|
57
62
|
end
|
58
63
|
def global_fixtures=(fixtures)
|
59
64
|
EXAMPLE_GROUP_CLASSES.each do |example_group|
|
data/lib/spec/rails/matchers.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
module Spec
|
2
|
+
module Rails
|
3
|
+
module Matchers
|
4
|
+
|
5
|
+
class ArBeValid #:nodoc:
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@matcher = Spec::Matchers::Be.new :be_valid
|
9
|
+
@matcher.send :handling_predicate!
|
10
|
+
end
|
11
|
+
|
12
|
+
def matches?(actual)
|
13
|
+
@actual = actual
|
14
|
+
@matcher.matches? @actual
|
15
|
+
end
|
16
|
+
|
17
|
+
def failure_message
|
18
|
+
if @actual.respond_to?(:errors) &&
|
19
|
+
ActiveRecord::Errors === @actual.errors
|
20
|
+
"Expected #{@actual.inspect} to be valid, but it was not\nErrors: " + @actual.errors.full_messages.join(", ")
|
21
|
+
else
|
22
|
+
@matcher.failure_message
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def negative_failure_message
|
27
|
+
@matcher.negative_failure_message
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
# :call-seq:
|
33
|
+
# response.should be_valid
|
34
|
+
# response.should_not be_valid
|
35
|
+
def be_valid
|
36
|
+
ArBeValid.new
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -40,7 +40,7 @@ module Spec
|
|
40
40
|
|
41
41
|
def path_hash(url)
|
42
42
|
path = url.sub(%r{^\w+://#{@request.host}(?::\d+)?}, "").split("?", 2)[0]
|
43
|
-
ActionController::Routing::Routes.recognize_path path
|
43
|
+
ActionController::Routing::Routes.recognize_path path, { :method => :get }
|
44
44
|
end
|
45
45
|
|
46
46
|
def query_hash(url)
|
@@ -74,13 +74,15 @@ module Spec
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def description
|
77
|
-
"redirect to #{@
|
77
|
+
"redirect to #{@expected.inspect}"
|
78
78
|
end
|
79
79
|
|
80
80
|
class QueryParameterParser
|
81
81
|
def self.parse_query_parameters(query, request)
|
82
82
|
if defined?(CGIMethods)
|
83
83
|
CGIMethods.parse_query_parameters(query)
|
84
|
+
elsif defined?(ActionController::RequestParser)
|
85
|
+
ActionController::RequestParser.parse_query_parameters(query)
|
84
86
|
else
|
85
87
|
request.class.parse_query_parameters(query)
|
86
88
|
end
|
@@ -10,9 +10,19 @@ module Spec
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def matches?(response)
|
13
|
-
|
14
13
|
if response.respond_to?(:rendered_file)
|
15
14
|
@actual = response.rendered_file
|
15
|
+
elsif response.respond_to?(:rendered)
|
16
|
+
case template = response.rendered[:template]
|
17
|
+
when nil
|
18
|
+
unless response.rendered[:partials].empty?
|
19
|
+
@actual = path_and_file(response.rendered[:partials].keys.first).join("/_")
|
20
|
+
end
|
21
|
+
when ActionView::Template
|
22
|
+
@actual = template.path
|
23
|
+
when String
|
24
|
+
@actual = template
|
25
|
+
end
|
16
26
|
else
|
17
27
|
@actual = response.rendered_template.to_s
|
18
28
|
end
|
@@ -53,16 +63,25 @@ module Spec
|
|
53
63
|
end
|
54
64
|
|
55
65
|
end
|
56
|
-
|
66
|
+
|
57
67
|
# :call-seq:
|
58
|
-
# response.should render_template(
|
59
|
-
# response.should_not render_template(
|
68
|
+
# response.should render_template(template)
|
69
|
+
# response.should_not render_template(template)
|
70
|
+
#
|
71
|
+
# For use in controller code examples (integration or isolation mode).
|
72
|
+
#
|
73
|
+
# Passes if the specified template (view file) is rendered by the
|
74
|
+
# response. This file can be any view file, including a partial. However
|
75
|
+
# if it is a partial it must be rendered directly i.e. you can't detect
|
76
|
+
# that a partial has been rendered as part of a view using
|
77
|
+
# render_template. For that you should use a message expectation
|
78
|
+
# (mock) instead:
|
60
79
|
#
|
61
|
-
#
|
62
|
-
# Useful in controller specs (integration or isolation mode).
|
80
|
+
# controller.should_receive(:render).with(:partial => 'path/to/partial')
|
63
81
|
#
|
64
|
-
# <code>
|
65
|
-
#
|
82
|
+
# <code>template</code> can include the controller path. It can also
|
83
|
+
# include an optional extension, which you only need to use when there
|
84
|
+
# is ambiguity.
|
66
85
|
#
|
67
86
|
# Note that partials must be spelled with the preceding underscore.
|
68
87
|
#
|
@@ -72,12 +91,13 @@ module Spec
|
|
72
91
|
# response.should render_template('same_controller/list')
|
73
92
|
# response.should render_template('other_controller/list')
|
74
93
|
#
|
75
|
-
# #
|
94
|
+
# # with extensions
|
76
95
|
# response.should render_template('list.rjs')
|
96
|
+
# response.should render_template('list.haml')
|
77
97
|
# response.should render_template('same_controller/list.rjs')
|
78
98
|
# response.should render_template('other_controller/list.rjs')
|
79
99
|
#
|
80
|
-
# #partials
|
100
|
+
# # partials
|
81
101
|
# response.should render_template('_a_partial')
|
82
102
|
# response.should render_template('same_controller/_a_partial')
|
83
103
|
# response.should render_template('other_controller/_a_partial')
|
data/lib/spec/rails/mocks.rb
CHANGED
@@ -104,21 +104,24 @@ module Spec
|
|
104
104
|
model[k] = stubs.delete(k)
|
105
105
|
end
|
106
106
|
end
|
107
|
-
|
107
|
+
model.stub!(stubs)
|
108
108
|
yield model if block_given?
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
|
113
|
-
#
|
114
|
-
# - object.stub!(:method => return_value, :method2 => return_value2, :etc => etc)
|
115
|
-
#++
|
112
|
+
# DEPRECATED - use object.stub!(:method => value, :method2 => value)
|
113
|
+
#
|
116
114
|
# Stubs methods on +object+ (if +object+ is a symbol or string a new mock
|
117
115
|
# with that name will be created). +stubs+ is a Hash of +method=>value+
|
118
116
|
def add_stubs(object, stubs = {}) #:nodoc:
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
Kernel.warn <<-WARNING
|
118
|
+
DEPRECATION NOTICE: add_stubs is deprecated and will be removed
|
119
|
+
from a future version of rspec-rails. Use this instead:
|
120
|
+
|
121
|
+
object.stub!(:method => value, :method2 => value)
|
122
|
+
|
123
|
+
WARNING
|
124
|
+
object.stub!(stubs)
|
122
125
|
end
|
123
126
|
|
124
127
|
private
|
data/lib/spec/rails/version.rb
CHANGED
data/rspec-rails.gemspec
CHANGED
@@ -2,27 +2,35 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rspec-rails}
|
5
|
-
s.version = "1.1.
|
5
|
+
s.version = "1.1.12"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["RSpec Development Team"]
|
9
|
-
s.date = %q{
|
9
|
+
s.date = %q{2009-01-11}
|
10
10
|
s.description = %q{Behaviour Driven Development for Ruby on Rails.}
|
11
11
|
s.email = ["rspec-devel@rubyforge.org"]
|
12
|
-
s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "generators/rspec/templates/previous_failures.txt"]
|
13
|
-
s.files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "
|
12
|
+
s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "TODO.txt", "generators/rspec/templates/previous_failures.txt"]
|
13
|
+
s.files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "TODO.txt", "features/step_definitions/people.rb", "features/support/env.rb", "features/transactions/transactions_should_rollback.feature", "generators/rspec/CHANGES", "generators/rspec/rspec_generator.rb", "generators/rspec/templates/previous_failures.txt", "generators/rspec/templates/rcov.opts", "generators/rspec/templates/rspec.rake", "generators/rspec/templates/script/autospec", "generators/rspec/templates/script/spec", "generators/rspec/templates/script/spec_server", "generators/rspec/templates/spec.opts", "generators/rspec/templates/spec_helper.rb", "generators/rspec_controller/USAGE", "generators/rspec_controller/rspec_controller_generator.rb", "generators/rspec_controller/templates/controller_spec.rb", "generators/rspec_controller/templates/helper_spec.rb", "generators/rspec_controller/templates/view_spec.rb", "generators/rspec_default_values.rb", "generators/rspec_model/USAGE", "generators/rspec_model/rspec_model_generator.rb", "generators/rspec_model/templates/model_spec.rb", "generators/rspec_scaffold/rspec_scaffold_generator.rb", "generators/rspec_scaffold/templates/controller_spec.rb", "generators/rspec_scaffold/templates/edit_erb_spec.rb", "generators/rspec_scaffold/templates/helper_spec.rb", "generators/rspec_scaffold/templates/index_erb_spec.rb", "generators/rspec_scaffold/templates/new_erb_spec.rb", "generators/rspec_scaffold/templates/routing_spec.rb", "generators/rspec_scaffold/templates/show_erb_spec.rb", "init.rb", "lib/autotest/discover.rb", "lib/autotest/rails_rspec.rb", "lib/spec/rails.rb", "lib/spec/rails/example.rb", "lib/spec/rails/example/assigns_hash_proxy.rb", "lib/spec/rails/example/controller_example_group.rb", "lib/spec/rails/example/cookies_proxy.rb", "lib/spec/rails/example/functional_example_group.rb", "lib/spec/rails/example/helper_example_group.rb", "lib/spec/rails/example/model_example_group.rb", "lib/spec/rails/example/rails_example_group.rb", "lib/spec/rails/example/render_observer.rb", "lib/spec/rails/example/view_example_group.rb", "lib/spec/rails/extensions.rb", "lib/spec/rails/extensions/action_controller/base.rb", "lib/spec/rails/extensions/action_controller/rescue.rb", "lib/spec/rails/extensions/action_controller/test_response.rb", "lib/spec/rails/extensions/action_view/base.rb", "lib/spec/rails/extensions/active_record/base.rb", "lib/spec/rails/extensions/spec/matchers/have.rb", "lib/spec/rails/extensions/spec/runner/configuration.rb", "lib/spec/rails/interop/testcase.rb", "lib/spec/rails/matchers.rb", "lib/spec/rails/matchers/ar_be_valid.rb", "lib/spec/rails/matchers/assert_select.rb", "lib/spec/rails/matchers/change.rb", "lib/spec/rails/matchers/have_text.rb", "lib/spec/rails/matchers/include_text.rb", "lib/spec/rails/matchers/redirect_to.rb", "lib/spec/rails/matchers/render_template.rb", "lib/spec/rails/mocks.rb", "lib/spec/rails/story_adapter.rb", "lib/spec/rails/version.rb", "rspec-rails.gemspec", "spec/autotest/mappings_spec.rb", "spec/rails_suite.rb", "spec/resources/controllers/action_view_base_spec_controller.rb", "spec/resources/controllers/application.rb", "spec/resources/controllers/controller_spec_controller.rb", "spec/resources/controllers/redirect_spec_controller.rb", "spec/resources/controllers/render_spec_controller.rb", "spec/resources/controllers/rjs_spec_controller.rb", "spec/resources/helpers/addition_helper.rb", "spec/resources/helpers/explicit_helper.rb", "spec/resources/helpers/more_explicit_helper.rb", "spec/resources/helpers/plugin_application_helper.rb", "spec/resources/helpers/view_spec_helper.rb", "spec/resources/models/animal.rb", "spec/resources/models/person.rb", "spec/resources/models/thing.rb", "spec/resources/views/controller_spec/_partial.rhtml", "spec/resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml", "spec/resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml", "spec/resources/views/controller_spec/action_setting_the_assigns_hash.rhtml", "spec/resources/views/controller_spec/action_with_errors_in_template.rhtml", "spec/resources/views/controller_spec/action_with_template.rhtml", "spec/resources/views/layouts/application.rhtml", "spec/resources/views/layouts/simple.rhtml", "spec/resources/views/objects/_object.html.erb", "spec/resources/views/render_spec/_a_partial.rhtml", "spec/resources/views/render_spec/action_with_alternate_layout.rhtml", "spec/resources/views/render_spec/some_action.html.erb", "spec/resources/views/render_spec/some_action.js.rjs", "spec/resources/views/render_spec/some_action.rjs", "spec/resources/views/rjs_spec/_replacement_partial.rhtml", "spec/resources/views/rjs_spec/hide_div.rjs", "spec/resources/views/rjs_spec/hide_page_element.rjs", "spec/resources/views/rjs_spec/insert_html.rjs", "spec/resources/views/rjs_spec/replace.rjs", "spec/resources/views/rjs_spec/replace_html.rjs", "spec/resources/views/rjs_spec/replace_html_with_partial.rjs", "spec/resources/views/rjs_spec/visual_effect.rjs", "spec/resources/views/rjs_spec/visual_toggle_effect.rjs", "spec/resources/views/tag_spec/no_tags.rhtml", "spec/resources/views/tag_spec/single_div_with_no_attributes.rhtml", "spec/resources/views/tag_spec/single_div_with_one_attribute.rhtml", "spec/resources/views/view_spec/_partial.rhtml", "spec/resources/views/view_spec/_partial_used_twice.rhtml", "spec/resources/views/view_spec/_partial_with_local_variable.rhtml", "spec/resources/views/view_spec/_partial_with_sub_partial.rhtml", "spec/resources/views/view_spec/_spacer.rhtml", "spec/resources/views/view_spec/accessor.rhtml", "spec/resources/views/view_spec/block_helper.rhtml", "spec/resources/views/view_spec/entry_form.rhtml", "spec/resources/views/view_spec/explicit_helper.rhtml", "spec/resources/views/view_spec/foo/show.rhtml", "spec/resources/views/view_spec/implicit_helper.rhtml", "spec/resources/views/view_spec/multiple_helpers.rhtml", "spec/resources/views/view_spec/path_params.html.erb", "spec/resources/views/view_spec/should_not_receive.rhtml", "spec/resources/views/view_spec/template_with_partial.rhtml", "spec/resources/views/view_spec/template_with_partial_using_collection.rhtml", "spec/resources/views/view_spec/template_with_partial_with_array.rhtml", "spec/spec/rails/example/assigns_hash_proxy_spec.rb", "spec/spec/rails/example/configuration_spec.rb", "spec/spec/rails/example/controller_isolation_spec.rb", "spec/spec/rails/example/controller_spec_spec.rb", "spec/spec/rails/example/cookies_proxy_spec.rb", "spec/spec/rails/example/example_group_factory_spec.rb", "spec/spec/rails/example/helper_spec_spec.rb", "spec/spec/rails/example/model_spec_spec.rb", "spec/spec/rails/example/shared_behaviour_spec.rb", "spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb", "spec/spec/rails/example/view_spec_spec.rb", "spec/spec/rails/extensions/action_controller_rescue_action_spec.rb", "spec/spec/rails/extensions/action_view_base_spec.rb", "spec/spec/rails/extensions/active_record_spec.rb", "spec/spec/rails/interop/testcase_spec.rb", "spec/spec/rails/matchers/ar_be_valid_spec.rb", "spec/spec/rails/matchers/assert_select_spec.rb", "spec/spec/rails/matchers/errors_on_spec.rb", "spec/spec/rails/matchers/have_text_spec.rb", "spec/spec/rails/matchers/include_text_spec.rb", "spec/spec/rails/matchers/redirect_to_spec.rb", "spec/spec/rails/matchers/render_template_spec.rb", "spec/spec/rails/matchers/should_change_spec.rb", "spec/spec/rails/mocks/ar_classes.rb", "spec/spec/rails/mocks/mock_model_spec.rb", "spec/spec/rails/mocks/stub_model_spec.rb", "spec/spec/rails/sample_modified_fixture.rb", "spec/spec/rails/sample_spec.rb", "spec/spec/rails/spec_server_spec.rb", "spec/spec/rails/spec_spec.rb", "spec/spec_helper.rb"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://rspec.info/}
|
16
16
|
s.rdoc_options = ["--main", "README.txt"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{rspec}
|
19
|
-
s.rubygems_version = %q{1.3.
|
20
|
-
s.summary = %q{rspec-rails 1.1.
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
20
|
+
s.summary = %q{rspec-rails 1.1.12}
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
24
|
s.specification_version = 2
|
25
|
-
end
|
26
25
|
|
27
|
-
|
26
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
+
s.add_runtime_dependency(%q<rspec>, ["= 1.1.12"])
|
28
|
+
s.add_development_dependency(%q<cucumber>, [">= 0.1.13"])
|
29
|
+
s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
|
30
|
+
else
|
31
|
+
s.add_dependency(%q<rspec>, ["= 1.1.12"])
|
32
|
+
end
|
33
|
+
else
|
34
|
+
s.add_dependency(%q<rspec>, ["= 1.1.12"])
|
35
|
+
end
|
28
36
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require File.dirname(__FILE__) + '
|
2
|
-
require File.
|
3
|
-
require File.
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/../../lib/autotest/rails_rspec'
|
3
|
+
require File.dirname(__FILE__) + '/../../../rspec/spec/autotest/autotest_matchers'
|
4
4
|
|
5
5
|
describe Autotest::RailsRspec, "file mapping" do
|
6
6
|
before(:each) do
|
File without changes
|
@@ -6,12 +6,8 @@ class ControllerSpecController < ActionController::Base
|
|
6
6
|
end
|
7
7
|
|
8
8
|
skip_before_filter :raise_error
|
9
|
-
|
10
|
-
|
11
|
-
set_view_path [File.join(File.dirname(__FILE__), "..", "views")]
|
12
|
-
else
|
13
|
-
set_view_path File.join(File.dirname(__FILE__), "..", "views")
|
14
|
-
end
|
9
|
+
|
10
|
+
set_view_path File.join(File.dirname(__FILE__), "..", "views")
|
15
11
|
|
16
12
|
def some_action
|
17
13
|
render :template => "template/that/does/not/actually/exist"
|
@@ -90,6 +86,23 @@ class ControllerSpecController < ActionController::Base
|
|
90
86
|
@a_variable = false
|
91
87
|
render :text => ""
|
92
88
|
end
|
89
|
+
|
90
|
+
class RescuedError < Exception; end
|
91
|
+
class UnRescuedError < Exception; end
|
92
|
+
|
93
|
+
if Rails::VERSION::MAJOR >= 2
|
94
|
+
rescue_from RescuedError do |e|
|
95
|
+
render :text => 'Rescued!'
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def rescued_error_action
|
100
|
+
raise RescuedError
|
101
|
+
end
|
102
|
+
|
103
|
+
def other_error_action
|
104
|
+
raise UnRescuedError
|
105
|
+
end
|
93
106
|
end
|
94
107
|
|
95
108
|
class ControllerInheritingFromApplicationControllerController < ApplicationController
|
@@ -55,5 +55,12 @@ class RedirectSpecController < ApplicationController
|
|
55
55
|
redirect_to :controller => "nonexistant", :action => "none"
|
56
56
|
end
|
57
57
|
|
58
|
+
def action_with_method_restriction
|
59
|
+
render :text => ''
|
60
|
+
end
|
61
|
+
|
62
|
+
def action_to_redirect_to_action_with_method_restriction
|
63
|
+
redirect_to :action => 'action_with_method_restriction'
|
64
|
+
end
|
58
65
|
end
|
59
66
|
|