rspec-rails 2.99.0 → 3.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- checksums.yaml.gz.sig +2 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +40 -68
- data/License.txt +1 -0
- data/README.md +6 -4
- data/features/Generators.md +24 -0
- data/features/GettingStarted.md +84 -0
- data/features/README.md +56 -0
- data/features/RailsVersions.md +4 -0
- data/features/Transactions.md +84 -0
- data/features/Upgrade.md +121 -0
- data/features/controller_specs/Cookies.md +57 -0
- data/features/controller_specs/README.md +45 -0
- data/features/controller_specs/anonymous_controller.feature +378 -0
- data/features/controller_specs/bypass_rescue.feature +75 -0
- data/features/controller_specs/controller_spec.feature +58 -0
- data/features/controller_specs/engine_routes.feature +51 -0
- data/features/controller_specs/isolation_from_views.feature +87 -0
- data/features/controller_specs/render_views.feature +114 -0
- data/features/directory_structure.feature +71 -0
- data/features/feature_specs/feature_spec.feature +35 -0
- data/features/helper_specs/helper_spec.feature +122 -0
- data/features/mailer_specs/url_helpers.feature +38 -0
- data/features/matchers/README.md +18 -0
- data/features/matchers/new_record_matcher.feature +41 -0
- data/features/matchers/redirect_to_matcher.feature +40 -0
- data/features/matchers/relation_match_array.feature +27 -0
- data/features/matchers/render_template_matcher.feature +49 -0
- data/features/mocks/mock_model.feature +147 -0
- data/features/mocks/stub_model.feature +58 -0
- data/features/model_specs/README.md +21 -0
- data/features/model_specs/errors_on.feature +51 -0
- data/features/model_specs/records.feature +27 -0
- data/features/model_specs/transactional_examples.feature +109 -0
- data/features/request_specs/request_spec.feature +49 -0
- data/features/routing_specs/README.md +16 -0
- data/features/routing_specs/be_routable_matcher.feature +80 -0
- data/features/routing_specs/engine_routes.feature +38 -0
- data/features/routing_specs/named_routes.feature +18 -0
- data/features/routing_specs/route_to_matcher.feature +90 -0
- data/features/step_definitions/additional_cli_steps.rb +4 -0
- data/features/step_definitions/model_steps.rb +3 -0
- data/features/support/capybara.rb +7 -0
- data/features/support/env.rb +53 -0
- data/features/support/rails_versions.rb +4 -0
- data/features/support/rubinius.rb +6 -0
- data/features/view_specs/inferred_controller_path.feature +45 -0
- data/features/view_specs/stub_template.feature +51 -0
- data/features/view_specs/view_spec.feature +206 -0
- data/lib/generators/rspec/controller/templates/controller_spec.rb +1 -1
- data/lib/generators/rspec/install/templates/spec/spec_helper.rb.tt +2 -21
- data/lib/generators/rspec/integration/integration_generator.rb +2 -3
- data/lib/generators/rspec/integration/templates/request_spec.rb +1 -1
- data/lib/generators/rspec/mailer/templates/mailer_spec.rb +4 -4
- data/lib/generators/rspec/scaffold/scaffold_generator.rb +2 -3
- data/lib/generators/rspec/scaffold/templates/controller_spec.rb +16 -16
- data/lib/generators/rspec/scaffold/templates/edit_spec.rb +2 -2
- data/lib/generators/rspec/scaffold/templates/index_spec.rb +1 -1
- data/lib/generators/rspec/scaffold/templates/new_spec.rb +2 -2
- data/lib/generators/rspec/scaffold/templates/routing_spec.rb +7 -7
- data/lib/generators/rspec/scaffold/templates/show_spec.rb +2 -2
- data/lib/rspec/rails.rb +0 -5
- data/lib/rspec/rails/adapters.rb +5 -12
- data/lib/rspec/rails/example.rb +55 -24
- data/lib/rspec/rails/example/controller_example_group.rb +7 -31
- data/lib/rspec/rails/example/view_example_group.rb +0 -3
- data/lib/rspec/rails/matchers.rb +1 -2
- data/lib/rspec/rails/matchers/be_a_new.rb +1 -1
- data/lib/rspec/rails/matchers/be_new_record.rb +1 -1
- data/lib/rspec/rails/matchers/be_valid.rb +1 -1
- data/lib/rspec/rails/matchers/have_rendered.rb +1 -1
- data/lib/rspec/rails/matchers/redirect_to.rb +1 -1
- data/lib/rspec/rails/matchers/relation_match_array.rb +1 -1
- data/lib/rspec/rails/matchers/routing_matchers.rb +6 -10
- data/lib/rspec/rails/mocks.rb +5 -41
- data/lib/rspec/rails/tasks/rspec.rake +5 -12
- data/lib/rspec/rails/vendor/capybara.rb +4 -35
- data/lib/rspec/rails/version.rb +1 -1
- data/spec/generators/rspec/controller/controller_generator_spec.rb +97 -0
- data/spec/generators/rspec/helper/helper_generator_spec.rb +30 -0
- data/spec/generators/rspec/install/install_generator_spec.rb +30 -0
- data/spec/generators/rspec/integration/integration_generator_spec.rb +44 -0
- data/spec/generators/rspec/mailer/mailer_generator_spec.rb +48 -0
- data/spec/generators/rspec/model/model_generator_spec.rb +52 -0
- data/spec/generators/rspec/observer/observer_generator_spec.rb +21 -0
- data/spec/generators/rspec/scaffold/scaffold_generator_spec.rb +138 -0
- data/spec/generators/rspec/view/view_generator_spec.rb +41 -0
- data/spec/rspec/rails/assertion_adapter_spec.rb +28 -0
- data/spec/rspec/rails/assertion_delegator_spec.rb +43 -0
- data/spec/rspec/rails/configuration_spec.rb +26 -0
- data/spec/rspec/rails/deprecations_spec.rb +18 -0
- data/spec/rspec/rails/example/controller_example_group_spec.rb +100 -0
- data/spec/rspec/rails/example/feature_example_group_spec.rb +56 -0
- data/spec/rspec/rails/example/helper_example_group_spec.rb +66 -0
- data/spec/rspec/rails/example/mailer_example_group_spec.rb +21 -0
- data/spec/rspec/rails/example/model_example_group_spec.rb +15 -0
- data/spec/rspec/rails/example/request_example_group_spec.rb +17 -0
- data/spec/rspec/rails/example/routing_example_group_spec.rb +32 -0
- data/spec/rspec/rails/example/view_example_group_spec.rb +220 -0
- data/spec/rspec/rails/extensions/active_model/errors_on_spec.rb +23 -0
- data/spec/rspec/rails/extensions/active_record/base_spec.rb +42 -0
- data/spec/rspec/rails/fixture_support_spec.rb +17 -0
- data/spec/rspec/rails/matchers/be_a_new_spec.rb +142 -0
- data/spec/rspec/rails/matchers/be_new_record_spec.rb +33 -0
- data/spec/rspec/rails/matchers/be_routable_spec.rb +41 -0
- data/spec/rspec/rails/matchers/be_valid_spec.rb +44 -0
- data/spec/rspec/rails/matchers/has_spec.rb +29 -0
- data/spec/rspec/rails/matchers/have_rendered_spec.rb +93 -0
- data/spec/rspec/rails/matchers/redirect_to_spec.rb +80 -0
- data/spec/rspec/rails/matchers/relation_match_array_spec.rb +31 -0
- data/spec/rspec/rails/matchers/route_to_spec.rb +151 -0
- data/spec/rspec/rails/minitest_lifecycle_adapter_spec.rb +22 -0
- data/spec/rspec/rails/mocks/mock_model_spec.rb +378 -0
- data/spec/rspec/rails/mocks/stub_model_spec.rb +154 -0
- data/spec/rspec/rails/setup_and_teardown_adapter_spec.rb +32 -0
- data/spec/rspec/rails/view_rendering_spec.rb +111 -0
- data/spec/spec_helper.rb +35 -0
- data/spec/support/ar_classes.rb +42 -0
- data/spec/support/helpers.rb +20 -0
- data/spec/support/matchers.rb +9 -0
- data/spec/support/null_object.rb +6 -0
- metadata +229 -42
- metadata.gz.sig +0 -0
- data/lib/autotest/rails_rspec2.rb +0 -91
- data/lib/rspec/rails/infer_type_configuration.rb +0 -26
- data/lib/rspec/rails/matchers/have_extension.rb +0 -36
- data/lib/rspec/rails/module_inclusion.rb +0 -19
metadata.gz.sig
ADDED
Binary file
|
@@ -1,91 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'rspec/rails/autotest'
|
3
|
-
rescue LoadError
|
4
|
-
# (c) Copyright 2006 Nick Sieger <nicksieger@gmail.com>
|
5
|
-
#
|
6
|
-
# Permission is hereby granted, free of charge, to any person
|
7
|
-
# obtaining a copy of this software and associated documentation files
|
8
|
-
# (the "Software"), to deal in the Software without restriction,
|
9
|
-
# including without limitation the rights to use, copy, modify, merge,
|
10
|
-
# publish, distribute, sublicense, and/or sell copies of the Software,
|
11
|
-
# and to permit persons to whom the Software is furnished to do so,
|
12
|
-
# subject to the following conditions:
|
13
|
-
#
|
14
|
-
# The above copyright notice and this permission notice shall be
|
15
|
-
# included in all copies or substantial portions of the Software.
|
16
|
-
#
|
17
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
21
|
-
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
22
|
-
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
23
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24
|
-
# SOFTWARE.
|
25
|
-
|
26
|
-
$:.push(*Dir["vendor/rails/*/lib"])
|
27
|
-
|
28
|
-
require 'active_support'
|
29
|
-
require 'active_support/core_ext'
|
30
|
-
require 'autotest/rspec2'
|
31
|
-
|
32
|
-
class Autotest::RailsRspec2 < Autotest::Rspec2
|
33
|
-
|
34
|
-
def initialize
|
35
|
-
super
|
36
|
-
setup_rails_rspec2_mappings
|
37
|
-
end
|
38
|
-
|
39
|
-
def setup_rails_rspec2_mappings
|
40
|
-
%w{coverage/ db/ doc/ log/ public/ script/ tmp/ vendor/rails vendor/plugins vendor/gems}.each do |exception|
|
41
|
-
add_exception(/^([\.\/]*)?#{exception}/)
|
42
|
-
end
|
43
|
-
|
44
|
-
clear_mappings
|
45
|
-
|
46
|
-
add_mapping(%r%^(test|spec)/fixtures/(.*).yml$%) { |_, m|
|
47
|
-
["spec/models/#{m[2].singularize}_spec.rb"] + files_matching(%r%^spec\/views\/#{m[2]}/.*_spec\.rb$%)
|
48
|
-
}
|
49
|
-
add_mapping(%r%^spec/.*_spec\.rb$%) { |filename, _|
|
50
|
-
filename
|
51
|
-
}
|
52
|
-
add_mapping(%r%^app/models/(.*)\.rb$%) { |_, m|
|
53
|
-
["spec/models/#{m[1]}_spec.rb"]
|
54
|
-
}
|
55
|
-
add_mapping(%r%^app/views/(.*)$%) { |_, m|
|
56
|
-
files_matching %r%^spec/views/#{m[1]}_spec.rb$%
|
57
|
-
}
|
58
|
-
add_mapping(%r%^app/controllers/(.*)\.rb$%) { |_, m|
|
59
|
-
if m[1] == "application"
|
60
|
-
files_matching %r%^spec/controllers/.*_spec\.rb$%
|
61
|
-
else
|
62
|
-
["spec/controllers/#{m[1]}_spec.rb"]
|
63
|
-
end
|
64
|
-
}
|
65
|
-
add_mapping(%r%^app/helpers/(.*)_helper\.rb$%) { |_, m|
|
66
|
-
if m[1] == "application" then
|
67
|
-
files_matching(%r%^spec/(views|helpers)/.*_spec\.rb$%)
|
68
|
-
else
|
69
|
-
["spec/helpers/#{m[1]}_helper_spec.rb"] + files_matching(%r%^spec\/views\/#{m[1]}/.*_spec\.rb$%)
|
70
|
-
end
|
71
|
-
}
|
72
|
-
add_mapping(%r%^config/routes\.rb$%) {
|
73
|
-
files_matching %r%^spec/(controllers|routing|views|helpers)/.*_spec\.rb$%
|
74
|
-
}
|
75
|
-
add_mapping(%r%^config/database\.yml$%) { |_, m|
|
76
|
-
files_matching %r%^spec/models/.*_spec\.rb$%
|
77
|
-
}
|
78
|
-
add_mapping(%r%^(spec/(spec_helper|support/.*)|config/(boot|environment(s/test)?))\.rb$%) {
|
79
|
-
files_matching %r%^spec/(models|controllers|routing|views|helpers)/.*_spec\.rb$%
|
80
|
-
}
|
81
|
-
add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
|
82
|
-
["spec/lib/#{m[1]}_spec.rb"]
|
83
|
-
}
|
84
|
-
add_mapping(%r%^app/mailers/(.*)\.rb$%) { |_, m|
|
85
|
-
["spec/mailers/#{m[1]}_spec.rb"]
|
86
|
-
}
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
Autotest.add_hook(:ran_command) { warn "\n\e[31mUsing the built in rspec-rails autotest support is deprecated and will be removed in RSpec 3. Please switch to the rspec-autotest gem\e[0m" }
|
91
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
RSpec.configure do |config|
|
2
|
-
def config.infer_spec_type_from_file_location!
|
3
|
-
@infer_spec_type_from_file_location = true
|
4
|
-
end
|
5
|
-
|
6
|
-
def config.infer_spec_type_from_file_location?
|
7
|
-
@infer_spec_type_from_file_location ||= false
|
8
|
-
end
|
9
|
-
|
10
|
-
config.before do
|
11
|
-
unless config.infer_spec_type_from_file_location?
|
12
|
-
RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/,''))
|
13
|
-
|rspec-rails 3 will no longer automatically infer an example group's spec type
|
14
|
-
|from the file location. You can explicitly opt-in to this feature using this
|
15
|
-
|snippet:
|
16
|
-
|
|
17
|
-
|RSpec.configure do |config|
|
18
|
-
| config.infer_spec_type_from_file_location!
|
19
|
-
|end
|
20
|
-
|
|
21
|
-
|If you wish to manually label spec types via metadata you can safely ignore
|
22
|
-
|this warning and continue upgrading to RSpec 3 without addressing it.
|
23
|
-
EOS
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'active_support'
|
2
|
-
require 'active_support/core_ext/module/aliasing'
|
3
|
-
require 'rspec/matchers/built_in/have'
|
4
|
-
|
5
|
-
module RSpec::Rails::Matchers
|
6
|
-
module HaveExtensions
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
# @api private
|
10
|
-
#
|
11
|
-
# Enhances the failure message for `should have(n)` matchers
|
12
|
-
def failure_message_for_should_with_errors_on_extensions
|
13
|
-
return "expected #{relativities[@relativity]}#{@expected} errors on :#{@args[0]}, got #{@actual}" if @collection_name == :errors_on
|
14
|
-
return "expected #{relativities[@relativity]}#{@expected} error on :#{@args[0]}, got #{@actual}" if @collection_name == :error_on
|
15
|
-
return failure_message_for_should_without_errors_on_extensions
|
16
|
-
end
|
17
|
-
|
18
|
-
# @api private
|
19
|
-
#
|
20
|
-
# Enhances the description for `should have(n)` matchers
|
21
|
-
def description_with_errors_on_extensions
|
22
|
-
return "have #{relativities[@relativity]}#{@expected} errors on :#{@args[0]}" if @collection_name == :errors_on
|
23
|
-
return "have #{relativities[@relativity]}#{@expected} error on :#{@args[0]}" if @collection_name == :error_on
|
24
|
-
return description_without_errors_on_extensions
|
25
|
-
end
|
26
|
-
|
27
|
-
included do
|
28
|
-
alias_method_chain :failure_message_for_should, :errors_on_extensions
|
29
|
-
alias_method_chain :description, :errors_on_extensions
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
RSpec::Matchers::BuiltIn::Have.class_eval do
|
35
|
-
include RSpec::Rails::Matchers::HaveExtensions
|
36
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module RSpec::Rails
|
2
|
-
module ModuleInclusion
|
3
|
-
# @deprecated No replacement.
|
4
|
-
#
|
5
|
-
# Will be removed from rspec-rails-3.0
|
6
|
-
#
|
7
|
-
# This was never intended to be a public API and is no longer needed
|
8
|
-
# internally. As it happens, there are a few blog posts citing its use, so
|
9
|
-
# I'm leaving it here, but deprecated.
|
10
|
-
def include_self_when_dir_matches(*path_parts)
|
11
|
-
lambda do |c|
|
12
|
-
RSpec.deprecate('include_self_when_dir_matches')
|
13
|
-
c.include self, :example_group => {
|
14
|
-
:file_path => Regexp.compile(path_parts.join('[\\\/]'))
|
15
|
-
}
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|