Sha256: ff7aa0b5610fd643113de8ece07a90a0c079f60703aebe7720fbf2e61fd64d58

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'
require 'nokogiri'

describe Fdoc::MetaServicePresenter do
  subject {
    Fdoc::MetaServicePresenter.new(Fdoc::MetaService.new('spec/fixtures'))
  }

  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](members_api/add-PUT.md)"
      markdown.should include "* POST [https:​/​/api.sample.com​/members​/draft](members_api/draft-POST.md)"
    end
  end

  context "#relative_service_path" do
    let(:service) { subject.services.first }

    it "returns relative path" do
      subject.relative_service_path(service).should == "members_api"
    end

    it "should join relative path if passed in a filename" do
      subject.relative_service_path(service, 'index.md').should == "members_api/index.md"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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