Skip to content

Commit 1159e6d

Browse files
committed
ACH::StringFormattingHelper - add some specs for more context if the current code needs further work
1 parent 38c2f12 commit 1159e6d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
require 'spec_helper'
2+
3+
describe ACH::StringFormattingHelper do
4+
describe '.self.stringify_with_same_day' do
5+
subject do
6+
ACH::StringFormattingHelper.stringify_with_same_day(value)
7+
end
8+
9+
context 'Date' do
10+
let(:value) { Date.new(2022, 10, 15) }
11+
it { is_expected.to eq('221015') }
12+
end
13+
14+
context 'Time' do
15+
let(:value) { Time.new(2022, 10, 15, 1) }
16+
it { is_expected.to eq('221015') }
17+
end
18+
19+
context 'same day value' do
20+
let(:value) { 'SD0515' }
21+
it { is_expected.to eq('SD0515') }
22+
end
23+
24+
context 'less than 6 characters' do
25+
let(:value) { 'short' }
26+
it { is_expected.to eq(' short') }
27+
end
28+
29+
context 'more than 6 characters' do
30+
let(:value) { 'LONGSTRING' }
31+
it { is_expected.to eq('LONGST') }
32+
end
33+
end
34+
end

0 commit comments

Comments
 (0)