Sha256: ddb3dcf8fd31f39a8a418b9aa73cd85bbf7f2905913e5e63d8ff8dd19b83738d

Contents?: true

Size: 1.69 KB

Versions: 20

Compression:

Stored size: 1.69 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Hyperdrive::Docs do
  before do
    @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 '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
    @docs.bold('name').must_equal '__name__'
  end

  it 'generates code formatted text' do
    @docs.code('/things').must_equal '`/things`'
  end

  it 'generates a bullet with nest level of 1 as default' do
    @docs.bullet('test').must_equal "  - test\n"
  end

  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
    @docs.bullet('`/things`', 2).must_equal "    - `/things`\n"
  end

  it 'generates nested bulleted bold text' do
    @docs.bullet('__id__', 3).must_equal "      - __id__\n"
  end

  it 'outputs a string of the completed doc' do
    @docs.output.must_be_kind_of String
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
hyperdrive-0.0.25 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.24 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.23 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.22 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.21 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.20 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.19 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.18 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.17 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.16 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.15 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.14 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.13 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.12 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.11 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.10 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.9 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.8 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.7 spec/hyperdrive/docs_spec.rb
hyperdrive-0.0.6 spec/hyperdrive/docs_spec.rb