test/lib/vedeu/presentation/parent_test.rb in vedeu-0.8.26 vs test/lib/vedeu/presentation/parent_test.rb in vedeu-0.8.27
- old
+ new
@@ -8,10 +8,11 @@
include Vedeu::Presentation::Parent
def initialize(attributes = {})
@colour = attributes[:colour]
+ @name = attributes[:name]
@parent = attributes[:parent]
end
end # PresentationParentTestClass
@@ -20,17 +21,56 @@
describe Parent do
let(:described) { Vedeu::Presentation::Parent }
let(:included_described) { Vedeu::PresentationParentTestClass }
let(:included_instance) { included_described.new(attributes) }
+ let(:parent) { Vedeu::PresentationParentTestClass.new }
+ let(:_name) { :vedeu_presentation_parent }
let(:attributes) {
{
- parent: Vedeu::PresentationParentTestClass.new
+ name: _name,
+ parent: parent,
}
}
+ describe '#name' do
+ subject { included_instance.name }
+
+ context 'when a name is set' do
+ it { subject.must_equal(_name) }
+ end
+
+ context 'when a name is not set' do
+ let(:_name) {}
+
+ # context 'when a parent name is set' do
+ # it { subject.must_equal('Vedeu::Line') }
+ # end
+
+ context 'when a parent name is not set' do
+ let(:parent) {}
+
+ it { subject.must_equal(nil) }
+ end
+ end
+ end
+
describe '#parent' do
it { included_instance.must_respond_to(:parent) }
+ end
+
+ describe '#parent?' do
+ subject { included_instance.parent? }
+
+ context 'when the parent attribute is set' do
+ it { subject.must_equal(true) }
+ end
+
+ context 'when the parent attribute is not set' do
+ let(:parent) {}
+
+ it { subject.must_equal(false) }
+ end
end
end # Parent
end # Presentation