@@ -1231,6 +1231,72 @@ def extract_execution_results(group)
1231
1231
1232
1232
end
1233
1233
1234
+ describe "example group doc string" do
1235
+ it "accepts a string for an example group doc string" do
1236
+ expect { RSpec . describe 'MyClass' } . not_to output . to_stderr
1237
+ end
1238
+
1239
+ it "accepts a class for an example group doc string" do
1240
+ expect { RSpec . describe Numeric } . not_to output . to_stderr
1241
+ end
1242
+
1243
+ it "accepts a module for an example group doc string" do
1244
+ expect { RSpec . describe RSpec } . not_to output . to_stderr
1245
+ end
1246
+
1247
+ it "accepts example group without a doc string" do
1248
+ expect { RSpec . describe } . not_to output . to_stderr
1249
+ end
1250
+
1251
+ it "emits a warning when a Symbol is used as an example group doc string" do
1252
+ expect { RSpec . describe :foo }
1253
+ . to output ( /`:foo` is used as example group doc string. Use a string instead/ )
1254
+ . to_stderr
1255
+ end
1256
+
1257
+ it "emits a warning when a Hash is used as an example group doc string" do
1258
+ expect { RSpec . describe ( foo : :bar ) { } }
1259
+ . to output ( /`{:foo=>:bar}` is used as example group doc string. Use a string instead/ )
1260
+ . to_stderr
1261
+ end
1262
+ end
1263
+
1264
+ describe "example doc string" do
1265
+ let ( :group ) { RSpec . describe }
1266
+
1267
+ it "accepts a string for an example doc string" do
1268
+ expect { group . it ( 'MyClass' ) { } } . not_to output . to_stderr
1269
+ end
1270
+
1271
+ it "accepts example without a doc string" do
1272
+ expect { group . it { } } . not_to output . to_stderr
1273
+ end
1274
+
1275
+ it "emits a warning when a Class is used as an example doc string" do
1276
+ expect { group . it ( Numeric ) { } }
1277
+ . to output ( /`Numeric` is used as example doc string. Use a string instead/ )
1278
+ . to_stderr
1279
+ end
1280
+
1281
+ it "emits a warning when a Module is used as an example doc string" do
1282
+ expect { group . it ( RSpec ) { } }
1283
+ . to output ( /`RSpec` is used as example doc string. Use a string instead/ )
1284
+ . to_stderr
1285
+ end
1286
+
1287
+ it "emits a warning when a Symbol is used as an example doc string" do
1288
+ expect { group . it ( :foo ) { } }
1289
+ . to output ( /`:foo` is used as example doc string. Use a string instead/ )
1290
+ . to_stderr
1291
+ end
1292
+
1293
+ it "emits a warning when a Hash is used as an example doc string" do
1294
+ expect { group . it ( foo : :bar ) { } }
1295
+ . to output ( /`{:foo=>:bar}` is used as example doc string. Use a string instead/ )
1296
+ . to_stderr
1297
+ end
1298
+ end
1299
+
1234
1300
describe Object , "describing nested example_groups" , :little_less_nested => 'yep' do
1235
1301
1236
1302
describe "A sample nested group" , :nested_describe => "yep" do
0 commit comments