Sha256: 23533888b50f66d5a0f15e1fd3998d1c84ad46722b0a9ca96a8f3a7cb1de94f3

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'
require 'nokogiri'

describe Fdoc::ServicePresenter do
  subject {
    Fdoc::ServicePresenter.new(Fdoc::Service.new('spec/fixtures/members'))
  }

  context "#to_html" do
    it "should generate valid HTML" do
      html = subject.to_html

      expect {
        Nokogiri::HTML(html) { |config| config.strict }
      }.to_not raise_exception
    end
  end

  context "#to_markdown" do
    it "should generate markdown" do
      markdown = subject.to_markdown
      markdown.should include "* PUT [https:​/​/api.sample.com​/members​/add](add-PUT.md)"
      markdown.should include "* POST [https:​/​/api.sample.com​/members​/draft](draft-POST.md)"
    end
  end

  context "#relative_meta_service_path" do
    let(:meta_service) { Fdoc::MetaServicePresenter.new(Fdoc::MetaService.new('spec/fixtures')) }
    before do
      subject.service.meta_service = meta_service
    end

    its(:relative_meta_service_path) { should == "../"}

    context "pass in filename" do
      it "should join with filename" do
        subject.relative_meta_service_path('index.md').should == "../index.md"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fdoc-0.3.3 spec/fdoc/presenters/service_presenter_spec.rb
fdoc-0.3.2 spec/fdoc/presenters/service_presenter_spec.rb
fdoc-0.3.1 spec/fdoc/presenters/service_presenter_spec.rb