diff --git a/lib/docs/core/doc.rb b/lib/docs/core/doc.rb index 52bb3a33..f84908b9 100644 --- a/lib/docs/core/doc.rb +++ b/lib/docs/core/doc.rb @@ -16,11 +16,11 @@ module Docs return @version unless block_given? klass = Class.new(self) - klass.class_exec(&block) klass.name = name klass.slug = slug klass.version = version klass.links = links + klass.class_exec(&block) @versions ||= [] @versions << klass klass diff --git a/test/lib/docs/core/doc_test.rb b/test/lib/docs/core/doc_test.rb index e836d42c..2316ce8e 100644 --- a/test/lib/docs/core/doc_test.rb +++ b/test/lib/docs/core/doc_test.rb @@ -338,7 +338,7 @@ class DocsDocTest < MiniTest::Spec context "with args" do it "creates a version subclass" do - version = doc.version('4') { self.release = '8'} + version = doc.version('4') { self.release = '8'; self.links = ["https://#{self.version}"] } assert_equal [version], doc.versions @@ -351,6 +351,7 @@ class DocsDocTest < MiniTest::Spec assert_equal '8', version.release assert_equal 'name', version.name assert_equal 'type', version.type + assert_equal ['https://4'], version.links end end end