# frozen_string_literal: true
require 'spec_helper'
RSpec.describe LinkHelper do
describe "ext_url" do
it "adds prefix if missing" do
expect(helper.ext_url("http://example.com/", "http://example.com/bla")).to eq("http://example.com/bla")
expect(helper.ext_url("http://example.com/", "bla")).to eq("http://example.com/bla")
end
end
describe "link_to_or_disabled" do
it "behaves like the standard :link_to method e.g. it accepts the same arguments and accepts
blocks, etc." do
expect(helper.link_to_or_disabled("Go", "http://example.com/")).to eq(
"Go"
)
expect(helper.link_to_or_disabled("Go", "http://example.com/", class: "button")).to eq(
"Go"
)
expect(helper.link_to_or_disabled("http://example.com/") { "Go" }).to eq(
"Go"
)
end
it "accepts an additional boolean :disabled argument, which if true renders a disabled link" do
expect(helper.link_to_or_disabled("Go", "http://example.com/", disabled: true)).to eq(
"Go"
)
end
end
end