This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +4
-16
lines changed Expand file tree Collapse file tree 3 files changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Breaking Changes:
10
10
and remove the configuration option. (Phil Pirozhkov, #2834 )
11
11
* Remove ` run_all_when_everything_filtered ` configuration option. (Phil Pirozhkov, #2845 )
12
12
* Raise on unsupported hook scope usage. (Phil Pirozhkov, #2849 )
13
+ * Raise on usage of metadata on suite-level scopes. (Phil Pirozhkov, #2849 )
13
14
14
15
Enhancements:
15
16
Original file line number Diff line number Diff line change @@ -1990,9 +1990,7 @@ def handle_suite_hook(scope, meta)
1990
1990
return nil unless scope == :suite
1991
1991
1992
1992
unless meta . empty?
1993
- # TODO: in RSpec 4, consider raising an error here.
1994
- # We warn only for backwards compatibility.
1995
- RSpec . warn_with "WARNING: `:suite` hooks do not support metadata since " \
1993
+ raise ArgumentError , "WARNING: `:suite` hooks do not support metadata since " \
1996
1994
"they apply to the suite as a whole rather than " \
1997
1995
"any individual example or example group that has metadata. " \
1998
1996
"The metadata you have provided (#{ meta . inspect } ) will be ignored."
Original file line number Diff line number Diff line change @@ -76,12 +76,12 @@ module RSpec::Core
76
76
end
77
77
78
78
context "registered with metadata" do
79
- it "explicitly warns that the metadata is ignored " do
79
+ it "raises an error " do
80
80
expect {
81
81
RSpec . configure do |c |
82
82
c . __send__ ( registration_method , :suite , :some => :metadata )
83
83
end
84
- } . to output ( a_string_including ( ":suite" , "metadata" ) ) . to_stderr
84
+ } . to raise_error ( ArgumentError , a_string_including ( ":suite" , "metadata" ) )
85
85
end
86
86
end
87
87
end
@@ -108,17 +108,6 @@ def define_and_run_example_group(&block)
108
108
runner . run err , out
109
109
end
110
110
111
- it "still runs :suite hooks with metadata even though the metadata is ignored" do
112
- sequence = [ ]
113
- allow ( RSpec ) . to receive ( :warn_with )
114
-
115
- config . before ( :suite , :foo ) { sequence << :before_suite }
116
- config . after ( :suite , :foo ) { sequence << :after_suite }
117
- define_and_run_example_group { sequence << :example_groups }
118
-
119
- expect ( sequence ) . to eq ( [ :before_suite , :example_groups , :after_suite ] )
120
- end
121
-
122
111
it "runs :suite hooks before and after example groups in the correct order" do
123
112
sequence = [ ]
124
113
You can’t perform that action at this time.
0 commit comments