Skip to content

Commit 6b5b767

Browse files
committed
Add test for redundant module inclusion in a subclass
1 parent 1a68378 commit 6b5b767

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

spec/ruby-enum/enum_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ class FirstSubclass < Colors
1717
class SecondSubclass < FirstSubclass
1818
define :PINK, 'pink'
1919
end
20+
21+
class OtherSecondSubclass < FirstSubclass
22+
include Ruby::Enum
23+
24+
define :MAGENTA, 'magenta'
25+
end
26+
2027
it 'returns an enum value' do
2128
expect(Colors::RED).to eq 'red'
2229
expect(Colors::GREEN).to eq 'green'
@@ -169,6 +176,12 @@ class SecondSubclass < FirstSubclass
169176
expect(SecondSubclass.values).to eq(%w[red green orange pink])
170177
end
171178
end
179+
180+
context 'when a subclass of a subclass is defined with redundant module inclusion' do
181+
it 'returns all values' do
182+
expect(OtherSecondSubclass.values).to eq(%w[red green orange magenta])
183+
end
184+
end
172185
end
173186

174187
describe '#to_h' do

0 commit comments

Comments
 (0)