File: html2text_spec.rb

package info (click to toggle)
ruby-html2text 0.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 196 kB
  • ctags: 19
  • sloc: ruby: 190; makefile: 8
file content (37 lines) | stat: -rw-r--r-- 812 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
29
30
31
32
33
34
35
36
37
require "spec_helper"

describe Html2Text do
  describe "#convert" do
    let(:text) { Html2Text.convert(html) }

    context "an empty line" do
      let(:html) { "" }

      it "is an empty line" do
        expect(text).to eq("")
      end
    end

    context "a simple string" do
      let(:html) { "hello world" }

      it "is an empty line" do
        expect(text).to eq("hello world")
      end
    end
  end

  describe "#remove_leading_and_trailing_whitespace" do
    let(:subject) { Html2Text.new(nil).remove_leading_and_trailing_whitespace(input) }

    context "an empty string" do
      let(:input) { "" }
      it { is_expected.to eq("") }
    end

    context "many new lines" do
      let(:input) { "hello\n  world \n yes" }
      it { is_expected.to eq("hello\nworld\nyes") }
    end
  end
end