spec/lib/percentable/percent_spec.rb in percentable-0.1.0 vs spec/lib/percentable/percent_spec.rb in percentable-1.0.0

- old
+ new

@@ -12,10 +12,19 @@ it 'should have a value of 50' do expect(subject.value).to eq 50 end end + + context 'with percent value' do + let(:value) { percent } + let(:percent) { Percentable::Percent.new(50) } + + it 'should return an equivalent percent' do + expect(subject).to eq percent + end + end end describe '#to_s' do context 'with value of 50' do let(:value) { 50 } @@ -272,9 +281,17 @@ it 'should say the percent is larger' do expect(percent > integer).to be true end end + end + end + + describe '#to_percent' do + let(:value) { 50 } + + it 'should return self' do + expect(subject.to_percent).to eq subject end end describe '.from_numeric' do let(:n) { 0.5 }