spec/hyperdrive/docs_spec.rb in hyperdrive-0.0.5 vs spec/hyperdrive/docs_spec.rb in hyperdrive-0.0.6
- old
+ new
@@ -2,23 +2,26 @@
require 'spec_helper'
describe Hyperdrive::Docs do
before do
- sample_api
- @docs = Hyperdrive::Docs.new(hyperdrive.resources)
+ @resources = { :thing => default_resource }
+ @docs = Hyperdrive::Docs.new(@resources)
end
it 'generates a header with size 1 as default' do
@docs.header('Thing Resource').must_equal "\n\n# Thing Resource\n\n"
end
- it 'generates a header only between size 1 and 6' do
- proc {@docs.header('Thing Resource', 0)}.must_raise ArgumentError
- proc {@docs.header('Thing Resource', 8)}.must_raise ArgumentError
+ it 'raises an error if header size is less than 1' do
+ proc { @docs.header('Thing Resource', 0) }.must_raise ArgumentError
end
+ it 'raises an error if header size is greater than 6' do
+ proc { @docs.header('Thing Resource', 8) }.must_raise ArgumentError
+ end
+
it 'generates a paragraph' do
@docs.paragraph('Description of Thing Resource').must_equal "Description of Thing Resource\n\n"
end
it 'generates bold text' do
@@ -31,15 +34,18 @@
it 'generates a bullet with nest level of 1 as default' do
@docs.bullet('test').must_equal " - test\n"
end
- it 'generates a bullet with nest level between 1 and 3' do
- proc {@docs.bullet('test', 4)}.must_raise ArgumentError
+ it 'raises an error if bullet indention size is less than 1' do
proc {@docs.bullet('test', 0)}.must_raise ArgumentError
end
+ it 'raises an error if bullet indention size is greater than 3' do
+ proc {@docs.bullet('test', 4)}.must_raise ArgumentError
+ end
+
it 'generates a nested bulleted list' do
@docs.bullet('test', 2).must_equal " - test\n"
end
it 'generates a nested bullet code span' do
@@ -51,6 +57,6 @@
end
it 'outputs a string of the completed doc' do
@docs.output.must_be_kind_of String
end
-end
\ No newline at end of file
+end