File: code_spec.rb

package info (click to toggle)
ruby-reverse-markdown 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 440 kB
  • sloc: ruby: 1,452; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 911 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'spec_helper'

describe ReverseMarkdown do

  let(:input)    { File.read('spec/assets/code.html') }
  let(:document) { Nokogiri::HTML(input) }
  subject { ReverseMarkdown.convert(input) }

  it { is_expected.to match /inline `code` block/ }
  it { is_expected.to match /\    var this\;\n    this\.is/ }
  it { is_expected.to match /block"\)\n    console/ }

  context "with github style code blocks" do
    subject { ReverseMarkdown.convert(input, github_flavored: true) }
    it { is_expected.to match /inline `code` block/ }
    it { is_expected.to match /```\nvar this\;\nthis/ }
    it { is_expected.to match /it is"\) ?\n```/ }
  end

  context "code with indentation" do
    subject { ReverseMarkdown.convert(input) }
    it { is_expected.to match(/^    tell application "Foo"\n/) }
    it { is_expected.to match(/^        beep\n/) }
    it { is_expected.to match(/^    end tell\n/) }
  end

end