File: url_rewriter.rb

package info (click to toggle)
ruby-roadie 5.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 512 kB
  • sloc: ruby: 3,418; makefile: 5
file content (25 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (3)
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
# frozen_string_literal: true

shared_examples_for "url rewriter" do
  it "is constructed with a generator" do
    generator = double "URL generator"
    expect {
      described_class.new(generator)
    }.to_not raise_error
  end

  it "has a #transform_dom(dom) method that returns the modified string" do
    expect(subject).to respond_to(:transform_dom)
    expect(subject.method(:transform_dom).arity).to eq(1)

    dom = Nokogiri::HTML.parse "<body></body>"
    expect(subject.transform_dom(dom)).to be_nil
  end

  it "has a #transform_css(css) method that returns the modified string" do
    expect(subject).to respond_to(:transform_css)
    expect(subject.method(:transform_css).arity).to eq(1)

    expect(subject.transform_css("")).to eq("")
  end
end