History

Add support for blank and non-number version names

Ref #25.

Thibaut Courouble committed 10 years ago

Commit 3df9cff1 parent 16ddcb14 files · +14 −8Browse files

Showing the changes to test (1 of 4 files). Show all

Unified · Split

test/lib/docs/core/doc_test.rb+9−3
@@ -45,9 +45,9 @@ class DocsDocTest < MiniTest::Spec · 44 unmodified lines
4545 assert_equal 'doc', Docs::Doc.slug
4646 end
4747
48− it "returns 'doc~42' when the class is Docs::Doc and its #version is '42'" do
49− stub(Docs::Doc).version { '42' }
50− assert_equal 'doc~42', Docs::Doc.slug
48+ it "returns 'doc~4.2_lts' when the class is Docs::Doc and its #version is '42 LTS'" do
49+ stub(Docs::Doc).version { '4.2 LTS' }
50+ assert_equal 'doc~4.2_lts', Docs::Doc.slug
5151 end
5252
5353 it "returns 'foo~42' when #slug has been set to 'foo' and #version to '42'" do
@@ -141,6 +141,12 @@ class DocsDocTest < MiniTest::Spec · 87 unmodified lines
141141 assert_equal attribute, doc.as_json[attribute.to_sym]
142142 end
143143 end
144+
145+ it "includes the doc's version when it's defined and nil" do
146+ refute doc.as_json.key?(:version)
147+ doc.version = nil
148+ assert doc.as_json.key?(:version)
149+ end
144150 end
145151
146152 describe ".store_page" do