323
323
describe '#attributes' do
324
324
context 'when display name is present' do
325
325
before do
326
- subject .display_name = 'something'
326
+ article .display_name = 'something'
327
327
end
328
328
329
329
it 'includes the display name' do
@@ -334,18 +334,19 @@ end
334
334
335
335
# good
336
336
describe '#attributes' do
337
- subject { FactoryBot.create(:article) }
337
+ let(:article) { FactoryBot.create(:article) }
338
+ subject { article.attributes }
338
339
339
340
specify do
340
- expect(subject.attributes ).to include subject .display_name
341
- expect(subject.attributes ).to include subject .created_at
341
+ expect(subject).to include article .display_name
342
+ expect(subject).to include article .created_at
342
343
end
343
344
end
344
345
345
346
describe '#attributes' do
346
347
context 'when display name is present' do
347
348
before do
348
- subject .display_name = 'something'
349
+ article .display_name = 'something'
349
350
end
350
351
351
352
it 'includes the display name' do
@@ -355,7 +356,7 @@ describe '#attributes' do
355
356
356
357
context 'when display name is not present' do
357
358
before do
358
- subject .display_name = nil
359
+ article .display_name = nil
359
360
end
360
361
361
362
it 'does not include the display name' do
@@ -914,13 +915,13 @@ Always use https://github.com/travisjeffery/timecop[Timecop] instead of stubbing
914
915
it 'offsets the time 2 days into the future' do
915
916
current_time = Time.now
916
917
allow(Time).to receive(:now).and_return(current_time)
917
- expect(subject.get_offset_time ).to eq(current_time + 2.days)
918
+ expect(subject).to eq(current_time + 2.days)
918
919
end
919
920
920
921
# good
921
922
it 'offsets the time 2 days into the future' do
922
923
Timecop.freeze(Time.now) do
923
- expect(subject.get_offset_time ).to eq 2.days.from_now
924
+ expect(subject).to eq 2.days.from_now
924
925
end
925
926
end
926
927
----
0 commit comments