Skip to content
This repository

Support multibyte description #41

Merged
merged 2 commits into from almost 2 years ago

2 participants

Akihiro MATSUMURA Eric Oestrich
Akihiro MATSUMURA
mataki commented

Example filename is empty when description is multibyte string.

Eric Oestrich oestrich merged commit 7fb5e93 into from
Eric Oestrich oestrich closed this
Eric Oestrich
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Jul 09, 2012
Akihiro MATSUMURA mataki Support multibyte description 8296db9
Akihiro MATSUMURA mataki Support multibyte description
To out put file as "#{md5}.html"
c21408f
This page is out of date. Refresh to see the latest.
1  lib/rspec_api_documentation/html_writer.rb
@@ -73,6 +73,7 @@ def dirname
73 73
74 74 def filename
75 75 basename = description.downcase.gsub(/\s+/, '_').gsub(/[^a-z_]/, '')
  76 + basename = Digest::MD5.new.update(description).to_s if basename.blank?
76 77 "#{basename}.html"
77 78 end
78 79
23 spec/html_writer_spec.rb
... ... @@ -1,3 +1,4 @@
  1 +# -*- coding: utf-8 -*-
1 2 require 'spec_helper'
2 3
3 4 describe RspecApiDocumentation::HtmlWriter do
@@ -31,3 +32,25 @@
31 32 end
32 33 end
33 34 end
  35 +
  36 +describe RspecApiDocumentation::HtmlExample do
  37 + let(:metadata) { {} }
  38 + let(:group) { RSpec::Core::ExampleGroup.describe("Orders", metadata) }
  39 + let(:example) { group.example("Ordering a cup of coffee") {} }
  40 + let(:configuration) { RspecApiDocumentation::Configuration.new }
  41 + let(:html_example) { described_class.new(example, configuration) }
  42 +
  43 + it "should have downcased filename" do
  44 + html_example.filename.should == "ordering_a_cup_of_coffee.html"
  45 + end
  46 +
  47 + describe "multi charctor example name" do
  48 + let(:label) { "コーヒーが順番で並んでいること" }
  49 + let(:example) { group.example(label) {} }
  50 +
  51 + it "should have downcased filename" do
  52 + filename = Digest::MD5.new.update(label).to_s
  53 + html_example.filename.should == filename + ".html"
  54 + end
  55 + end
  56 +end

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.