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
45 assert_equal 'doc', Docs::Doc.slug45 assert_equal 'doc', Docs::Doc.slug
46 end46 end
47 47
48 it "returns 'doc~42' when the class is Docs::Doc and its #version is '42'" do48 it "returns 'doc~4.2_lts' when the class is Docs::Doc and its #version is '42 LTS'" do
49 stub(Docs::Doc).version { '42' }49 stub(Docs::Doc).version { '4.2 LTS' }
50 assert_equal 'doc~42', Docs::Doc.slug50 assert_equal 'doc~4.2_lts', Docs::Doc.slug
51 end51 end
52 52
53 it "returns 'foo~42' when #slug has been set to 'foo' and #version to '42'" do53 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
141 assert_equal attribute, doc.as_json[attribute.to_sym]141 assert_equal attribute, doc.as_json[attribute.to_sym]
142 end142 end
143 end143 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
144 end150 end
145 151
146 describe ".store_page" do152 describe ".store_page" do