|
52 | 52 |
|
53 | 53 | context '#increment' do |
54 | 54 |
|
55 | | - it 'increases the value by one' do |
| 55 | + it 'increases the value by one when no argument is given' do |
56 | 56 | counter = described_class.new(10) |
57 | 57 | 3.times{ counter.increment } |
58 | 58 | expect(counter.value).to eq 13 |
59 | 59 | end |
60 | 60 |
|
61 | | - it 'returns the new value' do |
| 61 | + it 'returns the new value when no argument is given' do |
62 | 62 | counter = described_class.new(10) |
63 | 63 | expect(counter.increment).to eq 11 |
64 | 64 | end |
65 | 65 |
|
| 66 | + it 'increases the value by the given argument' do |
| 67 | + counter = described_class.new(10) |
| 68 | + counter.increment(5) |
| 69 | + expect(counter.value).to eq 15 |
| 70 | + end |
| 71 | + |
| 72 | + it 'returns the new value the given argument' do |
| 73 | + counter = described_class.new(10) |
| 74 | + expect(counter.increment(5)).to eq 15 |
| 75 | + end |
| 76 | + |
66 | 77 | it 'is aliased as #up' do |
67 | 78 | expect(described_class.new(10).up).to eq 11 |
68 | 79 | end |
69 | 80 | end |
70 | 81 |
|
71 | 82 | context '#decrement' do |
72 | 83 |
|
73 | | - it 'decreases the value by one' do |
| 84 | + it 'decreases the value by one when no argument is given' do |
74 | 85 | counter = described_class.new(10) |
75 | 86 | 3.times{ counter.decrement } |
76 | 87 | expect(counter.value).to eq 7 |
77 | 88 | end |
78 | 89 |
|
79 | | - it 'returns the new value' do |
| 90 | + it 'returns the new value when no argument is given' do |
80 | 91 | counter = described_class.new(10) |
81 | 92 | expect(counter.decrement).to eq 9 |
82 | 93 | end |
83 | 94 |
|
| 95 | + it 'decreases the value by the given argument' do |
| 96 | + counter = described_class.new(10) |
| 97 | + counter.decrement(5) |
| 98 | + expect(counter.value).to eq 5 |
| 99 | + end |
| 100 | + |
| 101 | + it 'returns the new value the given argument' do |
| 102 | + counter = described_class.new(10) |
| 103 | + expect(counter.decrement(5)).to eq 5 |
| 104 | + end |
| 105 | + |
84 | 106 | it 'is aliased as #down' do |
85 | 107 | expect(described_class.new(10).down).to eq 9 |
86 | 108 | end |
|
0 commit comments