Sha256: bb3efef004fac8ee98a3ec6ac3faf6fd904c413fa20953470601585770dc0a11

Contents?: true

Size: 966 Bytes

Versions: 144

Compression:

Stored size: 966 Bytes

Contents

require "test_helper"

class ArtefactExternalLinkTest < ActiveSupport::TestCase
  context "validating a link" do
    should "not be valid without a title or URL" do
      refute ArtefactExternalLink.new.valid?
    end

    should "not be valid with URL missing" do
      refute ArtefactExternalLink.new(:title => "Foo").valid?
    end

    should "not be valid with title missing" do
      refute ArtefactExternalLink.new(:url => "http://bar.com").valid?
    end

    should "be valid with both fields supplied" do
      link = ArtefactExternalLink.new(:title => "Foo", :url => "http://bar.com")
      assert link.valid?
    end

    should "only be valid if the URL is valid" do
      link = ArtefactExternalLink.new(:title => "Foo", :url => "notreal://foo.com")
      refute link.valid?
    end

    should "be valid with an https URL" do
      link = ArtefactExternalLink.new(:title => "Foo", :url => "https://bar.com")
      assert link.valid?
    end
  end
end

Version data entries

144 entries across 144 versions & 1 rubygems

Version Path
govuk_content_models-42.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-41.1.1 test/models/artefact_external_link_test.rb
govuk_content_models-41.1.0 test/models/artefact_external_link_test.rb
govuk_content_models-41.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-40.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-39.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-38.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-37.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-36.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-35.0.1 test/models/artefact_external_link_test.rb
govuk_content_models-35.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-34.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-33.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-32.3.1 test/models/artefact_external_link_test.rb
govuk_content_models-32.3.0 test/models/artefact_external_link_test.rb
govuk_content_models-32.2.0 test/models/artefact_external_link_test.rb
govuk_content_models-32.1.0 test/models/artefact_external_link_test.rb
govuk_content_models-32.0.0 test/models/artefact_external_link_test.rb
govuk_content_models-31.4.0 test/models/artefact_external_link_test.rb
govuk_content_models-31.3.0 test/models/artefact_external_link_test.rb