@@ -1024,12 +1024,12 @@ they will retry the match for given timeout allowing you to test ajax actions.
1024
1024
end
1025
1025
1026
1026
# the spec...
1027
- describe Article
1028
- describe ' # summary'
1027
+ describe Article do
1028
+ describe ' # summary' do
1029
1029
# ...
1030
1030
end
1031
1031
1032
- describe ' .latest'
1032
+ describe ' .latest' do
1033
1033
# ...
1034
1034
end
1035
1035
end
@@ -1229,7 +1229,7 @@ they will retry the match for given timeout allowing you to test ajax actions.
1229
1229
1230
1230
# spec/views/articles/show.html.haml_spec.rb
1231
1231
describe 'articles/show.html.haml' do
1232
- it 'displays the formatted date of article publishing'
1232
+ it 'displays the formatted date of article publishing' do
1233
1233
article = mock_model(Article, published_at: Date.new(2012, 01, 01))
1234
1234
assign(:article, article)
1235
1235
@@ -1344,15 +1344,15 @@ they will retry the match for given timeout allowing you to test ajax actions.
1344
1344
* Create the model for all examples in the spec to avoid duplication.
1345
1345
1346
1346
` ` ` Ruby
1347
- describe Article
1347
+ describe Article do
1348
1348
let(:article) { Fabricate(:article) }
1349
1349
end
1350
1350
` ` `
1351
1351
1352
1352
* Add an example ensuring that the fabricated model is valid.
1353
1353
1354
1354
` ` ` Ruby
1355
- describe Article
1355
+ describe Article do
1356
1356
it 'is valid with valid attributes' do
1357
1357
article.should be_valid
1358
1358
end
@@ -1365,15 +1365,15 @@ which should be validated. Using `be_valid` does not guarantee that the problem
1365
1365
1366
1366
` ` ` Ruby
1367
1367
# bad
1368
- describe '#title'
1368
+ describe '#title' do
1369
1369
it 'is required' do
1370
1370
article.title = nil
1371
1371
article.should_not be_valid
1372
1372
end
1373
1373
end
1374
1374
1375
1375
# prefered
1376
- describe '#title'
1376
+ describe '#title' do
1377
1377
it 'is required' do
1378
1378
article.title = nil
1379
1379
article.should have(1).error_on(:title)
@@ -1384,8 +1384,8 @@ which should be validated. Using `be_valid` does not guarantee that the problem
1384
1384
* Add a separate ` describe` for each attribute which has validations.
1385
1385
1386
1386
` ` ` Ruby
1387
- describe Article
1388
- describe '#title'
1387
+ describe Article do
1388
+ describe '#title' do
1389
1389
it 'is required' do
1390
1390
article.title = nil
1391
1391
article.should have(1).error_on(:title)
@@ -1397,8 +1397,8 @@ which should be validated. Using `be_valid` does not guarantee that the problem
1397
1397
* When testing uniqueness of a model attribute, name the other object ` another_object` .
1398
1398
1399
1399
` ` ` Ruby
1400
- describe Article
1401
- describe '#title'
1400
+ describe Article do
1401
+ describe '#title' do
1402
1402
it 'is unique' do
1403
1403
another_article = Fabricate.build(:article, title: article.title)
1404
1404
article.should have(1).error_on(:title)
@@ -1417,10 +1417,10 @@ which should be validated. Using `be_valid` does not guarantee that the problem
1417
1417
* the e- mail contains the required information
1418
1418
1419
1419
` ` ` Ruby
1420
- describe SubscriberMailer
1420
+ describe SubscriberMailer do
1421
1421
let(:subscriber) { mock_model(Subscription, email: 'johndoe@test.com', name: 'John Doe') }
1422
1422
1423
- describe 'successful registration email'
1423
+ describe 'successful registration email' do
1424
1424
subject { SubscriptionMailer.successful_registration_email(subscriber) }
1425
1425
1426
1426
its(:subject) { should == 'Successful Registration!' }
0 commit comments