rspec-rails 6.0.3 → 6.0.4
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Changelog.md +14 -2
- data/lib/generators/rspec/scaffold/templates/edit_spec.rb +3 -3
- data/lib/generators/rspec/scaffold/templates/new_spec.rb +1 -1
- data/lib/generators/rspec/scaffold/templates/show_spec.rb +1 -1
- data/lib/rspec/rails/example/rails_example_group.rb +8 -1
- data/lib/rspec/rails/example/system_example_group.rb +46 -0
- data/lib/rspec/rails/example/view_example_group.rb +1 -1
- data/lib/rspec/rails/fixture_support.rb +36 -14
- data/lib/rspec/rails/matchers/action_cable/have_broadcasted_to.rb +1 -1
- data/lib/rspec/rails/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +7 -7
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecae469592630a6ecaaa39d6f2be0e2616cb2079c044bc390e548956b823d6bc
|
4
|
+
data.tar.gz: f24952e5edf9bf57f6e8c94fced8c7b2d38938b4a1b250fa83043bf316c8de9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e50c692c774cd0a874bedd667e7c0e3997236d43a74750efb6cc215a3019ce9a4babc5437a79825c43c885b70f1c3da9c90599ce1b0bf123ba1538e77cc7884e
|
7
|
+
data.tar.gz: a148f034a8667af85e68c478849bd9ea33443567dec01335d0a83ad9fd44d63d7dd0780694ebaee55f2278add2fefa61032674e38dec865cf01ee1205e13d1e9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
|
-
###
|
2
|
-
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.3...
|
1
|
+
### 6.0.4 / 2023-11-21
|
2
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.3...v6.0.4)
|
3
|
+
|
4
|
+
Bug Fixes:
|
5
|
+
|
6
|
+
* Fuzzy match `have_broadcasted_to` so that argument matchers can be used.
|
7
|
+
(Timothy Peraza, #2684)
|
8
|
+
* Fix fixture warning during `:context` hooks on Rails `main`. (Jon Rowe, #2685)
|
9
|
+
* Fix `stub_template` on Rails `main`. (Jon Rowe, #2685)
|
10
|
+
* Fix variable name in scaffolded view specs when namespaced. (Taketo Takashima, #2694)
|
11
|
+
* Prevent `take_failed_screenshot` producing an additional error through `metadata`
|
12
|
+
access. (Jon Rowe, #2704)
|
13
|
+
* Use `ActiveSupport::ExecutionContext::TestHelper` on Rails 7+. (Jon Rowe, #2711)
|
14
|
+
* Fix leak of templates stubbed with `stub_template` on Rails 7.1. (Jon Rowe, #2714)
|
3
15
|
|
4
16
|
### 6.0.3 / 2023-05-31
|
5
17
|
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.2...v6.0.3)
|
@@ -2,7 +2,7 @@ require 'rails_helper'
|
|
2
2
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
4
4
|
RSpec.describe "<%= ns_table_name %>/edit", <%= type_metatag(:view) %> do
|
5
|
-
let(:<%=
|
5
|
+
let(:<%= singular_table_name %>) {
|
6
6
|
<%= class_name %>.create!(<%= ')' if output_attributes.empty? %>
|
7
7
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
8
8
|
<%= attribute.name %>: <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
@@ -11,13 +11,13 @@ RSpec.describe "<%= ns_table_name %>/edit", <%= type_metatag(:view) %> do
|
|
11
11
|
}
|
12
12
|
|
13
13
|
before(:each) do
|
14
|
-
assign(:<%=
|
14
|
+
assign(:<%= singular_table_name %>, <%= singular_table_name %>)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "renders the edit <%= ns_file_name %> form" do
|
18
18
|
render
|
19
19
|
|
20
|
-
assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(<%=
|
20
|
+
assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(<%= singular_table_name %>), "post" do
|
21
21
|
<% for attribute in output_attributes -%>
|
22
22
|
<%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %>
|
23
23
|
assert_select "<%= attribute.input_type -%>[name=?]", "<%= ns_file_name %>[<%= name %>]"
|
@@ -3,7 +3,7 @@ require 'rails_helper'
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
4
4
|
RSpec.describe "<%= ns_table_name %>/new", <%= type_metatag(:view) %> do
|
5
5
|
before(:each) do
|
6
|
-
assign(:<%=
|
6
|
+
assign(:<%= singular_table_name %>, <%= class_name %>.new(<%= '))' if output_attributes.empty? %>
|
7
7
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
8
8
|
<%= attribute.name %>: <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
9
9
|
<% end -%>
|
@@ -3,7 +3,7 @@ require 'rails_helper'
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
4
4
|
RSpec.describe "<%= ns_table_name %>/show", <%= type_metatag(:view) %> do
|
5
5
|
before(:each) do
|
6
|
-
assign(:<%=
|
6
|
+
assign(:<%= singular_table_name %>, <%= class_name %>.create!(<%= '))' if output_attributes.empty? %>
|
7
7
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
8
8
|
<%= attribute.name %>: <%= value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
9
9
|
<% end -%>
|
@@ -2,6 +2,10 @@
|
|
2
2
|
# suite and ammeter.
|
3
3
|
require 'rspec/rails/matchers'
|
4
4
|
|
5
|
+
if ::Rails::VERSION::MAJOR >= 7
|
6
|
+
require 'active_support/execution_context/test_helper'
|
7
|
+
end
|
8
|
+
|
5
9
|
module RSpec
|
6
10
|
module Rails
|
7
11
|
# @api public
|
@@ -12,7 +16,10 @@ module RSpec
|
|
12
16
|
include RSpec::Rails::MinitestLifecycleAdapter
|
13
17
|
include RSpec::Rails::MinitestAssertionAdapter
|
14
18
|
include RSpec::Rails::FixtureSupport
|
15
|
-
|
19
|
+
if ::Rails::VERSION::MAJOR >= 7
|
20
|
+
include RSpec::Rails::TaggedLoggingAdapter
|
21
|
+
include ActiveSupport::ExecutionContext::TestHelper
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
@@ -44,6 +44,52 @@ module RSpec
|
|
44
44
|
].join("_").tr(CHARS_TO_TRANSLATE.join, "_").byteslice(0...200).scrub("") + "_#{rand(1000)}"
|
45
45
|
end
|
46
46
|
|
47
|
+
if ::Rails::VERSION::STRING.to_f >= 7.1
|
48
|
+
# @private
|
49
|
+
# Allows failure screenshot to work whilst not exposing metadata
|
50
|
+
class SuppressRailsScreenshotMetadata
|
51
|
+
def initialize
|
52
|
+
@example_data = {}
|
53
|
+
end
|
54
|
+
|
55
|
+
def [](key)
|
56
|
+
if @example_data.key?(key)
|
57
|
+
@example_data[key]
|
58
|
+
else
|
59
|
+
raise_wrong_scope_error
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def []=(key, value)
|
64
|
+
if key == :failure_screenshot_path
|
65
|
+
@example_data[key] = value
|
66
|
+
else
|
67
|
+
raise_wrong_scope_error
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def method_missing(_name, *_args, &_block)
|
72
|
+
raise_wrong_scope_error
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def raise_wrong_scope_error
|
78
|
+
raise RSpec::Core::ExampleGroup::WrongScopeError,
|
79
|
+
"`metadata` is not available from within an example " \
|
80
|
+
"(e.g. an `it` block) or from constructs that run in the " \
|
81
|
+
"scope of an example (e.g. `before`, `let`, etc). It is " \
|
82
|
+
"only available on an example group (e.g. a `describe` or "\
|
83
|
+
"`context` block)"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# @private
|
88
|
+
def metadata
|
89
|
+
@metadata ||= SuppressRailsScreenshotMetadata.new
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
47
93
|
# Delegates to `Rails.application`.
|
48
94
|
def app
|
49
95
|
::Rails.application
|
@@ -89,7 +89,7 @@ module RSpec
|
|
89
89
|
#
|
90
90
|
# stub_template("widgets/_widget.html.erb" => "This content.")
|
91
91
|
def stub_template(hash)
|
92
|
-
|
92
|
+
controller.prepend_view_path(StubResolverCache.resolver_for(hash))
|
93
93
|
end
|
94
94
|
|
95
95
|
# Provides access to the params hash that will be available within the
|
@@ -37,28 +37,50 @@ module RSpec
|
|
37
37
|
module Fixtures
|
38
38
|
extend ActiveSupport::Concern
|
39
39
|
|
40
|
+
# rubocop:disable Metrics/BlockLength
|
40
41
|
class_methods do
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
if ::Rails.version.to_f >= 7.1
|
43
|
+
def fixtures(*args)
|
44
|
+
super.tap do
|
45
|
+
fixture_sets.each_key do |fixture_name|
|
46
|
+
proxy_method_warning_if_called_in_before_context_scope(fixture_name)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def proxy_method_warning_if_called_in_before_context_scope(fixture_name)
|
52
|
+
define_method(fixture_name) do |*args, **kwargs, &blk|
|
53
|
+
if RSpec.current_scope == :before_context_hook
|
54
|
+
RSpec.warn_with("Calling fixture method in before :context ")
|
55
|
+
else
|
56
|
+
access_fixture(fixture_name, *args, **kwargs, &blk)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
else
|
61
|
+
def fixtures(*args)
|
62
|
+
orig_methods = private_instance_methods
|
63
|
+
super.tap do
|
64
|
+
new_methods = private_instance_methods - orig_methods
|
65
|
+
new_methods.each do |method_name|
|
66
|
+
proxy_method_warning_if_called_in_before_context_scope(method_name)
|
67
|
+
end
|
47
68
|
end
|
48
69
|
end
|
49
|
-
end
|
50
70
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
71
|
+
def proxy_method_warning_if_called_in_before_context_scope(method_name)
|
72
|
+
orig_implementation = instance_method(method_name)
|
73
|
+
define_method(method_name) do |*args, &blk|
|
74
|
+
if RSpec.current_scope == :before_context_hook
|
75
|
+
RSpec.warn_with("Calling fixture method in before :context ")
|
76
|
+
else
|
77
|
+
orig_implementation.bind(self).call(*args, &blk)
|
78
|
+
end
|
58
79
|
end
|
59
80
|
end
|
60
81
|
end
|
61
82
|
end
|
83
|
+
# rubocop:enable Metrics/BlockLength
|
62
84
|
end
|
63
85
|
end
|
64
86
|
end
|
@@ -112,7 +112,7 @@ module RSpec
|
|
112
112
|
decoded = ActiveSupport::JSON.decode(msg)
|
113
113
|
decoded = decoded.with_indifferent_access if decoded.is_a?(Hash)
|
114
114
|
|
115
|
-
if @data.nil? || @data
|
115
|
+
if @data.nil? || values_match?(@data, decoded)
|
116
116
|
@block.call(decoded)
|
117
117
|
true
|
118
118
|
else
|
data/lib/rspec/rails/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chelimsky
|
8
8
|
- Andy Lindeman
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain:
|
12
12
|
- |
|
@@ -44,7 +44,7 @@ cert_chain:
|
|
44
44
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
45
45
|
F3MdtaDehhjC
|
46
46
|
-----END CERTIFICATE-----
|
47
|
-
date: 2023-
|
47
|
+
date: 2023-11-21 00:00:00.000000000 Z
|
48
48
|
dependencies:
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: actionpack
|
@@ -296,11 +296,11 @@ licenses:
|
|
296
296
|
- MIT
|
297
297
|
metadata:
|
298
298
|
bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
|
299
|
-
changelog_uri: https://github.com/rspec/rspec-rails/blob/v6.0.
|
299
|
+
changelog_uri: https://github.com/rspec/rspec-rails/blob/v6.0.4/Changelog.md
|
300
300
|
documentation_uri: https://rspec.info/documentation/
|
301
301
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
302
302
|
source_code_uri: https://github.com/rspec/rspec-rails
|
303
|
-
post_install_message:
|
303
|
+
post_install_message:
|
304
304
|
rdoc_options:
|
305
305
|
- "--charset=UTF-8"
|
306
306
|
require_paths:
|
@@ -316,8 +316,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
316
|
- !ruby/object:Gem::Version
|
317
317
|
version: '0'
|
318
318
|
requirements: []
|
319
|
-
rubygems_version: 3.
|
320
|
-
signing_key:
|
319
|
+
rubygems_version: 3.4.10
|
320
|
+
signing_key:
|
321
321
|
specification_version: 4
|
322
322
|
summary: RSpec for Rails
|
323
323
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|