spec/cli_spec.rb in kramdown-man-1.0.0 vs spec/cli_spec.rb in kramdown-man-1.0.1
- old
+ new
@@ -114,10 +114,15 @@
let(:man_dir) { File.join(__dir__,'..','man') }
let(:markdown_file) { File.join(man_dir,'kramdown-man.1.md') }
describe "#run" do
+ let(:version) { Kramdown::Man::VERSION }
+ let(:man_page_regex) do
+ /\A.\\" Generated by kramdown-man #{Regexp.escape(version)}\n/
+ end
+
context "when given a markdown file" do
let(:argv) { [markdown_file] }
context "and when the -o,--output option is also given" do
let(:tempfile) { Tempfile.new(['kramdown-man-', '.1']) }
@@ -127,11 +132,11 @@
before { subject.option_parser.parse(argv) }
it "must write the man page output to the output file" do
subject.run(markdown_file)
- expect(File.read(output)).to match(/\A.\\" Generated by kramdown-man 1.0.0\n/)
+ expect(File.read(output)).to match(man_page_regex)
end
end
context "but STDOUT is a TTY" do
before { expect($stdout).to receive(:tty?).and_return(true) }
@@ -146,10 +151,10 @@
context "but STDOUT is not a TTY" do
it "must print the man page to stdout" do
expect {
subject.run(argv)
- }.to output(/\A.\\" Generated by kramdown-man 1.0.0\n/).to_stdout
+ }.to output(man_page_regex).to_stdout
end
end
context "but the given markdown file does not exist" do
let(:markdown_file) { 'does/not/exist.md' }